pax_global_header00006660000000000000000000000064141370551310014512gustar00rootroot0000000000000052 comment=daea1ecfdefec84938d0921d9a98d9b3dd2007d4 analysis-0.21.1/000077500000000000000000000000001413705513100134165ustar00rootroot00000000000000analysis-0.21.1/.codecov.yml000066400000000000000000000001021413705513100156320ustar00rootroot00000000000000coverage: status: patch: default: target: 80% analysis-0.21.1/.gitattributes000066400000000000000000000000221413705513100163030ustar00rootroot00000000000000*.go text eol=lf analysis-0.21.1/.github/000077500000000000000000000000001413705513100147565ustar00rootroot00000000000000analysis-0.21.1/.github/CONTRIBUTING.md000066400000000000000000000114601413705513100172110ustar00rootroot00000000000000## Contribution Guidelines ### Pull requests are always welcome We are always thrilled to receive pull requests, and do our best to process them as fast as possible. Not sure if that typo is worth a pull request? Do it! We will appreciate it. If your pull request is not accepted on the first try, don't be discouraged! If there's a problem with the implementation, hopefully you received feedback on what to improve. We're trying very hard to keep go-swagger lean and focused. We don't want it to do everything for everybody. This means that we might decide against incorporating a new feature. However, there might be a way to implement that feature *on top of* go-swagger. ### Conventions Fork the repo and make changes on your fork in a feature branch: - If it's a bugfix branch, name it XXX-something where XXX is the number of the issue - If it's a feature branch, create an enhancement issue to announce your intentions, and name it XXX-something where XXX is the number of the issue. Submit unit tests for your changes. Go has a great test framework built in; use it! Take a look at existing tests for inspiration. Run the full test suite on your branch before submitting a pull request. Update the documentation when creating or modifying features. Test your documentation changes for clarity, concision, and correctness, as well as a clean documentation build. See ``docs/README.md`` for more information on building the docs and how docs get released. Write clean code. Universally formatted code promotes ease of writing, reading, and maintenance. Always run `gofmt -s -w file.go` on each changed file before committing your changes. Most editors have plugins that do this automatically. Pull requests descriptions should be as clear as possible and include a reference to all the issues that they address. Pull requests must not contain commits from other users or branches. Commit messages must start with a capitalized and short summary (max. 50 chars) written in the imperative, followed by an optional, more detailed explanatory text which is separated from the summary by an empty line. Code review comments may be added to your pull request. Discuss, then make the suggested modifications and push additional commits to your feature branch. Be sure to post a comment after pushing. The new commits will show up in the pull request automatically, but the reviewers will not be notified unless you comment. Before the pull request is merged, make sure that you squash your commits into logical units of work using `git rebase -i` and `git push -f`. After every commit the test suite should be passing. Include documentation changes in the same commit so that a revert would remove all traces of the feature or fix. Commits that fix or close an issue should include a reference like `Closes #XXX` or `Fixes #XXX`, which will automatically close the issue when merged. ### Sign your work The sign-off is a simple line at the end of the explanation for the patch, which certifies that you wrote it or otherwise have the right to pass it on as an open-source patch. The rules are pretty simple: if you can certify the below (from [developercertificate.org](http://developercertificate.org/)): ``` Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 660 York Street, Suite 102, San Francisco, CA 94110 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. ``` then you just add a line to every git commit message: Signed-off-by: Joe Smith using your real name (sorry, no pseudonyms or anonymous contributions.) You can add the sign off when creating the git commit via `git commit -s`. analysis-0.21.1/.github/workflows/000077500000000000000000000000001413705513100170135ustar00rootroot00000000000000analysis-0.21.1/.github/workflows/ci.yaml000066400000000000000000000017611413705513100202770ustar00rootroot00000000000000name: Go on: [push, pull_request] jobs: build: runs-on: ${{ matrix.os }} strategy: matrix: os: [ ubuntu-latest, macos-latest, windows-latest ] fail-fast: false steps: - uses: actions/checkout@v2 - name: Set up Go uses: actions/setup-go@v2 with: go-version: 1.17.1 - name: Setup gotestsum uses: autero1/action-gotestsum@v1.0.0 with: gotestsum_version: 1.7.0 - name: Test run: gotestsum --format short-verbose -- -race -timeout=20m -coverprofile=coverage_txt -covermode=atomic ./... - name: analysis_test run: cd analysis_test && go test - uses: codecov/codecov-action@v2 with: files: coverage_txt lint: runs-on: ${{ matrix.os }} strategy: matrix: os: [ ubuntu-latest, macos-latest, windows-latest ] fail-fast: false steps: - uses: actions/checkout@v2 - uses: golangci/golangci-lint-action@v2 with: args: --timeout=5m analysis-0.21.1/.gitignore000066400000000000000000000000621413705513100154040ustar00rootroot00000000000000secrets.yml coverage.out coverage.txt *.cov .idea analysis-0.21.1/.golangci.yml000066400000000000000000000016771413705513100160150ustar00rootroot00000000000000linters-settings: govet: check-shadowing: true golint: min-confidence: 0 gocyclo: min-complexity: 40 gocognit: min-complexity: 40 maligned: suggest-new: true dupl: threshold: 150 goconst: min-len: 2 min-occurrences: 4 linters: enable-all: true disable: - maligned - lll - gochecknoglobals - gochecknoinits # scopelint is useful, but also reports false positives # that unfortunately can't be disabled. So we disable the # linter rather than changing code that works. # see: https://github.com/kyoh86/scopelint/issues/4 - scopelint - godox - gocognit #- whitespace - wsl - funlen - testpackage - wrapcheck #- nlreturn - gomnd - goerr113 - exhaustivestruct #- errorlint #- nestif - gofumpt - godot - gci - dogsled - paralleltest - tparallel - thelper - ifshort - forbidigo - cyclop analysis-0.21.1/CODE_OF_CONDUCT.md000066400000000000000000000062411413705513100162200ustar00rootroot00000000000000# Contributor Covenant Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at ivan+abuse@flanders.co.nz. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] [homepage]: http://contributor-covenant.org [version]: http://contributor-covenant.org/version/1/4/ analysis-0.21.1/LICENSE000066400000000000000000000261361413705513100144330ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. analysis-0.21.1/README.md000066400000000000000000000033511413705513100146770ustar00rootroot00000000000000# OpenAPI initiative analysis [![Build Status](https://travis-ci.org/go-openapi/analysis.svg?branch=master)](https://travis-ci.org/go-openapi/analysis) [![Build status](https://ci.appveyor.com/api/projects/status/x377t5o9ennm847o/branch/master?svg=true)](https://ci.appveyor.com/project/casualjim/go-openapi/analysis/branch/master) [![codecov](https://codecov.io/gh/go-openapi/analysis/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/analysis) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) [![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/analysis/master/LICENSE) [![Go Reference](https://pkg.go.dev/badge/github.com/go-openapi/analysis.svg)](https://pkg.go.dev/github.com/go-openapi/analysis) [![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/analysis)](https://goreportcard.com/report/github.com/go-openapi/analysis) A foundational library to analyze an OAI specification document for easier reasoning about the content. ## What's inside? * A analyzer providing methods to walk the functional content of a specification * A spec flattener producing a self-contained document bundle, while preserving `$ref`s * A spec merger ("mixin") to merge several spec documents into a primary spec * A spec "fixer" ensuring that response descriptions are non empty [Documentation](https://godoc.org/github.com/go-openapi/analysis) ## FAQ * Does this library support OpenAPI 3? > No. > This package currently only supports OpenAPI 2.0 (aka Swagger 2.0). > There is no plan to make it evolve toward supporting OpenAPI 3.x. > This [discussion thread](https://github.com/go-openapi/spec/issues/21) relates the full story. > analysis-0.21.1/analysis_test/000077500000000000000000000000001413705513100163005ustar00rootroot00000000000000analysis-0.21.1/analysis_test/doc_test.go000066400000000000000000000031141413705513100204320ustar00rootroot00000000000000// Copyright 2015 go-swagger maintainers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package analysis_test import ( "fmt" "github.com/go-openapi/analysis" // This package "github.com/go-openapi/loads" // Spec loading ) func ExampleSpec() { // Example with spec file in this repo path := "../fixtures/flatten.yml" doc, err := loads.Spec(path) // Load spec from file if err == nil { an := analysis.New(doc.Spec()) // Analyze spec paths := an.AllPaths() fmt.Printf("This spec contains %d paths", len(paths)) } // Output: This spec contains 2 paths } func ExampleFlatten() { // Example with spec file in this repo path := "../fixtures/flatten.yml" doc, err := loads.Spec(path) // Load spec from file if err == nil { an := analysis.New(doc.Spec()) // Analyze spec // flatten the specification in doc erf := analysis.Flatten(analysis.FlattenOpts{Spec: an, BasePath: path}) if erf == nil { fmt.Printf("Specification doc flattened") } // .. the analyzed spec has been updated and may be now used with the reworked spec } // Output: Specification doc flattened } analysis-0.21.1/analysis_test/go.mod000066400000000000000000000004631413705513100174110ustar00rootroot00000000000000module github.com/go-openapi/analysis/analysis_test go 1.13 require ( github.com/go-openapi/analysis v0.20.1 github.com/go-openapi/loads v0.21.0 github.com/go-openapi/spec v0.20.4 github.com/go-openapi/swag v0.19.15 github.com/stretchr/testify v1.7.0 ) replace github.com/go-openapi/analysis => ../ analysis-0.21.1/analysis_test/go.sum000066400000000000000000000672231413705513100174450ustar00rootroot00000000000000github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef h1:46PFijGLmAjMPwCCCo7Jf0W6f9slllCkkv7vyc1yOSg= github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= github.com/go-openapi/errors v0.18.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= github.com/go-openapi/errors v0.19.6/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/errors v0.19.7/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/errors v0.19.9 h1:9SnKdGhiPZHF3ttwFMiCBEb8jQ4IDdrK+5+a0oTygA4= github.com/go-openapi/errors v0.19.9/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.18.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= github.com/go-openapi/jsonreference v0.18.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= github.com/go-openapi/jsonreference v0.19.5/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg= github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs= github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= github.com/go-openapi/loads v0.17.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.18.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.19.2/go.mod h1:QAskZPMX5V0C2gvfkGZzJlINuP7Hx/4+ix5jWFxsNPs= github.com/go-openapi/loads v0.19.3/go.mod h1:YVfqhUCdahYwR3f3iiwQLhicVRvLlU/WO5WPaZvcvSI= github.com/go-openapi/loads v0.19.5/go.mod h1:dswLCAdonkRufe/gSUC3gN8nTSaB9uaS2es0x5/IbjY= github.com/go-openapi/loads v0.19.7/go.mod h1:brCsvE6j8mnbmGBh103PT/QLHfbyDxA4hsKvYBNEGVc= github.com/go-openapi/loads v0.20.0/go.mod h1:2LhKquiE513rN5xC6Aan6lYOSddlL8Mp20AW9kpviM4= github.com/go-openapi/loads v0.20.2/go.mod h1:hTVUotJ+UonAMMZsvakEgmWKgtulweO9vYP2bQYKA/o= github.com/go-openapi/loads v0.21.0 h1:jYtUO4wwP7psAweisP/MDoOpdzsYEESdoPcsWjHDR68= github.com/go-openapi/loads v0.21.0/go.mod h1:rHYve9nZrQ4CJhyeIIFJINGCg1tQpx2yJrrNo8sf1ws= github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9/go.mod h1:6v9a6LTXWQCdL8k1AO3cvqx5OtZY/Y9wKTgaoP6YRfA= github.com/go-openapi/runtime v0.19.0/go.mod h1:OwNfisksmmaZse4+gpV3Ne9AyMOlP1lt4sK4FXt0O64= github.com/go-openapi/runtime v0.19.4/go.mod h1:X277bwSUBxVlCYR3r7xgZZGKVvBd/29gLDlFGtJ8NL4= github.com/go-openapi/runtime v0.19.15/go.mod h1:dhGWCTKRXlAfGnQG0ONViOZpjfg0m2gUt9nTQPQZuoo= github.com/go-openapi/runtime v0.19.16/go.mod h1:5P9104EJgYcizotuXhEuUrzVc+j1RiSjahULvYmlv98= github.com/go-openapi/runtime v0.19.24 h1:TqagMVlRAOTwllE/7hNKx6rQ10O6T8ZzeJdMjSTKaD4= github.com/go-openapi/runtime v0.19.24/go.mod h1:Lm9YGCeecBnUUkFTxPC4s1+lwrkJ0pthx8YvyjCfkgk= github.com/go-openapi/spec v0.17.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcsZsD5zxMY= github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= github.com/go-openapi/spec v0.19.6/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk= github.com/go-openapi/spec v0.19.8/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk= github.com/go-openapi/spec v0.19.15/go.mod h1:+81FIL1JwC5P3/Iuuozq3pPE9dXdIEGxFutcFKaVbmU= github.com/go-openapi/spec v0.20.0/go.mod h1:+81FIL1JwC5P3/Iuuozq3pPE9dXdIEGxFutcFKaVbmU= github.com/go-openapi/spec v0.20.1/go.mod h1:93x7oh+d+FQsmsieroS4cmR3u0p/ywH649a3qwC9OsQ= github.com/go-openapi/spec v0.20.3/go.mod h1:gG4F8wdEDN+YPBMVnzE85Rbhf+Th2DTvA9nFPQ5AYEg= github.com/go-openapi/spec v0.20.4 h1:O8hJrt0UMnhHcluhIdUgCLRWyM2x7QkBXRvOs7m+O1M= github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= github.com/go-openapi/strfmt v0.17.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= github.com/go-openapi/strfmt v0.18.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= github.com/go-openapi/strfmt v0.19.0/go.mod h1:+uW+93UVvGGq2qGaZxdDeJqSAqBqBdl+ZPMF/cC8nDY= github.com/go-openapi/strfmt v0.19.2/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU= github.com/go-openapi/strfmt v0.19.3/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU= github.com/go-openapi/strfmt v0.19.5/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk= github.com/go-openapi/strfmt v0.19.11/go.mod h1:UukAYgTaQfqJuAFlNxxMWNvMYiwiXtLsF2VwmoFtbtc= github.com/go-openapi/strfmt v0.20.0/go.mod h1:UukAYgTaQfqJuAFlNxxMWNvMYiwiXtLsF2VwmoFtbtc= github.com/go-openapi/strfmt v0.20.2/go.mod h1:43urheQI9dNtE5lTZQfuFJvjYJKPrxicATpEfZwHUNk= github.com/go-openapi/strfmt v0.21.0 h1:hX2qEZKmYks+t0hKeb4VTJpUm2UYsdL3+DCid5swxIs= github.com/go-openapi/strfmt v0.21.0/go.mod h1:ZRQ409bWMj+SOgXofQAGTIo2Ebu72Gs+WaRADcS5iNg= github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= github.com/go-openapi/swag v0.18.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.7/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY= github.com/go-openapi/swag v0.19.9/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY= github.com/go-openapi/swag v0.19.12/go.mod h1:eFdyEBkTdoAf/9RXBvj4cr1nH7GD8Kzo5HTt47gr72M= github.com/go-openapi/swag v0.19.13/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM= github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA= github.com/go-openapi/validate v0.19.3/go.mod h1:90Vh6jjkTn+OT1Eefm0ZixWNFjhtOH7vS9k0lo6zwJo= github.com/go-openapi/validate v0.19.10/go.mod h1:RKEZTUWDkxKQxN2jDT7ZnZi2bhZlbNMAuKvKB+IaGx8= github.com/go-openapi/validate v0.19.12/go.mod h1:Rzou8hA/CBw8donlS6WNEUQupNvUZ0waH08tGe6kAQ4= github.com/go-openapi/validate v0.19.15/go.mod h1:tbn/fdOwYHgrhPBzidZfJC2MIVvs9GA7monOmWBbeCI= github.com/go-openapi/validate v0.20.1/go.mod h1:b60iJT+xNNLfaQJUqLI7946tYiFEOuE9E4k54HpKcJ0= github.com/go-openapi/validate v0.20.3 h1:GZPPhhKSZrE8HjB4eEkoYAZmoWA4+tCemSgINH1/vKw= github.com/go-openapi/validate v0.20.3/go.mod h1:goDdqVGiigM3jChcrYJxD2joalke3ZXeftD16byIjA4= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY= github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg= github.com/gobuffalo/envy v1.6.15/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= github.com/gobuffalo/flect v0.1.0/go.mod h1:d2ehjJqGOH/Kjqcoz+F7jHTBbmDb38yXA598Hb50EGs= github.com/gobuffalo/flect v0.1.1/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= github.com/gobuffalo/flect v0.1.3/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= github.com/gobuffalo/genny v0.0.0-20190329151137-27723ad26ef9/go.mod h1:rWs4Z12d1Zbf19rlsn0nurr75KqhYp52EAGGxTbBhNk= github.com/gobuffalo/genny v0.0.0-20190403191548-3ca520ef0d9e/go.mod h1:80lIj3kVJWwOrXWWMRzzdhW3DsrdjILVil/SFKBzF28= github.com/gobuffalo/genny v0.1.0/go.mod h1:XidbUqzak3lHdS//TPu2OgiFB+51Ur5f7CSnXZ/JDvo= github.com/gobuffalo/genny v0.1.1/go.mod h1:5TExbEyY48pfunL4QSXxlDOmdsD44RRq4mVZ0Ex28Xk= github.com/gobuffalo/gitgen v0.0.0-20190315122116-cc086187d211/go.mod h1:vEHJk/E9DmhejeLeNt7UVvlSGv3ziL+djtTr3yyzcOw= github.com/gobuffalo/gogen v0.0.0-20190315121717-8f38393713f5/go.mod h1:V9QVDIxsgKNZs6L2IYiGR8datgMhB577vzTDqypH360= github.com/gobuffalo/gogen v0.1.0/go.mod h1:8NTelM5qd8RZ15VjQTFkAW6qOMx5wBbW4dSCS3BY8gg= github.com/gobuffalo/gogen v0.1.1/go.mod h1:y8iBtmHmGc4qa3urIyo1shvOD8JftTtfcKi+71xfDNE= github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2/go.mod h1:QdxcLw541hSGtBnhUc4gaNIXRjiDppFGaDqzbrBd3v8= github.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= github.com/gobuffalo/mapi v1.0.2/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ= github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0= github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA= github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.3.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.3.4/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE= go.mongodb.org/mongo-driver v1.4.3/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= go.mongodb.org/mongo-driver v1.4.4/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= go.mongodb.org/mongo-driver v1.4.6/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= go.mongodb.org/mongo-driver v1.5.1/go.mod h1:gRXCHX4Jo7J0IJ1oDQyUxF7jfy19UfxniMS4xxMmUqw= go.mongodb.org/mongo-driver v1.7.3 h1:G4l/eYY9VrQAK/AUgkV0koQKzQnyddnWxrd/Etf0jIs= go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210421230115-4e50805a0758 h1:aEpZnXcAmXkd6AvLb2OPt+EN1Zu/8Ne3pCqPjja5PXY= golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190321052220-f7bb7a8bee54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190419153524-e8e3143a4f4a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190329151228-23e29df326fe/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= analysis-0.21.1/analysis_test/helpers_spec_test.go000066400000000000000000000044371413705513100223520ustar00rootroot00000000000000package analysis_test import ( "encoding/json" "fmt" "regexp" "testing" "github.com/go-openapi/spec" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) var ( rex = regexp.MustCompile(`"\$ref":\s*"(.*?)"`) ) func assertRefResolve(t *testing.T, jazon, exclude string, root interface{}, opts ...*spec.ExpandOptions) { assertRefWithFunc(t, "resolve", jazon, exclude, func(t *testing.T, match string) { ref := spec.MustCreateRef(match) var ( sch *spec.Schema err error ) if len(opts) > 0 { options := *opts[0] sch, err = spec.ResolveRefWithBase(root, &ref, &options) } else { sch, err = spec.ResolveRef(root, &ref) } require.NoErrorf(t, err, `%v: for "$ref": %q`, err, match) require.NotNil(t, sch) }) } // assertNoRef ensures that no $ref is remaining in json doc func assertNoRef(t testing.TB, jazon string) { m := rex.FindAllStringSubmatch(jazon, -1) require.Nil(t, m) } func assertRefInJSONRegexp(t testing.TB, jazon, match string) { // assert a match in a references m := rex.FindAllStringSubmatch(jazon, -1) require.NotNil(t, m) refMatch, err := regexp.Compile(match) require.NoError(t, err) for _, matched := range m { subMatch := matched[1] assert.True(t, refMatch.MatchString(subMatch), "expected $ref to match %q, got: %s", match, matched[0]) } } // assertRefResolve ensures that all $ref in some json doc verify some asserting func. // // "exclude" is a regexp pattern to ignore certain $ref (e.g. some specs may embed $ref that are not processed, such as extensions). func assertRefWithFunc(t *testing.T, name, jazon, exclude string, asserter func(*testing.T, string)) { filterRex := regexp.MustCompile(exclude) m := rex.FindAllStringSubmatch(jazon, -1) require.NotNil(t, m) allRefs := make(map[string]struct{}, len(m)) for _, toPin := range m { matched := toPin subMatch := matched[1] if exclude != "" && filterRex.MatchString(subMatch) { continue } _, ok := allRefs[subMatch] if ok { continue } allRefs[subMatch] = struct{}{} t.Run(fmt.Sprintf("%s-%s-%s", t.Name(), name, subMatch), func(t *testing.T) { t.Parallel() asserter(t, subMatch) }) } } func asJSON(t testing.TB, sp interface{}) string { bbb, err := json.MarshalIndent(sp, "", " ") require.NoError(t, err) return string(bbb) } analysis-0.21.1/analysis_test/spec_test.go000066400000000000000000000140521413705513100206220ustar00rootroot00000000000000package analysis_test import ( "io/ioutil" "net/http" "net/http/httptest" "os" "testing" "github.com/go-openapi/analysis" "github.com/go-openapi/analysis/internal/antest" "github.com/go-openapi/loads" "github.com/go-openapi/spec" "github.com/go-openapi/swag" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func skipNotify(t *testing.T) { t.Log("To enable this long running test, use -args -enable-long in your go test command line") } func Test_FlattenAzure(t *testing.T) { if !antest.LongTestsEnabled() { skipNotify(t) t.SkipNow() } t.Parallel() // Local copy of https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/network/resource-manager/Microsoft.Network/stable/2020-04-01/publicIpAddress.json url := "../fixtures/azure/publicIpAddress.json" byts, err := swag.LoadFromFileOrHTTP(url) assert.NoError(t, err) swagger := &spec.Swagger{} require.NoError(t, swagger.UnmarshalJSON(byts)) analyzed := analysis.New(swagger) require.NoError(t, analysis.Flatten(analysis.FlattenOpts{Spec: analyzed, Expand: true, BasePath: url})) jazon := asJSON(t, swagger) assertRefInJSONRegexp(t, jazon, `^(#/definitions/)|(\./example)`) t.Run("resolve local $ref azure", func(t *testing.T) { assertRefResolve(t, jazon, `\./example`, swagger, &spec.ExpandOptions{RelativeBase: url}) }) } func TestRemoteFlattenAzure_Expand(t *testing.T) { if !antest.LongTestsEnabled() { skipNotify(t) t.SkipNow() } t.Parallel() server := httptest.NewServer(http.FileServer(http.Dir("../fixtures/azure"))) defer server.Close() basePath := server.URL + "/publicIpAddress.json" swagger, err := loads.Spec(basePath) require.NoError(t, err) require.NoError(t, analysis.Flatten(analysis.FlattenOpts{Spec: swagger.Analyzer, Expand: true, BasePath: basePath})) jazon := asJSON(t, swagger.Spec()) assertRefInJSONRegexp(t, jazon, `^(#/definitions/)|(\./example)`) t.Run("resolve remote $ref azure [after expansion]", func(t *testing.T) { assertRefResolve(t, jazon, `\./example`, swagger.Spec(), &spec.ExpandOptions{RelativeBase: basePath}) }) } func TestRemoteFlattenAzure_Flatten(t *testing.T) { if !antest.LongTestsEnabled() { skipNotify(t) t.SkipNow() } t.Parallel() server := httptest.NewServer(http.FileServer(http.Dir("../fixtures/azure"))) defer server.Close() basePath := server.URL + "/publicIpAddress.json" swagger, err := loads.Spec(basePath) require.NoError(t, err) require.NoError(t, analysis.Flatten(analysis.FlattenOpts{Spec: swagger.Analyzer, Expand: false, BasePath: basePath})) jazon := asJSON(t, swagger.Spec()) assertRefInJSONRegexp(t, jazon, `^(#/definitions/)|(\./example)`) t.Run("resolve remote $ref azure [minimal flatten]", func(t *testing.T) { assertRefResolve(t, jazon, `\./example`, swagger.Spec(), &spec.ExpandOptions{RelativeBase: basePath}) }) } func TestIssue66(t *testing.T) { // no BasePath provided: assume current working directory file, clean := makeFileSpec(t) defer clean() // analyze and expand doc, err := loads.Spec(file) require.NoError(t, err) an := analysis.New(doc.Spec()) // Analyze spec require.NoError(t, analysis.Flatten(analysis.FlattenOpts{ Spec: an, Expand: true, })) jazon := asJSON(t, doc.Spec()) assertNoRef(t, jazon) // reload and flatten doc, err = loads.Spec(file) require.NoError(t, err) require.NoError(t, analysis.Flatten(analysis.FlattenOpts{ Spec: an, Expand: false, })) jazon = asJSON(t, doc.Spec()) t.Run("resolve $ref issue66", func(t *testing.T) { assertRefResolve(t, jazon, "", doc.Spec(), &spec.ExpandOptions{}) }) } func makeFileSpec(t testing.TB) (string, func()) { file := "./openapi.yaml" require.NoError(t, ioutil.WriteFile(file, fixtureIssue66(), 0600)) return file, func() { _ = os.Remove(file) } } func fixtureIssue66() []byte { return []byte(` x-google-endpoints: - name: bravo-api.endpoints.dev-srplatform.cloud.goog allowCors: true host: bravo-api.endpoints.dev-srplatform.cloud.goog swagger: '2.0' info: description: Demo API for Bravo team testing title: BRAVO Team API version: 0.0.0 basePath: /bravo x-google-allow: all consumes: - application/json produces: - application/json schemes: - http - https paths: /bravo-api: get: description: List expansions operationId: default responses: 200: description: Default Path schema: $ref: '#/definitions/heartbeatResponse' 403: description: Forbidden 500: description: Internal Server Error /bravo-api/healthN: get: description: N Health operationId: healthN responses: 200: description: Default Path schema: $ref: '#/definitions/heartbeatResponse' 403: description: Forbidden 500: description: Internal Server Error /bravo-api/internal/heartbeat: get: description: Heartbeat endpoint operationId: heartbeat produces: - application/json responses: 200: description: Health Status schema: $ref: '#/definitions/heartbeatResponse' /bravo-api/internal/version: get: description: Version endpoint operationId: version produces: - application/json responses: 200: description: Version Information /bravo-api/internal/cpuload: get: description: CPU Load endpoint operationId: cpuload produces: - application/json responses: 200: description: Run a CPU load definitions: heartbeatResponse: properties: Status: type: string ProjectID: type: string Version: type: string securityDefinitions: okta_jwt: authorizationUrl: "http://okta.example.com" flow: "implicit" type: "oauth2" scopes: com.sr.messaging: 'View and manage messaging content, criteria and definitions.' x-google-issuer: "http://okta.example.com" x-google-jwks_uri: "http://okta.example.com/v1/keys" x-google-audiences: "http://api.example.com" `) } analysis-0.21.1/analyzer.go000066400000000000000000000724401413705513100156010ustar00rootroot00000000000000// Copyright 2015 go-swagger maintainers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package analysis import ( "fmt" slashpath "path" "strconv" "strings" "github.com/go-openapi/jsonpointer" "github.com/go-openapi/spec" "github.com/go-openapi/swag" ) type referenceAnalysis struct { schemas map[string]spec.Ref responses map[string]spec.Ref parameters map[string]spec.Ref items map[string]spec.Ref headerItems map[string]spec.Ref parameterItems map[string]spec.Ref allRefs map[string]spec.Ref pathItems map[string]spec.Ref } func (r *referenceAnalysis) addRef(key string, ref spec.Ref) { r.allRefs["#"+key] = ref } func (r *referenceAnalysis) addItemsRef(key string, items *spec.Items, location string) { r.items["#"+key] = items.Ref r.addRef(key, items.Ref) if location == "header" { // NOTE: in swagger 2.0, headers and parameters (but not body param schemas) are simple schemas // and $ref are not supported here. However it is possible to analyze this. r.headerItems["#"+key] = items.Ref } else { r.parameterItems["#"+key] = items.Ref } } func (r *referenceAnalysis) addSchemaRef(key string, ref SchemaRef) { r.schemas["#"+key] = ref.Schema.Ref r.addRef(key, ref.Schema.Ref) } func (r *referenceAnalysis) addResponseRef(key string, resp *spec.Response) { r.responses["#"+key] = resp.Ref r.addRef(key, resp.Ref) } func (r *referenceAnalysis) addParamRef(key string, param *spec.Parameter) { r.parameters["#"+key] = param.Ref r.addRef(key, param.Ref) } func (r *referenceAnalysis) addPathItemRef(key string, pathItem *spec.PathItem) { r.pathItems["#"+key] = pathItem.Ref r.addRef(key, pathItem.Ref) } type patternAnalysis struct { parameters map[string]string headers map[string]string items map[string]string schemas map[string]string allPatterns map[string]string } func (p *patternAnalysis) addPattern(key, pattern string) { p.allPatterns["#"+key] = pattern } func (p *patternAnalysis) addParameterPattern(key, pattern string) { p.parameters["#"+key] = pattern p.addPattern(key, pattern) } func (p *patternAnalysis) addHeaderPattern(key, pattern string) { p.headers["#"+key] = pattern p.addPattern(key, pattern) } func (p *patternAnalysis) addItemsPattern(key, pattern string) { p.items["#"+key] = pattern p.addPattern(key, pattern) } func (p *patternAnalysis) addSchemaPattern(key, pattern string) { p.schemas["#"+key] = pattern p.addPattern(key, pattern) } type enumAnalysis struct { parameters map[string][]interface{} headers map[string][]interface{} items map[string][]interface{} schemas map[string][]interface{} allEnums map[string][]interface{} } func (p *enumAnalysis) addEnum(key string, enum []interface{}) { p.allEnums["#"+key] = enum } func (p *enumAnalysis) addParameterEnum(key string, enum []interface{}) { p.parameters["#"+key] = enum p.addEnum(key, enum) } func (p *enumAnalysis) addHeaderEnum(key string, enum []interface{}) { p.headers["#"+key] = enum p.addEnum(key, enum) } func (p *enumAnalysis) addItemsEnum(key string, enum []interface{}) { p.items["#"+key] = enum p.addEnum(key, enum) } func (p *enumAnalysis) addSchemaEnum(key string, enum []interface{}) { p.schemas["#"+key] = enum p.addEnum(key, enum) } // New takes a swagger spec object and returns an analyzed spec document. // The analyzed document contains a number of indices that make it easier to // reason about semantics of a swagger specification for use in code generation // or validation etc. func New(doc *spec.Swagger) *Spec { a := &Spec{ spec: doc, references: referenceAnalysis{}, patterns: patternAnalysis{}, enums: enumAnalysis{}, } a.reset() a.initialize() return a } // Spec is an analyzed specification object. It takes a swagger spec object and turns it into a registry // with a bunch of utility methods to act on the information in the spec. type Spec struct { spec *spec.Swagger consumes map[string]struct{} produces map[string]struct{} authSchemes map[string]struct{} operations map[string]map[string]*spec.Operation references referenceAnalysis patterns patternAnalysis enums enumAnalysis allSchemas map[string]SchemaRef allOfs map[string]SchemaRef } func (s *Spec) reset() { s.consumes = make(map[string]struct{}, 150) s.produces = make(map[string]struct{}, 150) s.authSchemes = make(map[string]struct{}, 150) s.operations = make(map[string]map[string]*spec.Operation, 150) s.allSchemas = make(map[string]SchemaRef, 150) s.allOfs = make(map[string]SchemaRef, 150) s.references.schemas = make(map[string]spec.Ref, 150) s.references.pathItems = make(map[string]spec.Ref, 150) s.references.responses = make(map[string]spec.Ref, 150) s.references.parameters = make(map[string]spec.Ref, 150) s.references.items = make(map[string]spec.Ref, 150) s.references.headerItems = make(map[string]spec.Ref, 150) s.references.parameterItems = make(map[string]spec.Ref, 150) s.references.allRefs = make(map[string]spec.Ref, 150) s.patterns.parameters = make(map[string]string, 150) s.patterns.headers = make(map[string]string, 150) s.patterns.items = make(map[string]string, 150) s.patterns.schemas = make(map[string]string, 150) s.patterns.allPatterns = make(map[string]string, 150) s.enums.parameters = make(map[string][]interface{}, 150) s.enums.headers = make(map[string][]interface{}, 150) s.enums.items = make(map[string][]interface{}, 150) s.enums.schemas = make(map[string][]interface{}, 150) s.enums.allEnums = make(map[string][]interface{}, 150) } func (s *Spec) reload() { s.reset() s.initialize() } func (s *Spec) initialize() { for _, c := range s.spec.Consumes { s.consumes[c] = struct{}{} } for _, c := range s.spec.Produces { s.produces[c] = struct{}{} } for _, ss := range s.spec.Security { for k := range ss { s.authSchemes[k] = struct{}{} } } for path, pathItem := range s.AllPaths() { s.analyzeOperations(path, &pathItem) //#nosec } for name, parameter := range s.spec.Parameters { refPref := slashpath.Join("/parameters", jsonpointer.Escape(name)) if parameter.Items != nil { s.analyzeItems("items", parameter.Items, refPref, "parameter") } if parameter.In == "body" && parameter.Schema != nil { s.analyzeSchema("schema", parameter.Schema, refPref) } if parameter.Pattern != "" { s.patterns.addParameterPattern(refPref, parameter.Pattern) } if len(parameter.Enum) > 0 { s.enums.addParameterEnum(refPref, parameter.Enum) } } for name, response := range s.spec.Responses { refPref := slashpath.Join("/responses", jsonpointer.Escape(name)) for k, v := range response.Headers { hRefPref := slashpath.Join(refPref, "headers", k) if v.Items != nil { s.analyzeItems("items", v.Items, hRefPref, "header") } if v.Pattern != "" { s.patterns.addHeaderPattern(hRefPref, v.Pattern) } if len(v.Enum) > 0 { s.enums.addHeaderEnum(hRefPref, v.Enum) } } if response.Schema != nil { s.analyzeSchema("schema", response.Schema, refPref) } } for name := range s.spec.Definitions { schema := s.spec.Definitions[name] s.analyzeSchema(name, &schema, "/definitions") } // TODO: after analyzing all things and flattening schemas etc // resolve all the collected references to their final representations // best put in a separate method because this could get expensive } func (s *Spec) analyzeOperations(path string, pi *spec.PathItem) { // TODO: resolve refs here? // Currently, operations declared via pathItem $ref are known only after expansion op := pi if pi.Ref.String() != "" { key := slashpath.Join("/paths", jsonpointer.Escape(path)) s.references.addPathItemRef(key, pi) } s.analyzeOperation("GET", path, op.Get) s.analyzeOperation("PUT", path, op.Put) s.analyzeOperation("POST", path, op.Post) s.analyzeOperation("PATCH", path, op.Patch) s.analyzeOperation("DELETE", path, op.Delete) s.analyzeOperation("HEAD", path, op.Head) s.analyzeOperation("OPTIONS", path, op.Options) for i, param := range op.Parameters { refPref := slashpath.Join("/paths", jsonpointer.Escape(path), "parameters", strconv.Itoa(i)) if param.Ref.String() != "" { s.references.addParamRef(refPref, ¶m) //#nosec } if param.Pattern != "" { s.patterns.addParameterPattern(refPref, param.Pattern) } if len(param.Enum) > 0 { s.enums.addParameterEnum(refPref, param.Enum) } if param.Items != nil { s.analyzeItems("items", param.Items, refPref, "parameter") } if param.Schema != nil { s.analyzeSchema("schema", param.Schema, refPref) } } } func (s *Spec) analyzeItems(name string, items *spec.Items, prefix, location string) { if items == nil { return } refPref := slashpath.Join(prefix, name) s.analyzeItems(name, items.Items, refPref, location) if items.Ref.String() != "" { s.references.addItemsRef(refPref, items, location) } if items.Pattern != "" { s.patterns.addItemsPattern(refPref, items.Pattern) } if len(items.Enum) > 0 { s.enums.addItemsEnum(refPref, items.Enum) } } func (s *Spec) analyzeParameter(prefix string, i int, param spec.Parameter) { refPref := slashpath.Join(prefix, "parameters", strconv.Itoa(i)) if param.Ref.String() != "" { s.references.addParamRef(refPref, ¶m) //#nosec } if param.Pattern != "" { s.patterns.addParameterPattern(refPref, param.Pattern) } if len(param.Enum) > 0 { s.enums.addParameterEnum(refPref, param.Enum) } s.analyzeItems("items", param.Items, refPref, "parameter") if param.In == "body" && param.Schema != nil { s.analyzeSchema("schema", param.Schema, refPref) } } func (s *Spec) analyzeOperation(method, path string, op *spec.Operation) { if op == nil { return } for _, c := range op.Consumes { s.consumes[c] = struct{}{} } for _, c := range op.Produces { s.produces[c] = struct{}{} } for _, ss := range op.Security { for k := range ss { s.authSchemes[k] = struct{}{} } } if _, ok := s.operations[method]; !ok { s.operations[method] = make(map[string]*spec.Operation) } s.operations[method][path] = op prefix := slashpath.Join("/paths", jsonpointer.Escape(path), strings.ToLower(method)) for i, param := range op.Parameters { s.analyzeParameter(prefix, i, param) } if op.Responses == nil { return } if op.Responses.Default != nil { s.analyzeDefaultResponse(prefix, op.Responses.Default) } for k, res := range op.Responses.StatusCodeResponses { s.analyzeResponse(prefix, k, res) } } func (s *Spec) analyzeDefaultResponse(prefix string, res *spec.Response) { refPref := slashpath.Join(prefix, "responses", "default") if res.Ref.String() != "" { s.references.addResponseRef(refPref, res) } for k, v := range res.Headers { hRefPref := slashpath.Join(refPref, "headers", k) s.analyzeItems("items", v.Items, hRefPref, "header") if v.Pattern != "" { s.patterns.addHeaderPattern(hRefPref, v.Pattern) } } if res.Schema != nil { s.analyzeSchema("schema", res.Schema, refPref) } } func (s *Spec) analyzeResponse(prefix string, k int, res spec.Response) { refPref := slashpath.Join(prefix, "responses", strconv.Itoa(k)) if res.Ref.String() != "" { s.references.addResponseRef(refPref, &res) //#nosec } for k, v := range res.Headers { hRefPref := slashpath.Join(refPref, "headers", k) s.analyzeItems("items", v.Items, hRefPref, "header") if v.Pattern != "" { s.patterns.addHeaderPattern(hRefPref, v.Pattern) } if len(v.Enum) > 0 { s.enums.addHeaderEnum(hRefPref, v.Enum) } } if res.Schema != nil { s.analyzeSchema("schema", res.Schema, refPref) } } func (s *Spec) analyzeSchema(name string, schema *spec.Schema, prefix string) { refURI := slashpath.Join(prefix, jsonpointer.Escape(name)) schRef := SchemaRef{ Name: name, Schema: schema, Ref: spec.MustCreateRef("#" + refURI), TopLevel: prefix == "/definitions", } s.allSchemas["#"+refURI] = schRef if schema.Ref.String() != "" { s.references.addSchemaRef(refURI, schRef) } if schema.Pattern != "" { s.patterns.addSchemaPattern(refURI, schema.Pattern) } if len(schema.Enum) > 0 { s.enums.addSchemaEnum(refURI, schema.Enum) } for k, v := range schema.Definitions { v := v s.analyzeSchema(k, &v, slashpath.Join(refURI, "definitions")) } for k, v := range schema.Properties { v := v s.analyzeSchema(k, &v, slashpath.Join(refURI, "properties")) } for k, v := range schema.PatternProperties { v := v // NOTE: swagger 2.0 does not support PatternProperties. // However it is possible to analyze this in a schema s.analyzeSchema(k, &v, slashpath.Join(refURI, "patternProperties")) } for i := range schema.AllOf { v := &schema.AllOf[i] s.analyzeSchema(strconv.Itoa(i), v, slashpath.Join(refURI, "allOf")) } if len(schema.AllOf) > 0 { s.allOfs["#"+refURI] = schRef } for i := range schema.AnyOf { v := &schema.AnyOf[i] // NOTE: swagger 2.0 does not support anyOf constructs. // However it is possible to analyze this in a schema s.analyzeSchema(strconv.Itoa(i), v, slashpath.Join(refURI, "anyOf")) } for i := range schema.OneOf { v := &schema.OneOf[i] // NOTE: swagger 2.0 does not support oneOf constructs. // However it is possible to analyze this in a schema s.analyzeSchema(strconv.Itoa(i), v, slashpath.Join(refURI, "oneOf")) } if schema.Not != nil { // NOTE: swagger 2.0 does not support "not" constructs. // However it is possible to analyze this in a schema s.analyzeSchema("not", schema.Not, refURI) } if schema.AdditionalProperties != nil && schema.AdditionalProperties.Schema != nil { s.analyzeSchema("additionalProperties", schema.AdditionalProperties.Schema, refURI) } if schema.AdditionalItems != nil && schema.AdditionalItems.Schema != nil { // NOTE: swagger 2.0 does not support AdditionalItems. // However it is possible to analyze this in a schema s.analyzeSchema("additionalItems", schema.AdditionalItems.Schema, refURI) } if schema.Items != nil { if schema.Items.Schema != nil { s.analyzeSchema("items", schema.Items.Schema, refURI) } for i := range schema.Items.Schemas { sch := &schema.Items.Schemas[i] s.analyzeSchema(strconv.Itoa(i), sch, slashpath.Join(refURI, "items")) } } } // SecurityRequirement is a representation of a security requirement for an operation type SecurityRequirement struct { Name string Scopes []string } // SecurityRequirementsFor gets the security requirements for the operation func (s *Spec) SecurityRequirementsFor(operation *spec.Operation) [][]SecurityRequirement { if s.spec.Security == nil && operation.Security == nil { return nil } schemes := s.spec.Security if operation.Security != nil { schemes = operation.Security } result := [][]SecurityRequirement{} for _, scheme := range schemes { if len(scheme) == 0 { // append a zero object for anonymous result = append(result, []SecurityRequirement{{}}) continue } var reqs []SecurityRequirement for k, v := range scheme { if v == nil { v = []string{} } reqs = append(reqs, SecurityRequirement{Name: k, Scopes: v}) } result = append(result, reqs) } return result } // SecurityDefinitionsForRequirements gets the matching security definitions for a set of requirements func (s *Spec) SecurityDefinitionsForRequirements(requirements []SecurityRequirement) map[string]spec.SecurityScheme { result := make(map[string]spec.SecurityScheme) for _, v := range requirements { if definition, ok := s.spec.SecurityDefinitions[v.Name]; ok { if definition != nil { result[v.Name] = *definition } } } return result } // SecurityDefinitionsFor gets the matching security definitions for a set of requirements func (s *Spec) SecurityDefinitionsFor(operation *spec.Operation) map[string]spec.SecurityScheme { requirements := s.SecurityRequirementsFor(operation) if len(requirements) == 0 { return nil } result := make(map[string]spec.SecurityScheme) for _, reqs := range requirements { for _, v := range reqs { if v.Name == "" { // optional requirement continue } if _, ok := result[v.Name]; ok { // duplicate requirement continue } if definition, ok := s.spec.SecurityDefinitions[v.Name]; ok { if definition != nil { result[v.Name] = *definition } } } } return result } // ConsumesFor gets the mediatypes for the operation func (s *Spec) ConsumesFor(operation *spec.Operation) []string { if len(operation.Consumes) == 0 { cons := make(map[string]struct{}, len(s.spec.Consumes)) for _, k := range s.spec.Consumes { cons[k] = struct{}{} } return s.structMapKeys(cons) } cons := make(map[string]struct{}, len(operation.Consumes)) for _, c := range operation.Consumes { cons[c] = struct{}{} } return s.structMapKeys(cons) } // ProducesFor gets the mediatypes for the operation func (s *Spec) ProducesFor(operation *spec.Operation) []string { if len(operation.Produces) == 0 { prod := make(map[string]struct{}, len(s.spec.Produces)) for _, k := range s.spec.Produces { prod[k] = struct{}{} } return s.structMapKeys(prod) } prod := make(map[string]struct{}, len(operation.Produces)) for _, c := range operation.Produces { prod[c] = struct{}{} } return s.structMapKeys(prod) } func mapKeyFromParam(param *spec.Parameter) string { return fmt.Sprintf("%s#%s", param.In, fieldNameFromParam(param)) } func fieldNameFromParam(param *spec.Parameter) string { // TODO: this should be x-go-name if nm, ok := param.Extensions.GetString("go-name"); ok { return nm } return swag.ToGoName(param.Name) } // ErrorOnParamFunc is a callback function to be invoked // whenever an error is encountered while resolving references // on parameters. // // This function takes as input the spec.Parameter which triggered the // error and the error itself. // // If the callback function returns false, the calling function should bail. // // If it returns true, the calling function should continue evaluating parameters. // A nil ErrorOnParamFunc must be evaluated as equivalent to panic(). type ErrorOnParamFunc func(spec.Parameter, error) bool func (s *Spec) paramsAsMap(parameters []spec.Parameter, res map[string]spec.Parameter, callmeOnError ErrorOnParamFunc) { for _, param := range parameters { pr := param if pr.Ref.String() == "" { res[mapKeyFromParam(&pr)] = pr continue } // resolve $ref if callmeOnError == nil { callmeOnError = func(_ spec.Parameter, err error) bool { panic(err) } } obj, _, err := pr.Ref.GetPointer().Get(s.spec) if err != nil { if callmeOnError(param, fmt.Errorf("invalid reference: %q", pr.Ref.String())) { continue } break } objAsParam, ok := obj.(spec.Parameter) if !ok { if callmeOnError(param, fmt.Errorf("resolved reference is not a parameter: %q", pr.Ref.String())) { continue } break } pr = objAsParam res[mapKeyFromParam(&pr)] = pr } } // ParametersFor the specified operation id. // // Assumes parameters properly resolve references if any and that // such references actually resolve to a parameter object. // Otherwise, panics. func (s *Spec) ParametersFor(operationID string) []spec.Parameter { return s.SafeParametersFor(operationID, nil) } // SafeParametersFor the specified operation id. // // Does not assume parameters properly resolve references or that // such references actually resolve to a parameter object. // // Upon error, invoke a ErrorOnParamFunc callback with the erroneous // parameters. If the callback is set to nil, panics upon errors. func (s *Spec) SafeParametersFor(operationID string, callmeOnError ErrorOnParamFunc) []spec.Parameter { gatherParams := func(pi *spec.PathItem, op *spec.Operation) []spec.Parameter { bag := make(map[string]spec.Parameter) s.paramsAsMap(pi.Parameters, bag, callmeOnError) s.paramsAsMap(op.Parameters, bag, callmeOnError) var res []spec.Parameter for _, v := range bag { res = append(res, v) } return res } for _, pi := range s.spec.Paths.Paths { if pi.Get != nil && pi.Get.ID == operationID { return gatherParams(&pi, pi.Get) //#nosec } if pi.Head != nil && pi.Head.ID == operationID { return gatherParams(&pi, pi.Head) //#nosec } if pi.Options != nil && pi.Options.ID == operationID { return gatherParams(&pi, pi.Options) //#nosec } if pi.Post != nil && pi.Post.ID == operationID { return gatherParams(&pi, pi.Post) //#nosec } if pi.Patch != nil && pi.Patch.ID == operationID { return gatherParams(&pi, pi.Patch) //#nosec } if pi.Put != nil && pi.Put.ID == operationID { return gatherParams(&pi, pi.Put) //#nosec } if pi.Delete != nil && pi.Delete.ID == operationID { return gatherParams(&pi, pi.Delete) //#nosec } } return nil } // ParamsFor the specified method and path. Aggregates them with the defaults etc, so it's all the params that // apply for the method and path. // // Assumes parameters properly resolve references if any and that // such references actually resolve to a parameter object. // Otherwise, panics. func (s *Spec) ParamsFor(method, path string) map[string]spec.Parameter { return s.SafeParamsFor(method, path, nil) } // SafeParamsFor the specified method and path. Aggregates them with the defaults etc, so it's all the params that // apply for the method and path. // // Does not assume parameters properly resolve references or that // such references actually resolve to a parameter object. // // Upon error, invoke a ErrorOnParamFunc callback with the erroneous // parameters. If the callback is set to nil, panics upon errors. func (s *Spec) SafeParamsFor(method, path string, callmeOnError ErrorOnParamFunc) map[string]spec.Parameter { res := make(map[string]spec.Parameter) if pi, ok := s.spec.Paths.Paths[path]; ok { s.paramsAsMap(pi.Parameters, res, callmeOnError) s.paramsAsMap(s.operations[strings.ToUpper(method)][path].Parameters, res, callmeOnError) } return res } // OperationForName gets the operation for the given id func (s *Spec) OperationForName(operationID string) (string, string, *spec.Operation, bool) { for method, pathItem := range s.operations { for path, op := range pathItem { if operationID == op.ID { return method, path, op, true } } } return "", "", nil, false } // OperationFor the given method and path func (s *Spec) OperationFor(method, path string) (*spec.Operation, bool) { if mp, ok := s.operations[strings.ToUpper(method)]; ok { op, fn := mp[path] return op, fn } return nil, false } // Operations gathers all the operations specified in the spec document func (s *Spec) Operations() map[string]map[string]*spec.Operation { return s.operations } func (s *Spec) structMapKeys(mp map[string]struct{}) []string { if len(mp) == 0 { return nil } result := make([]string, 0, len(mp)) for k := range mp { result = append(result, k) } return result } // AllPaths returns all the paths in the swagger spec func (s *Spec) AllPaths() map[string]spec.PathItem { if s.spec == nil || s.spec.Paths == nil { return nil } return s.spec.Paths.Paths } // OperationIDs gets all the operation ids based on method an dpath func (s *Spec) OperationIDs() []string { if len(s.operations) == 0 { return nil } result := make([]string, 0, len(s.operations)) for method, v := range s.operations { for p, o := range v { if o.ID != "" { result = append(result, o.ID) } else { result = append(result, fmt.Sprintf("%s %s", strings.ToUpper(method), p)) } } } return result } // OperationMethodPaths gets all the operation ids based on method an dpath func (s *Spec) OperationMethodPaths() []string { if len(s.operations) == 0 { return nil } result := make([]string, 0, len(s.operations)) for method, v := range s.operations { for p := range v { result = append(result, fmt.Sprintf("%s %s", strings.ToUpper(method), p)) } } return result } // RequiredConsumes gets all the distinct consumes that are specified in the specification document func (s *Spec) RequiredConsumes() []string { return s.structMapKeys(s.consumes) } // RequiredProduces gets all the distinct produces that are specified in the specification document func (s *Spec) RequiredProduces() []string { return s.structMapKeys(s.produces) } // RequiredSecuritySchemes gets all the distinct security schemes that are specified in the swagger spec func (s *Spec) RequiredSecuritySchemes() []string { return s.structMapKeys(s.authSchemes) } // SchemaRef is a reference to a schema type SchemaRef struct { Name string Ref spec.Ref Schema *spec.Schema TopLevel bool } // SchemasWithAllOf returns schema references to all schemas that are defined // with an allOf key func (s *Spec) SchemasWithAllOf() (result []SchemaRef) { for _, v := range s.allOfs { result = append(result, v) } return } // AllDefinitions returns schema references for all the definitions that were discovered func (s *Spec) AllDefinitions() (result []SchemaRef) { for _, v := range s.allSchemas { result = append(result, v) } return } // AllDefinitionReferences returns json refs for all the discovered schemas func (s *Spec) AllDefinitionReferences() (result []string) { for _, v := range s.references.schemas { result = append(result, v.String()) } return } // AllParameterReferences returns json refs for all the discovered parameters func (s *Spec) AllParameterReferences() (result []string) { for _, v := range s.references.parameters { result = append(result, v.String()) } return } // AllResponseReferences returns json refs for all the discovered responses func (s *Spec) AllResponseReferences() (result []string) { for _, v := range s.references.responses { result = append(result, v.String()) } return } // AllPathItemReferences returns the references for all the items func (s *Spec) AllPathItemReferences() (result []string) { for _, v := range s.references.pathItems { result = append(result, v.String()) } return } // AllItemsReferences returns the references for all the items in simple schemas (parameters or headers). // // NOTE: since Swagger 2.0 forbids $ref in simple params, this should always yield an empty slice for a valid // Swagger 2.0 spec. func (s *Spec) AllItemsReferences() (result []string) { for _, v := range s.references.items { result = append(result, v.String()) } return } // AllReferences returns all the references found in the document, with possible duplicates func (s *Spec) AllReferences() (result []string) { for _, v := range s.references.allRefs { result = append(result, v.String()) } return } // AllRefs returns all the unique references found in the document func (s *Spec) AllRefs() (result []spec.Ref) { set := make(map[string]struct{}) for _, v := range s.references.allRefs { a := v.String() if a == "" { continue } if _, ok := set[a]; !ok { set[a] = struct{}{} result = append(result, v) } } return } func cloneStringMap(source map[string]string) map[string]string { res := make(map[string]string, len(source)) for k, v := range source { res[k] = v } return res } func cloneEnumMap(source map[string][]interface{}) map[string][]interface{} { res := make(map[string][]interface{}, len(source)) for k, v := range source { res[k] = v } return res } // ParameterPatterns returns all the patterns found in parameters // the map is cloned to avoid accidental changes func (s *Spec) ParameterPatterns() map[string]string { return cloneStringMap(s.patterns.parameters) } // HeaderPatterns returns all the patterns found in response headers // the map is cloned to avoid accidental changes func (s *Spec) HeaderPatterns() map[string]string { return cloneStringMap(s.patterns.headers) } // ItemsPatterns returns all the patterns found in simple array items // the map is cloned to avoid accidental changes func (s *Spec) ItemsPatterns() map[string]string { return cloneStringMap(s.patterns.items) } // SchemaPatterns returns all the patterns found in schemas // the map is cloned to avoid accidental changes func (s *Spec) SchemaPatterns() map[string]string { return cloneStringMap(s.patterns.schemas) } // AllPatterns returns all the patterns found in the spec // the map is cloned to avoid accidental changes func (s *Spec) AllPatterns() map[string]string { return cloneStringMap(s.patterns.allPatterns) } // ParameterEnums returns all the enums found in parameters // the map is cloned to avoid accidental changes func (s *Spec) ParameterEnums() map[string][]interface{} { return cloneEnumMap(s.enums.parameters) } // HeaderEnums returns all the enums found in response headers // the map is cloned to avoid accidental changes func (s *Spec) HeaderEnums() map[string][]interface{} { return cloneEnumMap(s.enums.headers) } // ItemsEnums returns all the enums found in simple array items // the map is cloned to avoid accidental changes func (s *Spec) ItemsEnums() map[string][]interface{} { return cloneEnumMap(s.enums.items) } // SchemaEnums returns all the enums found in schemas // the map is cloned to avoid accidental changes func (s *Spec) SchemaEnums() map[string][]interface{} { return cloneEnumMap(s.enums.schemas) } // AllEnums returns all the enums found in the spec // the map is cloned to avoid accidental changes func (s *Spec) AllEnums() map[string][]interface{} { return cloneEnumMap(s.enums.allEnums) } analysis-0.21.1/analyzer_test.go000066400000000000000000000732001413705513100166330ustar00rootroot00000000000000// Copyright 2015 go-swagger maintainers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package analysis import ( "fmt" "path/filepath" "sort" "strconv" "testing" "github.com/go-openapi/analysis/internal/antest" "github.com/go-openapi/spec" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestAnalyzer_All(t *testing.T) { t.Parallel() formatParam := spec.QueryParam("format").Typed("string", "") limitParam := spec.QueryParam("limit").Typed("integer", "int32") limitParam.Extensions = spec.Extensions(map[string]interface{}{}) limitParam.Extensions.Add("go-name", "Limit") skipParam := spec.QueryParam("skip").Typed("integer", "int32") pi := spec.PathItem{} pi.Parameters = []spec.Parameter{*limitParam} op := &spec.Operation{} op.Consumes = []string{"application/x-yaml"} op.Produces = []string{"application/x-yaml"} op.Security = []map[string][]string{ {"oauth2": {}}, {"basic": nil}, } op.ID = "someOperation" op.Parameters = []spec.Parameter{*skipParam} pi.Get = op pi2 := spec.PathItem{} pi2.Parameters = []spec.Parameter{*limitParam} op2 := &spec.Operation{} op2.ID = "anotherOperation" op2.Parameters = []spec.Parameter{*skipParam} pi2.Get = op2 spec := makeFixturepec(pi, pi2, formatParam) analyzer := New(spec) assert.Len(t, analyzer.consumes, 2) assert.Len(t, analyzer.produces, 2) assert.Len(t, analyzer.operations, 1) assert.Equal(t, analyzer.operations["GET"]["/"], spec.Paths.Paths["/"].Get) expected := []string{"application/x-yaml"} sort.Strings(expected) consumes := analyzer.ConsumesFor(spec.Paths.Paths["/"].Get) sort.Strings(consumes) assert.Equal(t, expected, consumes) produces := analyzer.ProducesFor(spec.Paths.Paths["/"].Get) sort.Strings(produces) assert.Equal(t, expected, produces) expected = []string{"application/json"} sort.Strings(expected) consumes = analyzer.ConsumesFor(spec.Paths.Paths["/items"].Get) sort.Strings(consumes) assert.Equal(t, expected, consumes) produces = analyzer.ProducesFor(spec.Paths.Paths["/items"].Get) sort.Strings(produces) assert.Equal(t, expected, produces) expectedSchemes := [][]SecurityRequirement{ { {Name: "oauth2", Scopes: []string{}}, {Name: "basic", Scopes: nil}, }, } schemes := analyzer.SecurityRequirementsFor(spec.Paths.Paths["/"].Get) assert.Equal(t, schemeNames(expectedSchemes), schemeNames(schemes)) securityDefinitions := analyzer.SecurityDefinitionsFor(spec.Paths.Paths["/"].Get) assert.Equal(t, *spec.SecurityDefinitions["basic"], securityDefinitions["basic"]) assert.Equal(t, *spec.SecurityDefinitions["oauth2"], securityDefinitions["oauth2"]) parameters := analyzer.ParamsFor("GET", "/") assert.Len(t, parameters, 2) operations := analyzer.OperationIDs() assert.Len(t, operations, 2) producers := analyzer.RequiredProduces() assert.Len(t, producers, 2) consumers := analyzer.RequiredConsumes() assert.Len(t, consumers, 2) authSchemes := analyzer.RequiredSecuritySchemes() assert.Len(t, authSchemes, 3) ops := analyzer.Operations() assert.Len(t, ops, 1) assert.Len(t, ops["GET"], 2) op, ok := analyzer.OperationFor("get", "/") assert.True(t, ok) assert.NotNil(t, op) op, ok = analyzer.OperationFor("delete", "/") assert.False(t, ok) assert.Nil(t, op) // check for duplicates in sec. requirements for operation pi.Get.Security = []map[string][]string{ {"oauth2": {}}, {"basic": nil}, {"basic": nil}, } spec = makeFixturepec(pi, pi2, formatParam) analyzer = New(spec) securityDefinitions = analyzer.SecurityDefinitionsFor(spec.Paths.Paths["/"].Get) assert.Len(t, securityDefinitions, 2) assert.Equal(t, *spec.SecurityDefinitions["basic"], securityDefinitions["basic"]) assert.Equal(t, *spec.SecurityDefinitions["oauth2"], securityDefinitions["oauth2"]) // check for empty (optional) in sec. requirements for operation pi.Get.Security = []map[string][]string{ {"oauth2": {}}, {"": nil}, {"basic": nil}, } spec = makeFixturepec(pi, pi2, formatParam) analyzer = New(spec) securityDefinitions = analyzer.SecurityDefinitionsFor(spec.Paths.Paths["/"].Get) assert.Len(t, securityDefinitions, 2) assert.Equal(t, *spec.SecurityDefinitions["basic"], securityDefinitions["basic"]) assert.Equal(t, *spec.SecurityDefinitions["oauth2"], securityDefinitions["oauth2"]) } func TestAnalyzer_DefinitionAnalysis(t *testing.T) { t.Parallel() doc := antest.LoadOrFail(t, filepath.Join("fixtures", "definitions.yml")) analyzer := New(doc) definitions := analyzer.allSchemas require.NotNil(t, definitions) for _, key := range []string{ "#/parameters/someParam/schema", "#/paths/~1some~1where~1{id}/parameters/1/schema", "#/paths/~1some~1where~1{id}/get/parameters/1/schema", // responses "#/responses/someResponse/schema", "#/paths/~1some~1where~1{id}/get/responses/default/schema", "#/paths/~1some~1where~1{id}/get/responses/200/schema", // definitions "#/definitions/tag", "#/definitions/tag/properties/id", "#/definitions/tag/properties/value", "#/definitions/tag/definitions/category", "#/definitions/tag/definitions/category/properties/id", "#/definitions/tag/definitions/category/properties/value", "#/definitions/withAdditionalProps", "#/definitions/withAdditionalProps/additionalProperties", "#/definitions/withAdditionalItems", "#/definitions/withAdditionalItems/items/0", "#/definitions/withAdditionalItems/items/1", "#/definitions/withAdditionalItems/additionalItems", "#/definitions/withNot", "#/definitions/withNot/not", "#/definitions/withAnyOf", "#/definitions/withAnyOf/anyOf/0", "#/definitions/withAnyOf/anyOf/1", "#/definitions/withAllOf", "#/definitions/withAllOf/allOf/0", "#/definitions/withAllOf/allOf/1", "#/definitions/withOneOf/oneOf/0", "#/definitions/withOneOf/oneOf/1", } { t.Run(fmt.Sprintf("ref %q exists", key), func(t *testing.T) { t.Parallel() assertSchemaRefExists(t, definitions, key) }) } allOfs := analyzer.allOfs assert.Len(t, allOfs, 1) assert.Contains(t, allOfs, "#/definitions/withAllOf") } func TestAnalyzer_ReferenceAnalysis(t *testing.T) { t.Parallel() doc := antest.LoadOrFail(t, filepath.Join("fixtures", "references.yml")) an := New(doc) definitions := an.references require.NotNil(t, definitions) require.NotNil(t, definitions.parameters) require.NotNil(t, definitions.responses) require.NotNil(t, definitions.pathItems) require.NotNil(t, definitions.schemas) require.NotNil(t, definitions.parameterItems) require.NotNil(t, definitions.headerItems) require.NotNil(t, definitions.allRefs) for _, toPin := range []struct { Input map[string]spec.Ref ExpectedKeys []string }{ { Input: definitions.parameters, ExpectedKeys: []string{ "#/paths/~1some~1where~1{id}/parameters/0", "#/paths/~1some~1where~1{id}/get/parameters/0", }, }, { Input: definitions.pathItems, ExpectedKeys: []string{ "#/paths/~1other~1place", }, }, { Input: definitions.responses, ExpectedKeys: []string{ "#/paths/~1some~1where~1{id}/get/responses/404", }, }, { Input: definitions.schemas, ExpectedKeys: []string{ "#/responses/notFound/schema", "#/paths/~1some~1where~1{id}/get/responses/200/schema", "#/definitions/tag/properties/audit", }, }, { // Supported non-swagger 2.0 constructs ($ref in simple schema items) Input: definitions.allRefs, ExpectedKeys: []string{ "#/paths/~1some~1where~1{id}/get/parameters/1/items", "#/paths/~1some~1where~1{id}/get/parameters/2/items", "#/paths/~1some~1where~1{id}/get/responses/default/headers/x-array-header/items", }, }, { Input: definitions.parameterItems, ExpectedKeys: []string{ "#/paths/~1some~1where~1{id}/get/parameters/1/items", "#/paths/~1some~1where~1{id}/get/parameters/2/items", }, }, { Input: definitions.headerItems, ExpectedKeys: []string{ "#/paths/~1some~1where~1{id}/get/responses/default/headers/x-array-header/items", }, }, } { fixture := toPin for _, key := range fixture.ExpectedKeys { t.Run(fmt.Sprintf("ref %q exists", key), func(t *testing.T) { t.Parallel() assertRefExists(t, fixture.Input, key) }) } } assert.Lenf(t, an.AllItemsReferences(), 3, "Expected 3 items references in this spec") } type expectedPattern struct { Key string Pattern string } func TestAnalyzer_PatternAnalysis(t *testing.T) { t.Parallel() doc := antest.LoadOrFail(t, filepath.Join("fixtures", "patterns.yml")) an := New(doc) pt := an.patterns require.NotNil(t, pt) require.NotNil(t, pt.parameters) require.NotNil(t, pt.headers) require.NotNil(t, pt.schemas) require.NotNil(t, pt.items) for _, toPin := range []struct { Input map[string]string ExpectedKeys []expectedPattern }{ { Input: pt.parameters, ExpectedKeys: []expectedPattern{ {Key: "#/parameters/idParam", Pattern: "a[A-Za-Z0-9]+"}, {Key: "#/paths/~1some~1where~1{id}/parameters/1", Pattern: "b[A-Za-z0-9]+"}, {Key: "#/paths/~1some~1where~1{id}/get/parameters/0", Pattern: "[abc][0-9]+"}, }, }, { Input: pt.headers, ExpectedKeys: []expectedPattern{ {Key: "#/responses/notFound/headers/ContentLength", Pattern: "[0-9]+"}, {Key: "#/paths/~1some~1where~1{id}/get/responses/200/headers/X-Request-Id", Pattern: "d[A-Za-z0-9]+"}, }, }, { Input: pt.schemas, ExpectedKeys: []expectedPattern{ {Key: "#/paths/~1other~1place/post/parameters/0/schema/properties/value", Pattern: "e[A-Za-z0-9]+"}, {Key: "#/paths/~1other~1place/post/responses/200/schema/properties/data", Pattern: "[0-9]+[abd]"}, {Key: "#/definitions/named", Pattern: "f[A-Za-z0-9]+"}, {Key: "#/definitions/tag/properties/value", Pattern: "g[A-Za-z0-9]+"}, }, }, { Input: pt.items, ExpectedKeys: []expectedPattern{ {Key: "#/paths/~1some~1where~1{id}/get/parameters/1/items", Pattern: "c[A-Za-z0-9]+"}, {Key: "#/paths/~1other~1place/post/responses/default/headers/Via/items", Pattern: "[A-Za-z]+"}, }, }, } { fixture := toPin for _, toPinExpected := range fixture.ExpectedKeys { expected := toPinExpected t.Run(fmt.Sprintf("pattern at %q exists", expected.Key), func(t *testing.T) { t.Parallel() assertPattern(t, fixture.Input, expected.Key, expected.Pattern) }) } } // patternProperties (beyond Swagger 2.0) _, ok := an.spec.Definitions["withPatternProperties"] assert.True(t, ok) _, ok = an.allSchemas["#/definitions/withPatternProperties/patternProperties/^prop[0-9]+$"] assert.True(t, ok) } func TestAnalyzer_ParamsAsMap(t *testing.T) { t.Parallel() s := prepareTestParamsValid() require.NotNil(t, s) m := make(map[string]spec.Parameter) pi, ok := s.spec.Paths.Paths["/items"] require.True(t, ok) s.paramsAsMap(pi.Parameters, m, nil) assert.Len(t, m, 1) p, ok := m["query#Limit"] require.True(t, ok) assert.Equal(t, p.Name, "limit") // An invalid spec, but passes this step (errors are figured out at a higher level) s = prepareTestParamsInvalid(t, "fixture-1289-param.yaml") require.NotNil(t, s) m = make(map[string]spec.Parameter) pi, ok = s.spec.Paths.Paths["/fixture"] require.True(t, ok) pi.Parameters = pi.PathItemProps.Get.OperationProps.Parameters s.paramsAsMap(pi.Parameters, m, nil) assert.Len(t, m, 1) p, ok = m["body#DespicableMe"] require.True(t, ok) assert.Equal(t, p.Name, "despicableMe") } func TestAnalyzer_ParamsAsMapWithCallback(t *testing.T) { t.Parallel() s := prepareTestParamsInvalid(t, "fixture-342.yaml") require.NotNil(t, s) // No bail out callback m := make(map[string]spec.Parameter) e := []string{} pi, ok := s.spec.Paths.Paths["/fixture"] require.True(t, ok) pi.Parameters = pi.PathItemProps.Get.OperationProps.Parameters s.paramsAsMap(pi.Parameters, m, func(param spec.Parameter, err error) bool { // pt.Logf("ERROR on %+v : %v", param, err) e = append(e, err.Error()) return true // Continue }) assert.Contains(t, e, `resolved reference is not a parameter: "#/definitions/sample_info/properties/sid"`) assert.Contains(t, e, `invalid reference: "#/definitions/sample_info/properties/sids"`) // bail out callback m = make(map[string]spec.Parameter) e = []string{} pi, ok = s.spec.Paths.Paths["/fixture"] require.True(t, ok) pi.Parameters = pi.PathItemProps.Get.OperationProps.Parameters s.paramsAsMap(pi.Parameters, m, func(param spec.Parameter, err error) bool { // pt.Logf("ERROR on %+v : %v", param, err) e = append(e, err.Error()) return false // Bail }) // We got one then bail assert.Len(t, e, 1) // Bail after ref failure: exercising another path s = prepareTestParamsInvalid(t, "fixture-342-2.yaml") require.NotNil(t, s) // bail callback m = make(map[string]spec.Parameter) e = []string{} pi, ok = s.spec.Paths.Paths["/fixture"] require.True(t, ok) pi.Parameters = pi.PathItemProps.Get.OperationProps.Parameters s.paramsAsMap(pi.Parameters, m, func(param spec.Parameter, err error) bool { e = append(e, err.Error()) return false // Bail }) // We got one then bail assert.Len(t, e, 1) // Bail after ref failure: exercising another path s = prepareTestParamsInvalid(t, "fixture-342-3.yaml") require.NotNil(t, s) // bail callback m = make(map[string]spec.Parameter) e = []string{} pi, ok = s.spec.Paths.Paths["/fixture"] require.True(t, ok) pi.Parameters = pi.PathItemProps.Get.OperationProps.Parameters s.paramsAsMap(pi.Parameters, m, func(param spec.Parameter, err error) bool { e = append(e, err.Error()) return false // Bail }) // We got one then bail assert.Len(t, e, 1) } func TestAnalyzer_ParamsAsMapPanic(t *testing.T) { t.Parallel() for _, fixture := range []string{ "fixture-342.yaml", "fixture-342-2.yaml", "fixture-342-3.yaml", } { t.Run(fmt.Sprintf("panic_%s", fixture), func(t *testing.T) { t.Parallel() s := prepareTestParamsInvalid(t, fixture) require.NotNil(t, s) panickerParamsAsMap := func() { m := make(map[string]spec.Parameter) if pi, ok := s.spec.Paths.Paths["/fixture"]; ok { pi.Parameters = pi.PathItemProps.Get.OperationProps.Parameters s.paramsAsMap(pi.Parameters, m, nil) } } assert.Panics(t, panickerParamsAsMap) }) } } func TestAnalyzer_SafeParamsFor(t *testing.T) { t.Parallel() s := prepareTestParamsInvalid(t, "fixture-342.yaml") require.NotNil(t, s) e := []string{} pi, ok := s.spec.Paths.Paths["/fixture"] require.True(t, ok) pi.Parameters = pi.PathItemProps.Get.OperationProps.Parameters errFunc := func(param spec.Parameter, err error) bool { e = append(e, err.Error()) return true // Continue } for range s.SafeParamsFor("Get", "/fixture", errFunc) { require.Fail(t, "There should be no safe parameter in this testcase") } assert.Contains(t, e, `resolved reference is not a parameter: "#/definitions/sample_info/properties/sid"`) assert.Contains(t, e, `invalid reference: "#/definitions/sample_info/properties/sids"`) } func TestAnalyzer_ParamsFor(t *testing.T) { t.Parallel() // Valid example s := prepareTestParamsValid() require.NotNil(t, s) params := s.ParamsFor("Get", "/items") assert.True(t, len(params) > 0) panickerParamsFor := func() { s := prepareTestParamsInvalid(t, "fixture-342.yaml") pi, ok := s.spec.Paths.Paths["/fixture"] if ok { pi.Parameters = pi.PathItemProps.Get.OperationProps.Parameters s.ParamsFor("Get", "/fixture") } } // Invalid example assert.Panics(t, panickerParamsFor) } func TestAnalyzer_SafeParametersFor(t *testing.T) { t.Parallel() s := prepareTestParamsInvalid(t, "fixture-342.yaml") require.NotNil(t, s) e := []string{} pi, ok := s.spec.Paths.Paths["/fixture"] require.True(t, ok) errFunc := func(param spec.Parameter, err error) bool { e = append(e, err.Error()) return true // Continue } pi.Parameters = pi.PathItemProps.Get.OperationProps.Parameters for range s.SafeParametersFor("fixtureOp", errFunc) { require.Fail(t, "There should be no safe parameter in this testcase") } assert.Contains(t, e, `resolved reference is not a parameter: "#/definitions/sample_info/properties/sid"`) assert.Contains(t, e, `invalid reference: "#/definitions/sample_info/properties/sids"`) } func TestAnalyzer_ParametersFor(t *testing.T) { t.Parallel() // Valid example s := prepareTestParamsValid() params := s.ParamsFor("Get", "/items") assert.True(t, len(params) > 0) panickerParametersFor := func() { s := prepareTestParamsInvalid(t, "fixture-342.yaml") if s == nil { return } pi, ok := s.spec.Paths.Paths["/fixture"] if ok { pi.Parameters = pi.PathItemProps.Get.OperationProps.Parameters // func (s *Spec) ParametersFor(operationID string) []spec.Parameter { s.ParametersFor("fixtureOp") } } // Invalid example assert.Panics(t, panickerParametersFor) } func TestAnalyzer_SecurityDefinitionsFor(t *testing.T) { t.Parallel() spec := prepareTestParamsAuth() pi1 := spec.spec.Paths.Paths["/"].Get pi2 := spec.spec.Paths.Paths["/items"].Get defs1 := spec.SecurityDefinitionsFor(pi1) require.Contains(t, defs1, "oauth2") require.Contains(t, defs1, "basic") require.NotContains(t, defs1, "apiKey") defs2 := spec.SecurityDefinitionsFor(pi2) require.Contains(t, defs2, "oauth2") require.Contains(t, defs2, "basic") require.Contains(t, defs2, "apiKey") } func TestAnalyzer_SecurityRequirements(t *testing.T) { t.Parallel() spec := prepareTestParamsAuth() pi1 := spec.spec.Paths.Paths["/"].Get pi2 := spec.spec.Paths.Paths["/items"].Get scopes := []string{"the-scope"} reqs1 := spec.SecurityRequirementsFor(pi1) require.Len(t, reqs1, 2) require.Len(t, reqs1[0], 1) require.Equal(t, reqs1[0][0].Name, "oauth2") require.Equal(t, reqs1[0][0].Scopes, scopes) require.Len(t, reqs1[1], 1) require.Equal(t, reqs1[1][0].Name, "basic") require.Empty(t, reqs1[1][0].Scopes) reqs2 := spec.SecurityRequirementsFor(pi2) require.Len(t, reqs2, 3) require.Len(t, reqs2[0], 1) require.Equal(t, reqs2[0][0].Name, "oauth2") require.Equal(t, reqs2[0][0].Scopes, scopes) require.Len(t, reqs2[1], 1) require.Empty(t, reqs2[1][0].Name) require.Empty(t, reqs2[1][0].Scopes) require.Len(t, reqs2[2], 2) require.Contains(t, reqs2[2], SecurityRequirement{Name: "basic", Scopes: []string{}}) require.Empty(t, reqs2[2][0].Scopes) require.Contains(t, reqs2[2], SecurityRequirement{Name: "apiKey", Scopes: []string{}}) require.Empty(t, reqs2[2][1].Scopes) } func TestAnalyzer_SecurityRequirementsDefinitions(t *testing.T) { t.Parallel() spec := prepareTestParamsAuth() pi1 := spec.spec.Paths.Paths["/"].Get pi2 := spec.spec.Paths.Paths["/items"].Get reqs1 := spec.SecurityRequirementsFor(pi1) defs11 := spec.SecurityDefinitionsForRequirements(reqs1[0]) require.Contains(t, defs11, "oauth2") defs12 := spec.SecurityDefinitionsForRequirements(reqs1[1]) require.Contains(t, defs12, "basic") require.NotContains(t, defs12, "apiKey") reqs2 := spec.SecurityRequirementsFor(pi2) defs21 := spec.SecurityDefinitionsForRequirements(reqs2[0]) require.Len(t, defs21, 1) require.Contains(t, defs21, "oauth2") require.NotContains(t, defs21, "basic") require.NotContains(t, defs21, "apiKey") defs22 := spec.SecurityDefinitionsForRequirements(reqs2[1]) require.NotNil(t, defs22) require.Empty(t, defs22) defs23 := spec.SecurityDefinitionsForRequirements(reqs2[2]) require.Len(t, defs23, 2) require.NotContains(t, defs23, "oauth2") require.Contains(t, defs23, "basic") require.Contains(t, defs23, "apiKey") } func TestAnalyzer_MoreParamAnalysis(t *testing.T) { t.Parallel() bp := filepath.Join("fixtures", "parameters", "fixture-parameters.yaml") sp := antest.LoadOrFail(t, bp) an := New(sp) res := an.AllPatterns() assert.Lenf(t, res, 6, "Expected 6 patterns in this spec") res = an.SchemaPatterns() assert.Lenf(t, res, 1, "Expected 1 schema pattern in this spec") res = an.HeaderPatterns() assert.Lenf(t, res, 2, "Expected 2 header pattern in this spec") res = an.ItemsPatterns() assert.Lenf(t, res, 2, "Expected 2 items pattern in this spec") res = an.ParameterPatterns() assert.Lenf(t, res, 1, "Expected 1 simple param pattern in this spec") refs := an.AllRefs() assert.Lenf(t, refs, 10, "Expected 10 reference usage in this spec") references := an.AllReferences() assert.Lenf(t, references, 14, "Expected 14 reference usage in this spec") references = an.AllItemsReferences() assert.Lenf(t, references, 0, "Expected 0 items reference in this spec") references = an.AllPathItemReferences() assert.Lenf(t, references, 1, "Expected 1 pathItem reference in this spec") references = an.AllResponseReferences() assert.Lenf(t, references, 3, "Expected 3 response references in this spec") references = an.AllParameterReferences() assert.Lenf(t, references, 6, "Expected 6 parameter references in this spec") schemaRefs := an.AllDefinitions() assert.Lenf(t, schemaRefs, 14, "Expected 14 schema definitions in this spec") schemaRefs = an.SchemasWithAllOf() assert.Lenf(t, schemaRefs, 1, "Expected 1 schema with AllOf definition in this spec") method, path, op, found := an.OperationForName("postSomeWhere") assert.Equal(t, "POST", method) assert.Equal(t, "/some/where", path) require.NotNil(t, op) require.True(t, found) sec := an.SecurityRequirementsFor(op) assert.Nil(t, sec) secScheme := an.SecurityDefinitionsFor(op) assert.Nil(t, secScheme) bag := an.ParametersFor("postSomeWhere") assert.Lenf(t, bag, 6, "Expected 6 parameters for this operation") method, path, op, found = an.OperationForName("notFound") assert.Equal(t, "", method) assert.Equal(t, "", path) assert.Nil(t, op) assert.False(t, found) // does not take ops under pathItem $ref ops := an.OperationMethodPaths() assert.Lenf(t, ops, 3, "Expected 3 ops") ops = an.OperationIDs() assert.Lenf(t, ops, 3, "Expected 3 ops") assert.Contains(t, ops, "postSomeWhere") assert.Contains(t, ops, "GET /some/where/else") assert.Contains(t, ops, "GET /some/where") } func TestAnalyzer_EdgeCases(t *testing.T) { t.Parallel() // check return values are consistent in some nil/empty edge cases sp := Spec{} res1 := sp.AllPaths() assert.Nil(t, res1) res2 := sp.OperationIDs() assert.Nil(t, res2) res3 := sp.OperationMethodPaths() assert.Nil(t, res3) res4 := sp.structMapKeys(nil) assert.Nil(t, res4) res5 := sp.structMapKeys(make(map[string]struct{}, 10)) assert.Nil(t, res5) // check AllRefs() skips empty $refs sp.references.allRefs = make(map[string]spec.Ref, 3) for i := 0; i < 3; i++ { sp.references.allRefs["ref"+strconv.Itoa(i)] = spec.Ref{} } assert.Len(t, sp.references.allRefs, 3) res6 := sp.AllRefs() assert.Len(t, res6, 0) // check AllRefs() skips duplicate $refs sp.references.allRefs["refToOne"] = spec.MustCreateRef("#/ref1") sp.references.allRefs["refToOneAgain"] = spec.MustCreateRef("#/ref1") res7 := sp.AllRefs() assert.NotNil(t, res7) assert.Len(t, res7, 1) } func TestAnalyzer_EnumAnalysis(t *testing.T) { t.Parallel() doc := antest.LoadOrFail(t, filepath.Join("fixtures", "enums.yml")) an := New(doc) en := an.enums // parameters assertEnum(t, en.parameters, "#/parameters/idParam", []interface{}{"aA", "b9", "c3"}) assertEnum(t, en.parameters, "#/paths/~1some~1where~1{id}/parameters/1", []interface{}{"bA", "ba", "b9"}) assertEnum(t, en.parameters, "#/paths/~1some~1where~1{id}/get/parameters/0", []interface{}{"a0", "b1", "c2"}) // responses assertEnum(t, en.headers, "#/responses/notFound/headers/ContentLength", []interface{}{"1234", "123"}) assertEnum(t, en.headers, "#/paths/~1some~1where~1{id}/get/responses/200/headers/X-Request-Id", []interface{}{"dA", "d9"}) // definitions assertEnum(t, en.schemas, "#/paths/~1other~1place/post/parameters/0/schema/properties/value", []interface{}{"eA", "e9"}) assertEnum(t, en.schemas, "#/paths/~1other~1place/post/responses/200/schema/properties/data", []interface{}{"123a", "123b", "123d"}) assertEnum(t, en.schemas, "#/definitions/named", []interface{}{"fA", "f9"}) assertEnum(t, en.schemas, "#/definitions/tag/properties/value", []interface{}{"gA", "ga", "g9"}) assertEnum(t, en.schemas, "#/definitions/record", []interface{}{`{"createdAt": "2018-08-31"}`, `{"createdAt": "2018-09-30"}`}) // array enum assertEnum(t, en.parameters, "#/paths/~1some~1where~1{id}/get/parameters/1", []interface{}{[]interface{}{"cA", "cz", "c9"}, []interface{}{"cA", "cz"}, []interface{}{"cz", "c9"}}) // items assertEnum(t, en.items, "#/paths/~1some~1where~1{id}/get/parameters/1/items", []interface{}{"cA", "cz", "c9"}) assertEnum(t, en.items, "#/paths/~1other~1place/post/responses/default/headers/Via/items", []interface{}{"AA", "Ab"}) res := an.AllEnums() assert.Lenf(t, res, 14, "Expected 14 enums in this spec, but got %d", len(res)) res = an.ParameterEnums() assert.Lenf(t, res, 4, "Expected 4 enums in this spec, but got %d", len(res)) res = an.SchemaEnums() assert.Lenf(t, res, 6, "Expected 6 schema enums in this spec, but got %d", len(res)) res = an.HeaderEnums() assert.Lenf(t, res, 2, "Expected 2 header enums in this spec, but got %d", len(res)) res = an.ItemsEnums() assert.Lenf(t, res, 2, "Expected 2 items enums in this spec, but got %d", len(res)) } /* helpers for the Analyzer test suite */ func schemeNames(schemes [][]SecurityRequirement) []string { var names []string for _, scheme := range schemes { for _, v := range scheme { names = append(names, v.Name) } } sort.Strings(names) return names } func makeFixturepec(pi, pi2 spec.PathItem, formatParam *spec.Parameter) *spec.Swagger { return &spec.Swagger{ SwaggerProps: spec.SwaggerProps{ Consumes: []string{"application/json"}, Produces: []string{"application/json"}, Security: []map[string][]string{ {"apikey": nil}, }, SecurityDefinitions: map[string]*spec.SecurityScheme{ "basic": spec.BasicAuth(), "apiKey": spec.APIKeyAuth("api_key", "query"), "oauth2": spec.OAuth2AccessToken("http://authorize.com", "http://token.com"), }, Parameters: map[string]spec.Parameter{"format": *formatParam}, Paths: &spec.Paths{ Paths: map[string]spec.PathItem{ "/": pi, "/items": pi2, }, }, }, } } func assertEnum(t testing.TB, data map[string][]interface{}, key string, enum []interface{}) { require.Contains(t, data, key) assert.Equal(t, enum, data[key]) } func assertRefExists(t testing.TB, data map[string]spec.Ref, key string) bool { _, ok := data[key] return assert.Truef(t, ok, "expected %q to exist in the ref bag", key) } func assertSchemaRefExists(t testing.TB, data map[string]SchemaRef, key string) bool { _, ok := data[key] return assert.Truef(t, ok, "expected %q to exist in schema ref bag", key) } func assertPattern(t testing.TB, data map[string]string, key, pattern string) bool { if assert.Contains(t, data, key) { return assert.Equal(t, pattern, data[key]) } return false } func prepareTestParamsAuth() *Spec { formatParam := spec.QueryParam("format").Typed("string", "") limitParam := spec.QueryParam("limit").Typed("integer", "int32") limitParam.Extensions = spec.Extensions(map[string]interface{}{}) limitParam.Extensions.Add("go-name", "Limit") skipParam := spec.QueryParam("skip").Typed("integer", "int32") pi := spec.PathItem{} pi.Parameters = []spec.Parameter{*limitParam} op := &spec.Operation{} op.Consumes = []string{"application/x-yaml"} op.Produces = []string{"application/x-yaml"} op.Security = []map[string][]string{ {"oauth2": {"the-scope"}}, {"basic": nil}, } op.ID = "someOperation" op.Parameters = []spec.Parameter{*skipParam} pi.Get = op pi2 := spec.PathItem{} pi2.Parameters = []spec.Parameter{*limitParam} op2 := &spec.Operation{} op2.ID = "anotherOperation" op2.Security = []map[string][]string{ {"oauth2": {"the-scope"}}, {}, { "basic": {}, "apiKey": {}, }, } op2.Parameters = []spec.Parameter{*skipParam} pi2.Get = op2 oauth := spec.OAuth2AccessToken("http://authorize.com", "http://token.com") oauth.AddScope("the-scope", "the scope gives access to ...") spec := &spec.Swagger{ SwaggerProps: spec.SwaggerProps{ Consumes: []string{"application/json"}, Produces: []string{"application/json"}, Security: []map[string][]string{ {"apikey": nil}, }, SecurityDefinitions: map[string]*spec.SecurityScheme{ "basic": spec.BasicAuth(), "apiKey": spec.APIKeyAuth("api_key", "query"), "oauth2": oauth, }, Parameters: map[string]spec.Parameter{"format": *formatParam}, Paths: &spec.Paths{ Paths: map[string]spec.PathItem{ "/": pi, "/items": pi2, }, }, }, } analyzer := New(spec) return analyzer } func prepareTestParamsValid() *Spec { formatParam := spec.QueryParam("format").Typed("string", "") limitParam := spec.QueryParam("limit").Typed("integer", "int32") limitParam.Extensions = spec.Extensions(map[string]interface{}{}) limitParam.Extensions.Add("go-name", "Limit") skipParam := spec.QueryParam("skip").Typed("integer", "int32") pi := spec.PathItem{} pi.Parameters = []spec.Parameter{*limitParam} op := &spec.Operation{} op.Consumes = []string{"application/x-yaml"} op.Produces = []string{"application/x-yaml"} op.Security = []map[string][]string{ {"oauth2": {}}, {"basic": nil}, } op.ID = "someOperation" op.Parameters = []spec.Parameter{*skipParam} pi.Get = op pi2 := spec.PathItem{} pi2.Parameters = []spec.Parameter{*limitParam} op2 := &spec.Operation{} op2.ID = "anotherOperation" op2.Parameters = []spec.Parameter{*skipParam} pi2.Get = op2 spec := makeFixturepec(pi, pi2, formatParam) analyzer := New(spec) return analyzer } func prepareTestParamsInvalid(t testing.TB, fixture string) *Spec { bp := filepath.Join("fixtures", fixture) spec := antest.LoadOrFail(t, bp) analyzer := New(spec) return analyzer } analysis-0.21.1/appveyor.yml000066400000000000000000000024171413705513100160120ustar00rootroot00000000000000version: "0.1.{build}" clone_folder: C:\go-openapi\analysis shallow_clone: true # for startup speed pull_requests: do_not_increment_build_number: true #skip_tags: true #skip_branch_with_pr: true # appveyor.yml build: off environment: GOPATH: c:\gopath stack: go 1.16 test_script: - go test -v -timeout 20m ./... deploy: off notifications: - provider: Slack incoming_webhook: https://hooks.slack.com/services/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 auth_token: secure: Sf7kZf7ZGbnwWUMpffHwMu5A0cHkLK2MYY32LNTPj4+/3qC3Ghl7+9v4TSLOqOlCwdRNjOGblAq7s+GDJed6/xgRQl1JtCi1klzZNrYX4q01pgTPvvGcwbBkIYgeMaPeIRcK9OZnud7sRXdttozgTOpytps2U6Js32ip7uj5mHSg2ub0FwoSJwlS6dbezZ8+eDhoha0F/guY99BEwx8Bd+zROrT2TFGsSGOFGN6wFc7moCqTHO/YkWib13a2QNXqOxCCVBy/lt76Wp+JkeFppjHlzs/2lP3EAk13RIUAaesdEUHvIHrzCyNJEd3/+KO2DzsWOYfpktd+KBCvgaYOsoo7ubdT3IROeAegZdCgo/6xgCEsmFc9ZcqCfN5yNx2A+BZ2Vwmpws+bQ1E1+B5HDzzaiLcYfG4X2O210QVGVDLWsv1jqD+uPYeHY2WRfh5ZsIUFvaqgUEnwHwrK44/8REAhQavt1QAj5uJpsRd7CkRVPWRNK+yIky+wgbVUFEchRNmS55E7QWf+W4+4QZkQi7vUTMc9nbTUu2Es9NfvfudOpM2wZbn98fjpb/qq/nRv6Bk+ca+7XD5/IgNLMbWp2ouDdzbiHLCOfDUiHiDJhLfFZx9Bwo7ZwfzeOlbrQX66bx7xRKYmOe4DLrXhNcpbsMa8qbfxlZRCmYbubB/Y8h4= channel: bots on_build_success: false on_build_failure: true on_build_status_changed: true analysis-0.21.1/debug.go000066400000000000000000000013721413705513100150360ustar00rootroot00000000000000// Copyright 2015 go-swagger maintainers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package analysis import ( "os" "github.com/go-openapi/analysis/internal/debug" ) var debugLog = debug.GetLogger("analysis", os.Getenv("SWAGGER_DEBUG") != "") analysis-0.21.1/doc.go000066400000000000000000000031061413705513100145120ustar00rootroot00000000000000// Copyright 2015 go-swagger maintainers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /* Package analysis provides methods to work with a Swagger specification document from package go-openapi/spec. Analyzing a specification An analysed specification object (type Spec) provides methods to work with swagger definition. Flattening or expanding a specification Flattening a specification bundles all remote $ref in the main spec document. Depending on flattening options, additional preprocessing may take place: - full flattening: replacing all inline complex constructs by a named entry in #/definitions - expand: replace all $ref's in the document by their expanded content Merging several specifications Mixin several specifications merges all Swagger constructs, and warns about found conflicts. Fixing a specification Unmarshalling a specification with golang json unmarshalling may lead to some unwanted result on present but empty fields. Analyzing a Swagger schema Swagger schemas are analyzed to determine their complexity and qualify their content. */ package analysis analysis-0.21.1/fixer.go000066400000000000000000000044561413705513100150730ustar00rootroot00000000000000// Copyright 2015 go-swagger maintainers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package analysis import "github.com/go-openapi/spec" // FixEmptyResponseDescriptions replaces empty ("") response // descriptions in the input with "(empty)" to ensure that the // resulting Swagger is stays valid. The problem appears to arise // from reading in valid specs that have a explicit response // description of "" (valid, response.description is required), but // due to zero values being omitted upon re-serializing (omitempty) we // lose them unless we stick some chars in there. func FixEmptyResponseDescriptions(s *spec.Swagger) { for k, v := range s.Responses { FixEmptyDesc(&v) //#nosec s.Responses[k] = v } if s.Paths == nil { return } for _, v := range s.Paths.Paths { if v.Get != nil { FixEmptyDescs(v.Get.Responses) } if v.Put != nil { FixEmptyDescs(v.Put.Responses) } if v.Post != nil { FixEmptyDescs(v.Post.Responses) } if v.Delete != nil { FixEmptyDescs(v.Delete.Responses) } if v.Options != nil { FixEmptyDescs(v.Options.Responses) } if v.Head != nil { FixEmptyDescs(v.Head.Responses) } if v.Patch != nil { FixEmptyDescs(v.Patch.Responses) } } } // FixEmptyDescs adds "(empty)" as the description for any Response in // the given Responses object that doesn't already have one. func FixEmptyDescs(rs *spec.Responses) { FixEmptyDesc(rs.Default) for k, v := range rs.StatusCodeResponses { FixEmptyDesc(&v) //#nosec rs.StatusCodeResponses[k] = v } } // FixEmptyDesc adds "(empty)" as the description to the given // Response object if it doesn't already have one and isn't a // ref. No-op on nil input. func FixEmptyDesc(rs *spec.Response) { if rs == nil || rs.Description != "" || rs.Ref.Ref.GetURL() != nil { return } rs.Description = "(empty)" } analysis-0.21.1/fixer_test.go000066400000000000000000000065061413705513100161300ustar00rootroot00000000000000// Copyright 2015 go-swagger maintainers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package analysis import ( "path/filepath" "strconv" "testing" "github.com/go-openapi/analysis/internal/antest" "github.com/go-openapi/spec" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestFixer_EmptyResponseDescriptions(t *testing.T) { t.Parallel() bp := filepath.Join("fixtures", "fixer", "fixer.yaml") sp := antest.LoadOrFail(t, bp) FixEmptyResponseDescriptions(sp) for path, pathItem := range sp.Paths.Paths { require.NotNil(t, pathItem, "expected a fixture with all path items provided in: %s", path) if path == "/noDesc" { // scope for fixed descriptions assertAllVerbs(t, pathItem, true) } else { // scope for unchanged descriptions assertAllVerbs(t, pathItem, false) } } for r, toPin := range sp.Responses { resp := toPin assert.Truef(t, assertResponse(t, "/responses/"+r, &resp, true), "expected a fixed empty description in response %s", r) } } func assertAllVerbs(t testing.TB, pathItem spec.PathItem, isEmpty bool) { msg := "expected %s description for %s" var mode string if isEmpty { mode = "a fixed empty" } else { mode = "an unmodified" } assert.Truef(t, assertResponseInOperation(t, pathItem.Get, isEmpty), msg, mode, "GET") assert.Truef(t, assertResponseInOperation(t, pathItem.Put, isEmpty), msg, mode, "PUT") assert.Truef(t, assertResponseInOperation(t, pathItem.Post, isEmpty), msg, mode, "POST") assert.Truef(t, assertResponseInOperation(t, pathItem.Delete, isEmpty), msg, mode, "DELETE") assert.Truef(t, assertResponseInOperation(t, pathItem.Options, isEmpty), msg, mode, "OPTIONS") assert.Truef(t, assertResponseInOperation(t, pathItem.Patch, isEmpty), msg, mode, "PATCH") assert.Truef(t, assertResponseInOperation(t, pathItem.Head, isEmpty), msg, mode, "HEAD") } func assertResponseInOperation(t testing.TB, op *spec.Operation, isEmpty bool) bool { require.NotNilf(t, op, "expected a fixture with all REST verbs set") if op.Responses == nil { return true } if op.Responses.Default != nil { return assert.Truef(t, assertResponse(t, "default", op.Responses.Default, isEmpty), "unexpected description in response %s for operation", "default") } for code, resp := range op.Responses.StatusCodeResponses { pin := resp return assert.Truef(t, assertResponse(t, strconv.Itoa(code), &pin, isEmpty), "unexpected description in response %d for operation", code) } return true } func assertResponse(t testing.TB, path string, resp *spec.Response, isEmpty bool) bool { var expected string if isEmpty { expected = "(empty)" } else { expected = "my description" } if resp.Ref.String() != "" { expected = "" } if !assert.Equalf(t, expected, resp.Description, "unexpected description for resp. %s", path) { return false } return true } analysis-0.21.1/fixtures/000077500000000000000000000000001413705513100152675ustar00rootroot00000000000000analysis-0.21.1/fixtures/allOf.yml000066400000000000000000000013561413705513100170540ustar00rootroot00000000000000--- swagger: "2.0" info: version: "0.1.0" title: allOf analysis paths: "/some/where/{id}": parameters: - name: id in: path type: integer format: int32 - name: bodyId in: body schema: type: object get: parameters: - name: limit in: query type: integer format: int32 required: false - name: body in: body schema: type: object responses: default: schema: type: object 200: schema: type: object definitions: tag: type: object properties: id: type: integer format: int64 value: type: string analysis-0.21.1/fixtures/azure/000077500000000000000000000000001413705513100164155ustar00rootroot00000000000000analysis-0.21.1/fixtures/azure/applicationGateway.json000066400000000000000000003075241413705513100231500ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "NetworkManagementClient", "description": "The Microsoft Azure Network management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to manage your network resources. The API has entities that capture the relationship between an end user and the Microsoft Azure Networks service.", "version": "2020-04-01" }, "host": "management.azure.com", "schemes": [ "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "security": [ { "azure_auth": [ "user_impersonation" ] } ], "securityDefinitions": { "azure_auth": { "type": "oauth2", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "flow": "implicit", "description": "Azure Active Directory OAuth2 Flow.", "scopes": { "user_impersonation": "impersonate your user account" } } }, "paths": { "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}": { "delete": { "tags": [ "ApplicationGateways" ], "operationId": "ApplicationGateways_Delete", "x-ms-examples": { "Delete ApplicationGateway": { "$ref": "./examples/ApplicationGatewayDelete.json" } }, "description": "Deletes the specified application gateway.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "applicationGatewayName", "in": "path", "required": true, "type": "string", "description": "The name of the application gateway." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "202": { "description": "Accepted and the operation will complete asynchronously." }, "204": { "description": "Request successful. Resource with the specified name does not exist." }, "200": { "description": "Delete successful." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } }, "get": { "tags": [ "ApplicationGateways" ], "operationId": "ApplicationGateways_Get", "x-ms-examples": { "Get ApplicationGateway": { "$ref": "./examples/ApplicationGatewayGet.json" } }, "description": "Gets the specified application gateway.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "applicationGatewayName", "in": "path", "required": true, "type": "string", "description": "The name of the application gateway." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns an ApplicationGateway resource.", "schema": { "$ref": "#/definitions/ApplicationGateway" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } } }, "put": { "tags": [ "ApplicationGateways" ], "operationId": "ApplicationGateways_CreateOrUpdate", "description": "Creates or updates the specified application gateway.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "applicationGatewayName", "in": "path", "required": true, "type": "string", "description": "The name of the application gateway." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/ApplicationGateway" }, "description": "Parameters supplied to the create or update application gateway operation." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "201": { "description": "Create successful. The operation returns the resulting ApplicationGateway resource.", "schema": { "$ref": "#/definitions/ApplicationGateway" } }, "200": { "description": "Update successful. The operation returns the resulting ApplicationGateway resource.", "schema": { "$ref": "#/definitions/ApplicationGateway" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Create Application Gateway": { "$ref": "./examples/ApplicationGatewayCreate.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" } }, "patch": { "tags": [ "ApplicationGateways" ], "operationId": "ApplicationGateways_UpdateTags", "x-ms-examples": { "Update Application Gateway tags": { "$ref": "./examples/ApplicationGatewayUpdateTags.json" } }, "description": "Updates the specified application gateway tags.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "applicationGatewayName", "in": "path", "required": true, "type": "string", "description": "The name of the application gateway." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "./network.json#/definitions/TagsObject" }, "description": "Parameters supplied to update application gateway tags." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting ApplicationGateway resource.", "schema": { "$ref": "#/definitions/ApplicationGateway" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways": { "get": { "tags": [ "ApplicationGateways" ], "operationId": "ApplicationGateways_List", "x-ms-examples": { "Lists all application gateways in a resource group": { "$ref": "./examples/ApplicationGatewayList.json" } }, "description": "Lists all application gateways in a resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Success. The operation returns a list of ApplicationGateway resources.", "schema": { "$ref": "#/definitions/ApplicationGatewayListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGateways": { "get": { "tags": [ "ApplicationGateways" ], "operationId": "ApplicationGateways_ListAll", "x-ms-examples": { "Lists all application gateways in a subscription": { "$ref": "./examples/ApplicationGatewayListAll.json" } }, "description": "Gets all the application gateways in a subscription.", "parameters": [ { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Success. The operation returns a list of ApplicationGateway resources.", "schema": { "$ref": "#/definitions/ApplicationGatewayListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start": { "post": { "tags": [ "ApplicationGateways" ], "operationId": "ApplicationGateways_Start", "x-ms-examples": { "Start Application Gateway": { "$ref": "./examples/ApplicationGatewayStart.json" } }, "description": "Starts the specified application gateway.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "applicationGatewayName", "in": "path", "required": true, "type": "string", "description": "The name of the application gateway." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation starts the ApplicationGateway resource." }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop": { "post": { "tags": [ "ApplicationGateways" ], "operationId": "ApplicationGateways_Stop", "x-ms-examples": { "Stop Application Gateway": { "$ref": "./examples/ApplicationGatewayStop.json" } }, "description": "Stops the specified application gateway in a resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "applicationGatewayName", "in": "path", "required": true, "type": "string", "description": "The name of the application gateway." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation stops the ApplicationGateway resource." }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendhealth": { "post": { "tags": [ "ApplicationGateways" ], "operationId": "ApplicationGateways_BackendHealth", "description": "Gets the backend health of the specified application gateway in a resource group.", "x-ms-examples": { "Get Backend Health": { "$ref": "./examples/ApplicationGatewayBackendHealthGet.json" } }, "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "applicationGatewayName", "in": "path", "required": true, "type": "string", "description": "The name of the application gateway." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" }, { "name": "$expand", "in": "query", "required": false, "type": "string", "description": "Expands BackendAddressPool and BackendHttpSettings referenced in backend health." } ], "responses": { "200": { "description": "Request successful.", "schema": { "$ref": "#/definitions/ApplicationGatewayBackendHealth" } }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/getBackendHealthOnDemand": { "post": { "tags": [ "ApplicationGateways" ], "operationId": "ApplicationGateways_BackendHealthOnDemand", "description": "Gets the backend health for given combination of backend pool and http setting of the specified application gateway in a resource group.", "x-ms-examples": { "Test Backend Health": { "$ref": "./examples/ApplicationGatewayBackendHealthTest.json" } }, "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "applicationGatewayName", "in": "path", "required": true, "type": "string", "description": "The name of the application gateway." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" }, { "name": "$expand", "in": "query", "required": false, "type": "string", "description": "Expands BackendAddressPool and BackendHttpSettings referenced in backend health." }, { "name": "probeRequest", "in": "body", "required": true, "schema": { "$ref": "#/definitions/ApplicationGatewayOnDemandProbe" }, "description": "Request body for on-demand test probe operation." } ], "responses": { "200": { "description": "Request successful.", "schema": { "$ref": "#/definitions/ApplicationGatewayBackendHealthOnDemand" } }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableServerVariables": { "get": { "tags": [ "ApplicationGateways" ], "operationId": "ApplicationGateways_ListAvailableServerVariables", "x-ms-examples": { "Get Available Server Variables": { "$ref": "./examples/ApplicationGatewayAvailableServerVariablesGet.json" } }, "description": "Lists all available server variables.", "parameters": [ { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Success. The operation returns a list of all available server variables.", "schema": { "$ref": "#/definitions/ApplicationGatewayAvailableServerVariablesResult" } }, "default": { "description": "Unexpected error.", "schema": { "$ref": "./network.json#/definitions/Error" } } } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableRequestHeaders": { "get": { "tags": [ "ApplicationGateways" ], "operationId": "ApplicationGateways_ListAvailableRequestHeaders", "x-ms-examples": { "Get Available Request Headers": { "$ref": "./examples/ApplicationGatewayAvailableRequestHeadersGet.json" } }, "description": "Lists all available request headers.", "parameters": [ { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Success. The operation returns a list of all available request headers.", "schema": { "$ref": "#/definitions/ApplicationGatewayAvailableRequestHeadersResult" } }, "default": { "description": "Unexpected error.", "schema": { "$ref": "./network.json#/definitions/Error" } } } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableResponseHeaders": { "get": { "tags": [ "ApplicationGateways" ], "operationId": "ApplicationGateways_ListAvailableResponseHeaders", "x-ms-examples": { "Get Available Response Headers": { "$ref": "./examples/ApplicationGatewayAvailableResponseHeadersGet.json" } }, "description": "Lists all available response headers.", "parameters": [ { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Success. The operation returns a list of all available response headers.", "schema": { "$ref": "#/definitions/ApplicationGatewayAvailableResponseHeadersResult" } }, "default": { "description": "Unexpected error.", "schema": { "$ref": "./network.json#/definitions/Error" } } } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableWafRuleSets": { "get": { "tags": [ "ApplicationGateways" ], "operationId": "ApplicationGateways_ListAvailableWafRuleSets", "x-ms-examples": { "Get Available Waf Rule Sets": { "$ref": "./examples/ApplicationGatewayAvailableWafRuleSetsGet.json" } }, "description": "Lists all available web application firewall rule sets.", "parameters": [ { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Success. The operation returns a list of all available web application firewall rule sets.", "schema": { "$ref": "#/definitions/ApplicationGatewayAvailableWafRuleSetsResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default": { "get": { "tags": [ "ApplicationGateways" ], "operationId": "ApplicationGateways_ListAvailableSslOptions", "x-ms-examples": { "Get Available Ssl Options": { "$ref": "./examples/ApplicationGatewayAvailableSslOptionsGet.json" } }, "description": "Lists available Ssl options for configuring Ssl policy.", "parameters": [ { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Success. The operation returns all available Ssl options for configuring Ssl policy.", "schema": { "$ref": "#/definitions/ApplicationGatewayAvailableSslOptions" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies": { "get": { "tags": [ "ApplicationGateways" ], "operationId": "ApplicationGateways_ListAvailableSslPredefinedPolicies", "x-ms-examples": { "Get Available Ssl Predefined Policies": { "$ref": "./examples/ApplicationGatewayAvailableSslOptionsPredefinedPoliciesGet.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" }, "description": "Lists all SSL predefined policies for configuring Ssl policy.", "parameters": [ { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Success. The operation returns a lists of all Ssl predefined policies for configuring Ssl policy.", "schema": { "$ref": "#/definitions/ApplicationGatewayAvailableSslPredefinedPolicies" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies/{predefinedPolicyName}": { "get": { "tags": [ "ApplicationGateways" ], "operationId": "ApplicationGateways_GetSslPredefinedPolicy", "x-ms-examples": { "Get Available Ssl Predefined Policy by name": { "$ref": "./examples/ApplicationGatewayAvailableSslOptionsPredefinedPolicyGet.json" } }, "description": "Gets Ssl predefined policy with the specified policy name.", "parameters": [ { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" }, { "name": "predefinedPolicyName", "in": "path", "required": true, "type": "string", "description": "Name of Ssl predefined policy." } ], "responses": { "200": { "description": "Success. The operation returns a Ssl predefined policy with the specified policy name.", "schema": { "$ref": "#/definitions/ApplicationGatewaySslPredefinedPolicy" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } } } } }, "definitions": { "ApplicationGatewayOnDemandProbe": { "properties": { "protocol": { "$ref": "#/definitions/ApplicationGatewayProtocol", "description": "The protocol used for the probe." }, "host": { "type": "string", "description": "Host name to send the probe to." }, "path": { "type": "string", "description": "Relative path of probe. Valid path starts from '/'. Probe is sent to ://:." }, "timeout": { "type": "integer", "format": "int32", "description": "The probe timeout in seconds. Probe marked as failed if valid response is not received with this timeout period. Acceptable values are from 1 second to 86400 seconds." }, "pickHostNameFromBackendHttpSettings": { "type": "boolean", "description": "Whether the host header should be picked from the backend http settings. Default value is false." }, "match": { "$ref": "#/definitions/ApplicationGatewayProbeHealthResponseMatch", "description": "Criterion for classifying a healthy probe response." }, "backendAddressPool": { "$ref": "./network.json#/definitions/SubResource", "description": "Reference to backend pool of application gateway to which probe request will be sent." }, "backendHttpSettings": { "$ref": "./network.json#/definitions/SubResource", "description": "Reference to backend http setting of application gateway to be used for test probe." } }, "description": "Details of on demand test probe request." }, "ApplicationGatewayBackendHealthOnDemand": { "properties": { "backendAddressPool": { "$ref": "#/definitions/ApplicationGatewayBackendAddressPool", "description": "Reference to an ApplicationGatewayBackendAddressPool resource." }, "backendHealthHttpSettings": { "$ref": "#/definitions/ApplicationGatewayBackendHealthHttpSettings", "description": "Application gateway BackendHealthHttp settings." } }, "description": "Result of on demand test probe." }, "ApplicationGatewayBackendHealth": { "properties": { "backendAddressPools": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayBackendHealthPool" }, "description": "A list of ApplicationGatewayBackendHealthPool resources." } }, "description": "Response for ApplicationGatewayBackendHealth API service call." }, "ApplicationGatewayBackendHealthPool": { "properties": { "backendAddressPool": { "$ref": "#/definitions/ApplicationGatewayBackendAddressPool", "description": "Reference to an ApplicationGatewayBackendAddressPool resource." }, "backendHttpSettingsCollection": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayBackendHealthHttpSettings" }, "description": "List of ApplicationGatewayBackendHealthHttpSettings resources." } }, "description": "Application gateway BackendHealth pool." }, "ApplicationGatewayBackendHealthHttpSettings": { "properties": { "backendHttpSettings": { "$ref": "#/definitions/ApplicationGatewayBackendHttpSettings", "description": "Reference to an ApplicationGatewayBackendHttpSettings resource." }, "servers": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayBackendHealthServer" }, "description": "List of ApplicationGatewayBackendHealthServer resources." } }, "description": "Application gateway BackendHealthHttp settings." }, "ApplicationGatewayBackendHealthServer": { "properties": { "address": { "type": "string", "description": "IP address or FQDN of backend server." }, "ipConfiguration": { "$ref": "./networkInterface.json#/definitions/NetworkInterfaceIPConfiguration", "description": "Reference to IP configuration of backend server." }, "health": { "type": "string", "description": "Health of backend server.", "enum": [ "Unknown", "Up", "Down", "Partial", "Draining" ], "x-ms-enum": { "name": "ApplicationGatewayBackendHealthServerHealth", "modelAsString": true } }, "healthProbeLog": { "type": "string", "description": "Health Probe Log." } }, "description": "Application gateway backendhealth http settings." }, "ApplicationGatewaySku": { "properties": { "name": { "type": "string", "description": "Name of an application gateway SKU.", "enum": [ "Standard_Small", "Standard_Medium", "Standard_Large", "WAF_Medium", "WAF_Large", "Standard_v2", "WAF_v2" ], "x-ms-enum": { "name": "ApplicationGatewaySkuName", "modelAsString": true } }, "tier": { "type": "string", "description": "Tier of an application gateway.", "enum": [ "Standard", "WAF", "Standard_v2", "WAF_v2" ], "x-ms-enum": { "name": "ApplicationGatewayTier", "modelAsString": true } }, "capacity": { "type": "integer", "format": "int32", "description": "Capacity (instance count) of an application gateway." } }, "description": "SKU of an application gateway." }, "ApplicationGatewaySslPolicy": { "properties": { "disabledSslProtocols": { "type": "array", "description": "Ssl protocols to be disabled on application gateway.", "items": { "type": "string", "$ref": "#/definitions/ProtocolsEnum" } }, "policyType": { "type": "string", "description": "Type of Ssl Policy.", "enum": [ "Predefined", "Custom" ], "x-ms-enum": { "name": "ApplicationGatewaySslPolicyType", "modelAsString": true } }, "policyName": { "$ref": "#/definitions/PolicyNameEnum", "description": "Name of Ssl predefined policy." }, "cipherSuites": { "type": "array", "items": { "$ref": "#/definitions/CipherSuitesEnum" }, "description": "Ssl cipher suites to be enabled in the specified order to application gateway." }, "minProtocolVersion": { "$ref": "#/definitions/ProtocolsEnum", "description": "Minimum version of Ssl protocol to be supported on application gateway." } }, "description": "Application Gateway Ssl policy." }, "ApplicationGatewayIPConfigurationPropertiesFormat": { "properties": { "subnet": { "$ref": "./network.json#/definitions/SubResource", "description": "Reference to the subnet resource. A subnet from where application gateway gets its private address." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the application gateway IP configuration resource." } }, "description": "Properties of IP configuration of an application gateway." }, "ApplicationGatewayIPConfiguration": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ApplicationGatewayIPConfigurationPropertiesFormat", "description": "Properties of the application gateway IP configuration." }, "name": { "type": "string", "description": "Name of the IP configuration that is unique within an Application Gateway." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Type of the resource." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "IP configuration of an application gateway. Currently 1 public and 1 private IP configuration is allowed." }, "ApplicationGatewayAuthenticationCertificatePropertiesFormat": { "properties": { "data": { "type": "string", "description": "Certificate public data." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the authentication certificate resource." } }, "description": "Authentication certificates properties of an application gateway." }, "ApplicationGatewayAuthenticationCertificate": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ApplicationGatewayAuthenticationCertificatePropertiesFormat", "description": "Properties of the application gateway authentication certificate." }, "name": { "type": "string", "description": "Name of the authentication certificate that is unique within an Application Gateway." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Type of the resource." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Authentication certificates of an application gateway." }, "ApplicationGatewayTrustedRootCertificatePropertiesFormat": { "properties": { "data": { "type": "string", "description": "Certificate public data." }, "keyVaultSecretId": { "type": "string", "description": "Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or 'Certificate' object stored in KeyVault." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the trusted root certificate resource." } }, "description": "Trusted Root certificates properties of an application gateway." }, "ApplicationGatewayTrustedRootCertificate": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ApplicationGatewayTrustedRootCertificatePropertiesFormat", "description": "Properties of the application gateway trusted root certificate." }, "name": { "type": "string", "description": "Name of the trusted root certificate that is unique within an Application Gateway." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Type of the resource." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Trusted Root certificates of an application gateway." }, "ApplicationGatewaySslCertificatePropertiesFormat": { "properties": { "data": { "type": "string", "description": "Base-64 encoded pfx certificate. Only applicable in PUT Request." }, "password": { "type": "string", "description": "Password for the pfx file specified in data. Only applicable in PUT request." }, "publicCertData": { "readOnly": true, "type": "string", "description": "Base-64 encoded Public cert data corresponding to pfx specified in data. Only applicable in GET request." }, "keyVaultSecretId": { "type": "string", "description": "Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or 'Certificate' object stored in KeyVault." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the SSL certificate resource." } }, "description": "Properties of SSL certificates of an application gateway." }, "ApplicationGatewaySslCertificate": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ApplicationGatewaySslCertificatePropertiesFormat", "description": "Properties of the application gateway SSL certificate." }, "name": { "type": "string", "description": "Name of the SSL certificate that is unique within an Application Gateway." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Type of the resource." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "SSL certificates of an application gateway." }, "ApplicationGatewayFrontendIPConfigurationPropertiesFormat": { "properties": { "privateIPAddress": { "type": "string", "description": "PrivateIPAddress of the network interface IP Configuration." }, "privateIPAllocationMethod": { "$ref": "./network.json#/definitions/IPAllocationMethod", "description": "The private IP address allocation method." }, "subnet": { "$ref": "./network.json#/definitions/SubResource", "description": "Reference to the subnet resource." }, "publicIPAddress": { "$ref": "./network.json#/definitions/SubResource", "description": "Reference to the PublicIP resource." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the frontend IP configuration resource." } }, "description": "Properties of Frontend IP configuration of an application gateway." }, "ApplicationGatewayFrontendIPConfiguration": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ApplicationGatewayFrontendIPConfigurationPropertiesFormat", "description": "Properties of the application gateway frontend IP configuration." }, "name": { "type": "string", "description": "Name of the frontend IP configuration that is unique within an Application Gateway." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Type of the resource." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Frontend IP configuration of an application gateway." }, "ApplicationGatewayFrontendPortPropertiesFormat": { "properties": { "port": { "type": "integer", "format": "int32", "description": "Frontend port." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the frontend port resource." } }, "description": "Properties of Frontend port of an application gateway." }, "ApplicationGatewayFrontendPort": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ApplicationGatewayFrontendPortPropertiesFormat", "description": "Properties of the application gateway frontend port." }, "name": { "type": "string", "description": "Name of the frontend port that is unique within an Application Gateway." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Type of the resource." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Frontend port of an application gateway." }, "ApplicationGatewayBackendAddress": { "properties": { "fqdn": { "type": "string", "description": "Fully qualified domain name (FQDN)." }, "ipAddress": { "type": "string", "description": "IP address." } }, "description": "Backend address of an application gateway." }, "ApplicationGatewayBackendAddressPoolPropertiesFormat": { "properties": { "backendIPConfigurations": { "readOnly": true, "type": "array", "items": { "$ref": "./networkInterface.json#/definitions/NetworkInterfaceIPConfiguration" }, "description": "Collection of references to IPs defined in network interfaces." }, "backendAddresses": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayBackendAddress" }, "description": "Backend addresses." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the backend address pool resource." } }, "description": "Properties of Backend Address Pool of an application gateway." }, "ApplicationGatewayBackendAddressPool": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ApplicationGatewayBackendAddressPoolPropertiesFormat", "description": "Properties of the application gateway backend address pool." }, "name": { "type": "string", "description": "Name of the backend address pool that is unique within an Application Gateway." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Type of the resource." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Backend Address Pool of an application gateway." }, "ApplicationGatewayBackendHttpSettingsPropertiesFormat": { "properties": { "port": { "type": "integer", "format": "int32", "description": "The destination port on the backend." }, "protocol": { "$ref": "#/definitions/ApplicationGatewayProtocol", "description": "The protocol used to communicate with the backend." }, "cookieBasedAffinity": { "type": "string", "description": "Cookie based affinity.", "enum": [ "Enabled", "Disabled" ], "x-ms-enum": { "name": "ApplicationGatewayCookieBasedAffinity", "modelAsString": true } }, "requestTimeout": { "type": "integer", "format": "int32", "description": "Request timeout in seconds. Application Gateway will fail the request if response is not received within RequestTimeout. Acceptable values are from 1 second to 86400 seconds." }, "probe": { "$ref": "./network.json#/definitions/SubResource", "description": "Probe resource of an application gateway." }, "authenticationCertificates": { "type": "array", "items": { "$ref": "./network.json#/definitions/SubResource" }, "description": "Array of references to application gateway authentication certificates." }, "trustedRootCertificates": { "type": "array", "items": { "$ref": "./network.json#/definitions/SubResource" }, "description": "Array of references to application gateway trusted root certificates." }, "connectionDraining": { "$ref": "#/definitions/ApplicationGatewayConnectionDraining", "description": "Connection draining of the backend http settings resource." }, "hostName": { "type": "string", "description": "Host header to be sent to the backend servers." }, "pickHostNameFromBackendAddress": { "type": "boolean", "description": "Whether to pick host header should be picked from the host name of the backend server. Default value is false." }, "affinityCookieName": { "type": "string", "description": "Cookie name to use for the affinity cookie." }, "probeEnabled": { "type": "boolean", "description": "Whether the probe is enabled. Default value is false." }, "path": { "type": "string", "description": "Path which should be used as a prefix for all HTTP requests. Null means no path will be prefixed. Default value is null." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the backend HTTP settings resource." } }, "description": "Properties of Backend address pool settings of an application gateway." }, "ApplicationGatewayBackendHttpSettings": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ApplicationGatewayBackendHttpSettingsPropertiesFormat", "description": "Properties of the application gateway backend HTTP settings." }, "name": { "type": "string", "description": "Name of the backend http settings that is unique within an Application Gateway." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Type of the resource." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Backend address pool settings of an application gateway." }, "ApplicationGatewayHttpListenerPropertiesFormat": { "properties": { "frontendIPConfiguration": { "$ref": "./network.json#/definitions/SubResource", "description": "Frontend IP configuration resource of an application gateway." }, "frontendPort": { "$ref": "./network.json#/definitions/SubResource", "description": "Frontend port resource of an application gateway." }, "protocol": { "$ref": "#/definitions/ApplicationGatewayProtocol", "description": "Protocol of the HTTP listener." }, "hostName": { "type": "string", "description": "Host name of HTTP listener." }, "sslCertificate": { "$ref": "./network.json#/definitions/SubResource", "description": "SSL certificate resource of an application gateway." }, "requireServerNameIndication": { "type": "boolean", "description": "Applicable only if protocol is https. Enables SNI for multi-hosting." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the HTTP listener resource." }, "customErrorConfigurations": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayCustomError" }, "description": "Custom error configurations of the HTTP listener." }, "firewallPolicy": { "$ref": "./network.json#/definitions/SubResource", "description": "Reference to the FirewallPolicy resource." }, "hostNames": { "type": "array", "items": { "type": "string" }, "description": "List of Host names for HTTP Listener that allows special wildcard characters as well." } }, "description": "Properties of HTTP listener of an application gateway." }, "ApplicationGatewayHttpListener": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ApplicationGatewayHttpListenerPropertiesFormat", "description": "Properties of the application gateway HTTP listener." }, "name": { "type": "string", "description": "Name of the HTTP listener that is unique within an Application Gateway." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Type of the resource." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Http listener of an application gateway." }, "ApplicationGatewayPathRulePropertiesFormat": { "properties": { "paths": { "type": "array", "items": { "type": "string" }, "description": "Path rules of URL path map." }, "backendAddressPool": { "$ref": "./network.json#/definitions/SubResource", "description": "Backend address pool resource of URL path map path rule." }, "backendHttpSettings": { "$ref": "./network.json#/definitions/SubResource", "description": "Backend http settings resource of URL path map path rule." }, "redirectConfiguration": { "$ref": "./network.json#/definitions/SubResource", "description": "Redirect configuration resource of URL path map path rule." }, "rewriteRuleSet": { "$ref": "./network.json#/definitions/SubResource", "description": "Rewrite rule set resource of URL path map path rule." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the path rule resource." }, "firewallPolicy": { "$ref": "./network.json#/definitions/SubResource", "description": "Reference to the FirewallPolicy resource." } }, "description": "Properties of path rule of an application gateway." }, "ApplicationGatewayPathRule": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ApplicationGatewayPathRulePropertiesFormat", "description": "Properties of the application gateway path rule." }, "name": { "type": "string", "description": "Name of the path rule that is unique within an Application Gateway." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Type of the resource." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Path rule of URL path map of an application gateway." }, "ApplicationGatewayProbePropertiesFormat": { "properties": { "protocol": { "$ref": "#/definitions/ApplicationGatewayProtocol", "description": "The protocol used for the probe." }, "host": { "type": "string", "description": "Host name to send the probe to." }, "path": { "type": "string", "description": "Relative path of probe. Valid path starts from '/'. Probe is sent to ://:." }, "interval": { "type": "integer", "format": "int32", "description": "The probing interval in seconds. This is the time interval between two consecutive probes. Acceptable values are from 1 second to 86400 seconds." }, "timeout": { "type": "integer", "format": "int32", "description": "The probe timeout in seconds. Probe marked as failed if valid response is not received with this timeout period. Acceptable values are from 1 second to 86400 seconds." }, "unhealthyThreshold": { "type": "integer", "format": "int32", "description": "The probe retry count. Backend server is marked down after consecutive probe failure count reaches UnhealthyThreshold. Acceptable values are from 1 second to 20." }, "pickHostNameFromBackendHttpSettings": { "type": "boolean", "description": "Whether the host header should be picked from the backend http settings. Default value is false." }, "minServers": { "type": "integer", "format": "int32", "description": "Minimum number of servers that are always marked healthy. Default value is 0." }, "match": { "$ref": "#/definitions/ApplicationGatewayProbeHealthResponseMatch", "description": "Criterion for classifying a healthy probe response." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the probe resource." }, "port": { "type": "integer", "format": "int32", "description": "Custom port which will be used for probing the backend servers. The valid value ranges from 1 to 65535. In case not set, port from http settings will be used. This property is valid for Standard_v2 and WAF_v2 only.", "minimum": 1, "maximum": 65535 } }, "description": "Properties of probe of an application gateway." }, "ApplicationGatewayProbeHealthResponseMatch": { "properties": { "body": { "type": "string", "description": "Body that must be contained in the health response. Default value is empty." }, "statusCodes": { "type": "array", "items": { "type": "string" }, "description": "Allowed ranges of healthy status codes. Default range of healthy status codes is 200-399." } }, "description": "Application gateway probe health response match." }, "ApplicationGatewayProbe": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ApplicationGatewayProbePropertiesFormat", "description": "Properties of the application gateway probe." }, "name": { "type": "string", "description": "Name of the probe that is unique within an Application Gateway." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Type of the resource." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Probe of the application gateway." }, "ApplicationGatewayRequestRoutingRulePropertiesFormat": { "properties": { "ruleType": { "type": "string", "description": "Rule type.", "enum": [ "Basic", "PathBasedRouting" ], "x-ms-enum": { "name": "ApplicationGatewayRequestRoutingRuleType", "modelAsString": true } }, "priority": { "type": "integer", "format": "int32", "minimum": 1, "exclusiveMinimum": false, "maximum": 20000, "exclusiveMaximum": false, "description": "Priority of the request routing rule." }, "backendAddressPool": { "$ref": "./network.json#/definitions/SubResource", "description": "Backend address pool resource of the application gateway." }, "backendHttpSettings": { "$ref": "./network.json#/definitions/SubResource", "description": "Backend http settings resource of the application gateway." }, "httpListener": { "$ref": "./network.json#/definitions/SubResource", "description": "Http listener resource of the application gateway." }, "urlPathMap": { "$ref": "./network.json#/definitions/SubResource", "description": "URL path map resource of the application gateway." }, "rewriteRuleSet": { "$ref": "./network.json#/definitions/SubResource", "description": "Rewrite Rule Set resource in Basic rule of the application gateway." }, "redirectConfiguration": { "$ref": "./network.json#/definitions/SubResource", "description": "Redirect configuration resource of the application gateway." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the request routing rule resource." } }, "description": "Properties of request routing rule of the application gateway." }, "ApplicationGatewayRequestRoutingRule": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ApplicationGatewayRequestRoutingRulePropertiesFormat", "description": "Properties of the application gateway request routing rule." }, "name": { "type": "string", "description": "Name of the request routing rule that is unique within an Application Gateway." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Type of the resource." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Request routing rule of an application gateway." }, "ApplicationGatewayRewriteRuleSet": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ApplicationGatewayRewriteRuleSetPropertiesFormat", "description": "Properties of the application gateway rewrite rule set." }, "name": { "type": "string", "description": "Name of the rewrite rule set that is unique within an Application Gateway." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Rewrite rule set of an application gateway." }, "ApplicationGatewayRewriteRuleSetPropertiesFormat": { "properties": { "rewriteRules": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayRewriteRule" }, "description": "Rewrite rules in the rewrite rule set." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the rewrite rule set resource." } }, "description": "Properties of rewrite rule set of the application gateway." }, "ApplicationGatewayRewriteRule": { "properties": { "name": { "type": "string", "description": "Name of the rewrite rule that is unique within an Application Gateway." }, "ruleSequence": { "type": "integer", "description": "Rule Sequence of the rewrite rule that determines the order of execution of a particular rule in a RewriteRuleSet." }, "conditions": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayRewriteRuleCondition" }, "description": "Conditions based on which the action set execution will be evaluated." }, "actionSet": { "type": "object", "$ref": "#/definitions/ApplicationGatewayRewriteRuleActionSet", "description": "Set of actions to be done as part of the rewrite Rule." } }, "description": "Rewrite rule of an application gateway." }, "ApplicationGatewayRewriteRuleCondition": { "properties": { "variable": { "type": "string", "description": "The condition parameter of the RewriteRuleCondition." }, "pattern": { "type": "string", "description": "The pattern, either fixed string or regular expression, that evaluates the truthfulness of the condition." }, "ignoreCase": { "type": "boolean", "description": "Setting this paramter to truth value with force the pattern to do a case in-sensitive comparison." }, "negate": { "type": "boolean", "description": "Setting this value as truth will force to check the negation of the condition given by the user." } }, "description": "Set of conditions in the Rewrite Rule in Application Gateway." }, "ApplicationGatewayRewriteRuleActionSet": { "properties": { "requestHeaderConfigurations": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayHeaderConfiguration" }, "description": "Request Header Actions in the Action Set." }, "responseHeaderConfigurations": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayHeaderConfiguration" }, "description": "Response Header Actions in the Action Set." }, "urlConfiguration": { "$ref": "#/definitions/ApplicationGatewayUrlConfiguration", "description": "Url Configuration Action in the Action Set." } }, "description": "Set of actions in the Rewrite Rule in Application Gateway." }, "ApplicationGatewayHeaderConfiguration": { "properties": { "headerName": { "type": "string", "description": "Header name of the header configuration." }, "headerValue": { "type": "string", "description": "Header value of the header configuration." } }, "description": "Header configuration of the Actions set in Application Gateway." }, "ApplicationGatewayUrlConfiguration": { "properties": { "modifiedPath": { "type": "string", "description": "Url path which user has provided for url rewrite. Null means no path will be updated. Default value is null." }, "modifiedQueryString": { "type": "string", "description": "Query string which user has provided for url rewrite. Null means no query string will be updated. Default value is null." }, "reroute": { "type": "boolean", "description": "If set as true, it will re-evaluate the url path map provided in path based request routing rules using modified path. Default value is false." } }, "description": "Url configuration of the Actions set in Application Gateway." }, "ApplicationGatewayRedirectConfigurationPropertiesFormat": { "properties": { "redirectType": { "type": "string", "$ref": "#/definitions/RedirectTypeEnum", "description": "HTTP redirection type." }, "targetListener": { "$ref": "./network.json#/definitions/SubResource", "description": "Reference to a listener to redirect the request to." }, "targetUrl": { "type": "string", "description": "Url to redirect the request to." }, "includePath": { "type": "boolean", "description": "Include path in the redirected url." }, "includeQueryString": { "type": "boolean", "description": "Include query string in the redirected url." }, "requestRoutingRules": { "type": "array", "items": { "$ref": "./network.json#/definitions/SubResource" }, "description": "Request routing specifying redirect configuration." }, "urlPathMaps": { "type": "array", "items": { "$ref": "./network.json#/definitions/SubResource" }, "description": "Url path maps specifying default redirect configuration." }, "pathRules": { "type": "array", "items": { "$ref": "./network.json#/definitions/SubResource" }, "description": "Path rules specifying redirect configuration." } }, "description": "Properties of redirect configuration of the application gateway." }, "ApplicationGatewayRedirectConfiguration": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ApplicationGatewayRedirectConfigurationPropertiesFormat", "description": "Properties of the application gateway redirect configuration." }, "name": { "type": "string", "description": "Name of the redirect configuration that is unique within an Application Gateway." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Type of the resource." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Redirect configuration of an application gateway." }, "ApplicationGatewayPropertiesFormat": { "properties": { "sku": { "$ref": "#/definitions/ApplicationGatewaySku", "description": "SKU of the application gateway resource." }, "sslPolicy": { "$ref": "#/definitions/ApplicationGatewaySslPolicy", "description": "SSL policy of the application gateway resource." }, "operationalState": { "readOnly": true, "type": "string", "description": "Operational state of the application gateway resource.", "enum": [ "Stopped", "Starting", "Running", "Stopping" ], "x-ms-enum": { "name": "ApplicationGatewayOperationalState", "modelAsString": true } }, "gatewayIPConfigurations": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayIPConfiguration" }, "description": "Subnets of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)." }, "authenticationCertificates": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayAuthenticationCertificate" }, "description": "Authentication certificates of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)." }, "trustedRootCertificates": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayTrustedRootCertificate" }, "description": "Trusted Root certificates of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)." }, "sslCertificates": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewaySslCertificate" }, "description": "SSL certificates of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)." }, "frontendIPConfigurations": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayFrontendIPConfiguration" }, "description": "Frontend IP addresses of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)." }, "frontendPorts": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayFrontendPort" }, "description": "Frontend ports of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)." }, "probes": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayProbe" }, "description": "Probes of the application gateway resource." }, "backendAddressPools": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayBackendAddressPool" }, "description": "Backend address pool of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)." }, "backendHttpSettingsCollection": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayBackendHttpSettings" }, "description": "Backend http settings of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)." }, "httpListeners": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayHttpListener" }, "description": "Http listeners of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)." }, "urlPathMaps": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayUrlPathMap" }, "description": "URL path map of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)." }, "requestRoutingRules": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayRequestRoutingRule" }, "description": "Request routing rules of the application gateway resource." }, "rewriteRuleSets": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayRewriteRuleSet" }, "description": "Rewrite rules for the application gateway resource." }, "redirectConfigurations": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayRedirectConfiguration" }, "description": "Redirect configurations of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)." }, "webApplicationFirewallConfiguration": { "$ref": "#/definitions/ApplicationGatewayWebApplicationFirewallConfiguration", "description": "Web application firewall configuration." }, "firewallPolicy": { "$ref": "./network.json#/definitions/SubResource", "description": "Reference to the FirewallPolicy resource." }, "enableHttp2": { "type": "boolean", "description": "Whether HTTP2 is enabled on the application gateway resource." }, "enableFips": { "type": "boolean", "description": "Whether FIPS is enabled on the application gateway resource." }, "autoscaleConfiguration": { "$ref": "#/definitions/ApplicationGatewayAutoscaleConfiguration", "description": "Autoscale Configuration." }, "resourceGuid": { "readOnly": true, "type": "string", "description": "The resource GUID property of the application gateway resource." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the application gateway resource." }, "customErrorConfigurations": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayCustomError" }, "description": "Custom error configurations of the application gateway resource." }, "forceFirewallPolicyAssociation": { "type": "boolean", "description": "If true, associates a firewall policy with an application gateway regardless whether the policy differs from the WAF Config." } }, "description": "Properties of the application gateway." }, "ApplicationGateway": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ApplicationGatewayPropertiesFormat", "description": "Properties of the application gateway." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "zones": { "type": "array", "items": { "type": "string" }, "description": "A list of availability zones denoting where the resource needs to come from." }, "identity": { "$ref": "./network.json#/definitions/ManagedServiceIdentity", "description": "The identity of the application gateway, if configured." } }, "allOf": [ { "$ref": "./network.json#/definitions/Resource" } ], "description": "Application gateway resource." }, "ApplicationGatewayListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGateway" }, "description": "List of an application gateways in a resource group." }, "nextLink": { "type": "string", "description": "URL to get the next set of results." } }, "description": "Response for ListApplicationGateways API service call." }, "ApplicationGatewayUrlPathMapPropertiesFormat": { "properties": { "defaultBackendAddressPool": { "$ref": "./network.json#/definitions/SubResource", "description": "Default backend address pool resource of URL path map." }, "defaultBackendHttpSettings": { "$ref": "./network.json#/definitions/SubResource", "description": "Default backend http settings resource of URL path map." }, "defaultRewriteRuleSet": { "$ref": "./network.json#/definitions/SubResource", "description": "Default Rewrite rule set resource of URL path map." }, "defaultRedirectConfiguration": { "$ref": "./network.json#/definitions/SubResource", "description": "Default redirect configuration resource of URL path map." }, "pathRules": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayPathRule" }, "description": "Path rule of URL path map resource." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the URL path map resource." } }, "description": "Properties of UrlPathMap of the application gateway." }, "ApplicationGatewayUrlPathMap": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ApplicationGatewayUrlPathMapPropertiesFormat", "description": "Properties of the application gateway URL path map." }, "name": { "type": "string", "description": "Name of the URL path map that is unique within an Application Gateway." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Type of the resource." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "UrlPathMaps give a url path to the backend mapping information for PathBasedRouting." }, "ApplicationGatewayWebApplicationFirewallConfiguration": { "properties": { "enabled": { "type": "boolean", "description": "Whether the web application firewall is enabled or not." }, "firewallMode": { "type": "string", "description": "Web application firewall mode.", "enum": [ "Detection", "Prevention" ], "x-ms-enum": { "name": "ApplicationGatewayFirewallMode", "modelAsString": true } }, "ruleSetType": { "type": "string", "description": "The type of the web application firewall rule set. Possible values are: 'OWASP'." }, "ruleSetVersion": { "type": "string", "description": "The version of the rule set type." }, "disabledRuleGroups": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayFirewallDisabledRuleGroup" }, "description": "The disabled rule groups." }, "requestBodyCheck": { "type": "boolean", "description": "Whether allow WAF to check request Body." }, "maxRequestBodySize": { "type": "integer", "format": "int32", "maximum": 128, "exclusiveMaximum": false, "minimum": 8, "exclusiveMinimum": false, "description": "Maximum request body size for WAF." }, "maxRequestBodySizeInKb": { "type": "integer", "format": "int32", "maximum": 128, "exclusiveMaximum": false, "minimum": 8, "exclusiveMinimum": false, "description": "Maximum request body size in Kb for WAF." }, "fileUploadLimitInMb": { "type": "integer", "format": "int32", "minimum": 0, "exclusiveMinimum": false, "description": "Maximum file upload size in Mb for WAF." }, "exclusions": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayFirewallExclusion" }, "description": "The exclusion list." } }, "required": [ "enabled", "firewallMode", "ruleSetType", "ruleSetVersion" ], "description": "Application gateway web application firewall configuration." }, "ApplicationGatewayAutoscaleConfiguration": { "properties": { "minCapacity": { "type": "integer", "format": "int32", "minimum": 0, "exclusiveMinimum": false, "description": "Lower bound on number of Application Gateway capacity." }, "maxCapacity": { "type": "integer", "format": "int32", "minimum": 2, "exclusiveMinimum": false, "description": "Upper bound on number of Application Gateway capacity." } }, "required": [ "minCapacity" ], "description": "Application Gateway autoscale configuration." }, "ApplicationGatewayConnectionDraining": { "properties": { "enabled": { "type": "boolean", "description": "Whether connection draining is enabled or not." }, "drainTimeoutInSec": { "type": "integer", "format": "int32", "maximum": 3600, "exclusiveMaximum": false, "minimum": 1, "exclusiveMinimum": false, "description": "The number of seconds connection draining is active. Acceptable values are from 1 second to 3600 seconds." } }, "required": [ "enabled", "drainTimeoutInSec" ], "description": "Connection draining allows open connections to a backend server to be active for a specified time after the backend server got removed from the configuration." }, "ApplicationGatewayFirewallDisabledRuleGroup": { "properties": { "ruleGroupName": { "type": "string", "description": "The name of the rule group that will be disabled." }, "rules": { "type": "array", "items": { "type": "integer", "format": "int32", "x-nullable": false }, "description": "The list of rules that will be disabled. If null, all rules of the rule group will be disabled." } }, "required": [ "ruleGroupName" ], "description": "Allows to disable rules within a rule group or an entire rule group." }, "ApplicationGatewayAvailableServerVariablesResult": { "type": "array", "items": { "type": "string" }, "description": "Response for ApplicationGatewayAvailableServerVariables API service call." }, "ApplicationGatewayAvailableRequestHeadersResult": { "type": "array", "items": { "type": "string" }, "description": "Response for ApplicationGatewayAvailableRequestHeaders API service call." }, "ApplicationGatewayAvailableResponseHeadersResult": { "type": "array", "items": { "type": "string" }, "description": "Response for ApplicationGatewayAvailableResponseHeaders API service call." }, "ApplicationGatewayFirewallExclusion": { "properties": { "matchVariable": { "type": "string", "description": "The variable to be excluded." }, "selectorMatchOperator": { "type": "string", "description": "When matchVariable is a collection, operate on the selector to specify which elements in the collection this exclusion applies to." }, "selector": { "type": "string", "description": "When matchVariable is a collection, operator used to specify which elements in the collection this exclusion applies to." } }, "required": [ "matchVariable", "selectorMatchOperator", "selector" ], "description": "Allow to exclude some variable satisfy the condition for the WAF check." }, "ApplicationGatewayAvailableWafRuleSetsResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayFirewallRuleSet" }, "description": "The list of application gateway rule sets." } }, "description": "Response for ApplicationGatewayAvailableWafRuleSets API service call." }, "ApplicationGatewayFirewallRuleSet": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ApplicationGatewayFirewallRuleSetPropertiesFormat", "description": "Properties of the application gateway firewall rule set." } }, "allOf": [ { "$ref": "./network.json#/definitions/Resource" } ], "description": "A web application firewall rule set." }, "ApplicationGatewayFirewallRuleSetPropertiesFormat": { "properties": { "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the web application firewall rule set." }, "ruleSetType": { "type": "string", "description": "The type of the web application firewall rule set." }, "ruleSetVersion": { "type": "string", "description": "The version of the web application firewall rule set type." }, "ruleGroups": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayFirewallRuleGroup" }, "description": "The rule groups of the web application firewall rule set." } }, "required": [ "ruleSetType", "ruleSetVersion", "ruleGroups" ], "description": "Properties of the web application firewall rule set." }, "ApplicationGatewayFirewallRuleGroup": { "properties": { "ruleGroupName": { "type": "string", "description": "The name of the web application firewall rule group." }, "description": { "type": "string", "description": "The description of the web application firewall rule group." }, "rules": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayFirewallRule" }, "description": "The rules of the web application firewall rule group." } }, "required": [ "ruleGroupName", "rules" ], "description": "A web application firewall rule group." }, "ApplicationGatewayFirewallRule": { "properties": { "ruleId": { "type": "integer", "format": "int32", "description": "The identifier of the web application firewall rule." }, "description": { "type": "string", "description": "The description of the web application firewall rule." } }, "required": [ "ruleId" ], "description": "A web application firewall rule." }, "ApplicationGatewayAvailableSslOptions": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ApplicationGatewayAvailableSslOptionsPropertiesFormat", "description": "Properties of the application gateway available SSL options." } }, "allOf": [ { "$ref": "./network.json#/definitions/Resource" } ], "description": "Response for ApplicationGatewayAvailableSslOptions API service call." }, "ApplicationGatewayAvailableSslOptionsPropertiesFormat": { "properties": { "predefinedPolicies": { "type": "array", "items": { "$ref": "./network.json#/definitions/SubResource" }, "description": "List of available Ssl predefined policy." }, "defaultPolicy": { "$ref": "#/definitions/PolicyNameEnum", "description": "Name of the Ssl predefined policy applied by default to application gateway." }, "availableCipherSuites": { "type": "array", "items": { "$ref": "#/definitions/CipherSuitesEnum" }, "description": "List of available Ssl cipher suites." }, "availableProtocols": { "type": "array", "items": { "$ref": "#/definitions/ProtocolsEnum" }, "description": "List of available Ssl protocols." } }, "description": "Properties of ApplicationGatewayAvailableSslOptions." }, "ApplicationGatewayAvailableSslPredefinedPolicies": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewaySslPredefinedPolicy" }, "description": "List of available Ssl predefined policy." }, "nextLink": { "type": "string", "description": "URL to get the next set of results." } }, "description": "Response for ApplicationGatewayAvailableSslOptions API service call." }, "ApplicationGatewaySslPredefinedPolicy": { "properties": { "name": { "type": "string", "description": "Name of the Ssl predefined policy." }, "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ApplicationGatewaySslPredefinedPolicyPropertiesFormat", "description": "Properties of the application gateway SSL predefined policy." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "An Ssl predefined policy." }, "ApplicationGatewaySslPredefinedPolicyPropertiesFormat": { "properties": { "cipherSuites": { "type": "array", "items": { "$ref": "#/definitions/CipherSuitesEnum" }, "description": "Ssl cipher suites to be enabled in the specified order for application gateway." }, "minProtocolVersion": { "$ref": "#/definitions/ProtocolsEnum", "description": "Minimum version of Ssl protocol to be supported on application gateway." } }, "description": "Properties of ApplicationGatewaySslPredefinedPolicy." }, "ApplicationGatewayCustomError": { "properties": { "statusCode": { "type": "string", "description": "Status code of the application gateway customer error.", "enum": [ "HttpStatus403", "HttpStatus502" ], "x-ms-enum": { "name": "ApplicationGatewayCustomErrorStatusCode", "modelAsString": true } }, "customErrorPageUrl": { "type": "string", "description": "Error page URL of the application gateway customer error." } }, "description": "Customer error of an application gateway." }, "PolicyNameEnum": { "type": "string", "description": "Ssl predefined policy name enums.", "enum": [ "AppGwSslPolicy20150501", "AppGwSslPolicy20170401", "AppGwSslPolicy20170401S" ], "x-ms-enum": { "name": "ApplicationGatewaySslPolicyName", "modelAsString": true } }, "ProtocolsEnum": { "type": "string", "description": "Ssl protocol enums.", "enum": [ "TLSv1_0", "TLSv1_1", "TLSv1_2" ], "x-ms-enum": { "name": "ApplicationGatewaySslProtocol", "modelAsString": true } }, "CipherSuitesEnum": { "type": "string", "description": "Ssl cipher suites enums.", "enum": [ "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384", "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_DHE_RSA_WITH_AES_256_CBC_SHA", "TLS_DHE_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_256_GCM_SHA384", "TLS_RSA_WITH_AES_128_GCM_SHA256", "TLS_RSA_WITH_AES_256_CBC_SHA256", "TLS_RSA_WITH_AES_128_CBC_SHA256", "TLS_RSA_WITH_AES_256_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384", "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256", "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256", "TLS_DHE_DSS_WITH_AES_128_CBC_SHA256", "TLS_DHE_DSS_WITH_AES_256_CBC_SHA", "TLS_DHE_DSS_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_3DES_EDE_CBC_SHA", "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA", "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384" ], "x-ms-enum": { "name": "ApplicationGatewaySslCipherSuite", "modelAsString": true } }, "RedirectTypeEnum": { "type": "string", "description": "Redirect type enum.", "enum": [ "Permanent", "Found", "SeeOther", "Temporary" ], "x-ms-enum": { "name": "ApplicationGatewayRedirectType", "modelAsString": true } }, "ApplicationGatewayProtocol": { "type": "string", "description": "Application Gateway protocol.", "enum": [ "Http", "Https" ], "x-ms-enum": { "name": "ApplicationGatewayProtocol", "modelAsString": true } } } } analysis-0.21.1/fixtures/azure/applicationSecurityGroup.json000066400000000000000000000323511413705513100243640ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "NetworkManagementClient", "description": "The Microsoft Azure Network management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to manage your network resources. The API has entities that capture the relationship between an end user and the Microsoft Azure Networks service.", "version": "2020-04-01" }, "host": "management.azure.com", "schemes": [ "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "security": [ { "azure_auth": [ "user_impersonation" ] } ], "securityDefinitions": { "azure_auth": { "type": "oauth2", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "flow": "implicit", "description": "Azure Active Directory OAuth2 Flow.", "scopes": { "user_impersonation": "impersonate your user account" } } }, "paths": { "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}": { "delete": { "tags": [ "ApplicationSecurityGroups" ], "operationId": "ApplicationSecurityGroups_Delete", "description": "Deletes the specified application security group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "applicationSecurityGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the application security group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "204": { "description": "Request successful. Resource does not exist." }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "200": { "description": "Delete successful." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" }, "x-ms-examples": { "Delete application security group": { "$ref": "./examples/ApplicationSecurityGroupDelete.json" } } }, "get": { "tags": [ "ApplicationSecurityGroups" ], "operationId": "ApplicationSecurityGroups_Get", "description": "Gets information about the specified application security group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "applicationSecurityGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the application security group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns the specified application security group resource.", "schema": { "$ref": "#/definitions/ApplicationSecurityGroup" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Get application security group": { "$ref": "./examples/ApplicationSecurityGroupGet.json" } } }, "put": { "tags": [ "ApplicationSecurityGroups" ], "operationId": "ApplicationSecurityGroups_CreateOrUpdate", "description": "Creates or updates an application security group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "applicationSecurityGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the application security group." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/ApplicationSecurityGroup" }, "description": "Parameters supplied to the create or update ApplicationSecurityGroup operation." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "201": { "description": "Create successful. The operation returns the resulting application security group resource.", "schema": { "$ref": "#/definitions/ApplicationSecurityGroup" } }, "200": { "description": "Update successful. The operation returns the resulting application security group resource.", "schema": { "$ref": "#/definitions/ApplicationSecurityGroup" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" }, "x-ms-examples": { "Create application security group": { "$ref": "./examples/ApplicationSecurityGroupCreate.json" } } }, "patch": { "tags": [ "applicationSecurityGroups" ], "operationId": "ApplicationSecurityGroups_UpdateTags", "description": "Updates an application security group's tags.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "applicationSecurityGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the application security group." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "./network.json#/definitions/TagsObject" }, "description": "Parameters supplied to update application security group tags." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting ApplicationSecurityGroup resource.", "schema": { "$ref": "#/definitions/ApplicationSecurityGroup" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Update application security group tags": { "$ref": "./examples/ApplicationSecurityGroupUpdateTags.json" } } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationSecurityGroups": { "get": { "tags": [ "ApplicationSecurityGroups" ], "operationId": "ApplicationSecurityGroups_ListAll", "description": "Gets all application security groups in a subscription.", "parameters": [ { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of application security group resources.", "schema": { "$ref": "#/definitions/ApplicationSecurityGroupListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-pageable": { "nextLinkName": "nextLink" }, "x-ms-examples": { "List all application security groups": { "$ref": "./examples/ApplicationSecurityGroupListAll.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups": { "get": { "tags": [ "ApplicationSecurityGroups" ], "operationId": "ApplicationSecurityGroups_List", "description": "Gets all the application security groups in a resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of application security group resources.", "schema": { "$ref": "#/definitions/ApplicationSecurityGroupListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "List load balancers in resource group": { "$ref": "./examples/ApplicationSecurityGroupList.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } } }, "definitions": { "ApplicationSecurityGroup": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ApplicationSecurityGroupPropertiesFormat", "description": "Properties of the application security group." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/Resource" } ], "description": "An application security group in a resource group." }, "ApplicationSecurityGroupPropertiesFormat": { "properties": { "resourceGuid": { "readOnly": true, "type": "string", "description": "The resource GUID property of the application security group resource. It uniquely identifies a resource, even if the user changes its name or migrate the resource across subscriptions or resource groups." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the application security group resource." } }, "description": "Application security group properties." }, "ApplicationSecurityGroupListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/ApplicationSecurityGroup" }, "description": "A list of application security groups." }, "nextLink": { "readOnly": true, "type": "string", "description": "The URL to get the next set of results." } }, "description": "A list of application security groups." } } } analysis-0.21.1/fixtures/azure/examples/000077500000000000000000000000001413705513100202335ustar00rootroot00000000000000analysis-0.21.1/fixtures/azure/examples/NetworkInterfaceCreate.json000066400000000000000000000071201413705513100255240ustar00rootroot00000000000000{ "parameters": { "api-version": "2020-04-01", "subscriptionId": "subid", "resourceGroupName": "rg1", "networkInterfaceName": "test-nic", "parameters": { "properties": { "enableAcceleratedNetworking": true, "ipConfigurations": [ { "name": "ipconfig1", "properties": { "publicIPAddress": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip" }, "subnet": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default" } } } ] }, "location": "eastus" } }, "responses": { "200": { "body": { "name": "test-nic", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic", "location": "eastus", "properties": { "provisioningState": "Succeeded", "ipConfigurations": [ { "name": "ipconfig1", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic/ipConfigurations/ipconfig1", "properties": { "provisioningState": "Succeeded", "privateIPAddress": "172.20.2.4", "privateIPAllocationMethod": "Dynamic", "publicIPAddress": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip" }, "subnet": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default" }, "primary": true, "privateIPAddressVersion": "IPv4" } } ], "dnsSettings": { "dnsServers": [], "appliedDnsServers": [] }, "enableAcceleratedNetworking": true, "enableIPForwarding": false }, "type": "Microsoft.Network/networkInterfaces" } }, "201": { "body": { "name": "test-nic", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic", "location": "eastus", "properties": { "provisioningState": "Succeeded", "ipConfigurations": [ { "name": "ipconfig1", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic/ipConfigurations/ipconfig1", "properties": { "provisioningState": "Succeeded", "privateIPAddress": "172.20.2.4", "privateIPAllocationMethod": "Dynamic", "publicIPAddress": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip" }, "subnet": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default" }, "primary": true, "privateIPAddressVersion": "IPv4" } } ], "dnsSettings": { "dnsServers": [], "appliedDnsServers": [] }, "enableAcceleratedNetworking": true, "enableIPForwarding": false }, "type": "Microsoft.Network/networkInterfaces" } } } } analysis-0.21.1/fixtures/azure/examples/NetworkInterfaceDelete.json000066400000000000000000000003431413705513100255230ustar00rootroot00000000000000{ "parameters": { "api-version": "2020-04-01", "subscriptionId": "subid", "resourceGroupName": "rg1", "networkInterfaceName": "test-nic" }, "responses": { "200": {}, "202": {}, "204": {} } } analysis-0.21.1/fixtures/azure/examples/NetworkInterfaceEffectiveNSGList.json000066400000000000000000000045761413705513100274410ustar00rootroot00000000000000{ "parameters": { "api-version": "2020-04-01", "subscriptionId": "subid", "resourceGroupName": "rg1", "networkInterfaceName": "nic1" }, "responses": { "200": { "body": { "value": [ { "networkSecurityGroup": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/test-nsg" }, "association": { "subnet": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default" }, "networkInterface": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/nic1" } }, "effectiveSecurityRules": [ { "name": "securityRules/rule1", "protocol": "Tcp", "sourcePortRange": "456-456", "destinationPortRange": "6579-6579", "sourceAddressPrefix": "0.0.0.0/32", "destinationAddressPrefix": "0.0.0.0/32", "access": "Allow", "priority": 234, "direction": "Inbound" }, { "name": "securityRules/default-allow-rdp", "protocol": "Tcp", "sourcePortRange": "0-65535", "destinationPortRange": "3389-3389", "sourceAddressPrefix": "1.1.1.1/32", "destinationAddressPrefix": "0.0.0.0/0", "access": "Allow", "priority": 1000, "direction": "Inbound" }, { "name": "defaultSecurityRules/AllowInternetOutBound", "protocol": "All", "sourcePortRange": "0-65535", "destinationPortRange": "0-65535", "sourceAddressPrefix": "0.0.0.0/0", "destinationAddressPrefix": "Internet", "expandedDestinationAddressPrefix": [ "32.0.0.0/3", "4.0.0.0/6", "2.0.0.0/7", "1.0.0.0/8" ], "access": "Allow", "priority": 65001, "direction": "Outbound" } ] } ] } }, "202": {} } } analysis-0.21.1/fixtures/azure/examples/NetworkInterfaceEffectiveRouteTableList.json000066400000000000000000000032161413705513100310460ustar00rootroot00000000000000{ "parameters": { "api-version": "2020-04-01", "subscriptionId": "subid", "resourceGroupName": "rg1", "networkInterfaceName": "nic1" }, "responses": { "200": { "body": { "value": [ { "source": "Default", "state": "Active", "addressPrefix": [ "172.20.2.0/24" ], "nextHopType": "VnetLocal", "nextHopIpAddress": [] }, { "source": "Default", "state": "Active", "addressPrefix": [ "0.0.0.0/0" ], "nextHopType": "Internet", "nextHopIpAddress": [] }, { "source": "Default", "state": "Active", "addressPrefix": [ "10.0.0.0/8" ], "nextHopType": "None", "nextHopIpAddress": [] }, { "source": "Default", "state": "Active", "addressPrefix": [ "100.64.0.0/10" ], "nextHopType": "None", "nextHopIpAddress": [] }, { "source": "Default", "state": "Active", "addressPrefix": [ "172.16.0.0/12" ], "nextHopType": "None", "nextHopIpAddress": [] }, { "source": "Default", "state": "Active", "addressPrefix": [ "192.168.0.0/16" ], "nextHopType": "None", "nextHopIpAddress": [] } ] } }, "202": {} } } analysis-0.21.1/fixtures/azure/examples/NetworkInterfaceGet.json000066400000000000000000000040331413705513100250400ustar00rootroot00000000000000{ "parameters": { "api-version": "2020-04-01", "subscriptionId": "subid", "resourceGroupName": "rg1", "networkInterfaceName": "test-nic" }, "responses": { "200": { "body": { "name": "test-nic", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic", "location": "eastus", "properties": { "provisioningState": "Succeeded", "ipConfigurations": [ { "name": "ipconfig1", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic/ipConfigurations/ipconfig1", "properties": { "provisioningState": "Succeeded", "privateIPAddress": "172.20.2.4", "privateIPAllocationMethod": "Dynamic", "publicIPAddress": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip" }, "subnet": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default" }, "primary": true, "privateIPAddressVersion": "IPv4" } } ], "dnsSettings": { "dnsServers": [], "appliedDnsServers": [], "internalDomainNameSuffix": "test.bx.internal.cloudapp.net" }, "macAddress": "00-0D-3A-1B-C7-21", "enableAcceleratedNetworking": true, "enableIPForwarding": false, "networkSecurityGroup": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg" }, "primary": true, "virtualMachine": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1" } }, "type": "Microsoft.Network/networkInterfaces" } } } } analysis-0.21.1/fixtures/azure/examples/NetworkInterfaceIPConfigurationGet.json000066400000000000000000000032331413705513100300220ustar00rootroot00000000000000{ "parameters": { "subscriptionId": "subid", "resourceGroupName": "testrg", "networkInterfaceName": "mynic", "ipConfigurationName": "ipconfig1", "api-version": "2020-04-01" }, "responses": { "200": { "body": { "name": "ipconfig1", "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkInterfaces/mynic/ipConfigurations/ipconfig1", "etag": "W/\\\"00000000-0000-0000-0000-000000000000\\\"", "properties": { "provisioningState": "Succeeded", "privateIPAddress": "10.0.1.4", "privateIPAllocationMethod": "Dynamic", "subnet": { "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/myVirtualNetwork/subnets/frontendSubnet" }, "privateIPAddressVersion": "IPv4", "loadBalancerBackendAddressPools": [ { "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/backendAddressPools/bepool1" } ], "loadBalancerInboundNatRules": [ { "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/inboundNatRules/inbound1" } ], "virtualNetworkTaps": [ { "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworkTaps/vTAP1" }, { "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworkTaps/vTAP2" } ] } } } } } analysis-0.21.1/fixtures/azure/examples/NetworkInterfaceIPConfigurationList.json000066400000000000000000000017121413705513100302160ustar00rootroot00000000000000{ "parameters": { "subscriptionId": "subid", "resourceGroupName": "testrg", "networkInterfaceName": "nic1", "api-version": "2020-04-01" }, "responses": { "200": { "body": { "value": [ { "name": "ipconfig1", "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkInterfaces/nic1/ipConfigurations/ipconfig1", "etag": "W/\\\"00000000-0000-0000-0000-000000000000\\\"", "properties": { "provisioningState": "Succeeded", "privateIPAddress": "10.0.0.4", "privateIPAllocationMethod": "Dynamic", "subnet": { "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet12/subnets/subnet12" }, "primary": true, "privateIPAddressVersion": "IPv4" } } ] } } } } analysis-0.21.1/fixtures/azure/examples/NetworkInterfaceList.json000066400000000000000000000073301413705513100252370ustar00rootroot00000000000000{ "parameters": { "api-version": "2020-04-01", "subscriptionId": "subid", "resourceGroupName": "rg1" }, "responses": { "200": { "body": { "value": [ { "name": "test-nic", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic", "location": "eastus", "properties": { "provisioningState": "Succeeded", "ipConfigurations": [ { "name": "ipconfig1", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic/ipConfigurations/ipconfig1", "properties": { "provisioningState": "Succeeded", "privateIPAddress": "172.20.2.4", "privateIPAllocationMethod": "Dynamic", "publicIPAddress": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip" }, "subnet": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default" }, "primary": true, "privateIPAddressVersion": "IPv4" } } ], "dnsSettings": { "dnsServers": [], "appliedDnsServers": [], "internalDomainNameSuffix": "test.bx.internal.cloudapp.net" }, "macAddress": "00-0D-3A-1B-C7-21", "enableAcceleratedNetworking": true, "enableIPForwarding": false, "networkSecurityGroup": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg" }, "primary": true, "virtualMachine": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1" } }, "type": "Microsoft.Network/networkInterfaces" }, { "name": "test-nic2", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic2", "location": "eastus", "properties": { "provisioningState": "Succeeded", "ipConfigurations": [ { "name": "ipconfig1", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic2/ipConfigurations/ipconfig1", "properties": { "provisioningState": "Succeeded", "privateIPAddress": "172.20.2.4", "privateIPAllocationMethod": "Dynamic", "publicIPAddress": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip2" }, "subnet": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet2/subnets/default" }, "primary": true, "privateIPAddressVersion": "IPv4" } } ], "dnsSettings": { "dnsServers": [], "appliedDnsServers": [] }, "enableAcceleratedNetworking": true, "enableIPForwarding": false }, "type": "Microsoft.Network/networkInterfaces" } ] } } } } analysis-0.21.1/fixtures/azure/examples/NetworkInterfaceListAll.json000066400000000000000000000073021413705513100256670ustar00rootroot00000000000000{ "parameters": { "api-version": "2020-04-01", "subscriptionId": "subid" }, "responses": { "200": { "body": { "value": [ { "name": "test-nic", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic", "location": "eastus", "properties": { "provisioningState": "Succeeded", "ipConfigurations": [ { "name": "ipconfig1", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic/ipConfigurations/ipconfig1", "properties": { "provisioningState": "Succeeded", "privateIPAddress": "172.20.2.4", "privateIPAllocationMethod": "Dynamic", "publicIPAddress": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip" }, "subnet": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default" }, "primary": true, "privateIPAddressVersion": "IPv4" } } ], "dnsSettings": { "dnsServers": [], "appliedDnsServers": [], "internalDomainNameSuffix": "test.bx.internal.cloudapp.net" }, "macAddress": "00-0D-3A-1B-C7-21", "enableAcceleratedNetworking": true, "enableIPForwarding": false, "networkSecurityGroup": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg" }, "primary": true, "virtualMachine": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1" } }, "type": "Microsoft.Network/networkInterfaces" }, { "name": "test-nic2", "id": "/subscriptions/subid/resourceGroups/rgnew/providers/Microsoft.Network/networkInterfaces/test-nic2", "location": "eastus", "properties": { "provisioningState": "Succeeded", "ipConfigurations": [ { "name": "ipconfig1", "id": "/subscriptions/subid/resourceGroups/rgnew/providers/Microsoft.Network/networkInterfaces/test-nic2/ipConfigurations/ipconfig1", "properties": { "provisioningState": "Succeeded", "privateIPAddress": "172.20.2.4", "privateIPAllocationMethod": "Dynamic", "publicIPAddress": { "id": "/subscriptions/subid/resourceGroups/rgnew/providers/Microsoft.Network/publicIPAddresses/test-ip2" }, "subnet": { "id": "/subscriptions/subid/resourceGroups/rgnew/providers/Microsoft.Network/virtualNetworks/rgnew-vnet2/subnets/default" }, "primary": true, "privateIPAddressVersion": "IPv4" } } ], "dnsSettings": { "dnsServers": [], "appliedDnsServers": [] }, "enableAcceleratedNetworking": true, "enableIPForwarding": false }, "type": "Microsoft.Network/networkInterfaces" } ] } } } } analysis-0.21.1/fixtures/azure/examples/NetworkInterfaceLoadBalancerList.json000066400000000000000000000145031413705513100274670ustar00rootroot00000000000000{ "parameters": { "subscriptionId": "subid", "resourceGroupName": "testrg", "networkInterfaceName": "nic1", "api-version": "2020-04-01" }, "responses": { "200": { "body": { "value": [ { "name": "lbname1", "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1", "etag": "W/\\\"00000000-0000-0000-0000-000000000000\\\"", "type": "Microsoft.Network/loadBalancers", "location": "westus", "properties": { "provisioningState": "Succeeded", "resourceGuid": "00000000-0000-0000-0000-000000000000", "frontendIPConfigurations": [ { "name": "lbfrontend", "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/frontendIPConfigurations/lbfrontend", "etag": "W/\\\"00000000-0000-0000-0000-000000000000\\\"", "properties": { "provisioningState": "Succeeded", "privateIPAllocationMethod": "Dynamic", "publicIPAddress": { "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/publicIPAddresses/myDynamicPublicIP" }, "loadBalancingRules": [ { "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/loadBalancingRules/rule1" } ], "inboundNatRules": [ { "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/inboundNatRules/inbound1" } ] } } ], "backendAddressPools": [ { "name": "bepool1", "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/backendAddressPools/bepool1", "etag": "W/\\\"00000000-0000-0000-0000-000000000000\\\"", "properties": { "provisioningState": "Succeeded", "backendIPConfigurations": [ { "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkInterfaces/nic1/ipConfigurations/ipconfig1" } ], "loadBalancingRules": [ { "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/loadBalancingRules/rule1" } ] } } ], "loadBalancingRules": [ { "name": "rule1", "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/loadBalancingRules/rule1", "etag": "W/\\\"00000000-0000-0000-0000-000000000000\\\"", "properties": { "provisioningState": "Succeeded", "frontendIPConfiguration": { "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/frontendIPConfigurations/lbfrontend" }, "frontendPort": 80, "backendPort": 80, "enableFloatingIP": false, "idleTimeoutInMinutes": 15, "protocol": "Tcp", "loadDistribution": "Default", "backendAddressPool": { "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/backendAddressPools/bepool1" }, "probe": { "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/probes/probe1" } } } ], "probes": [ { "name": "probe1", "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/probes/probe1", "etag": "W/\\\"00000000-0000-0000-0000-000000000000\\\"", "properties": { "provisioningState": "Succeeded", "protocol": "Http", "port": 80, "requestPath": "healthcheck.aspx", "intervalInSeconds": 15, "numberOfProbes": 2, "loadBalancingRules": [ { "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/loadBalancingRules/rule1" } ] } } ], "inboundNatRules": [ { "name": "inbound1", "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/inboundNatRules/inbound1", "etag": "W/\\\"00000000-0000-0000-0000-000000000000\\\"", "properties": { "provisioningState": "Succeeded", "frontendIPConfiguration": { "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/frontendIPConfigurations/lbfrontend" }, "frontendPort": 3389, "backendPort": 3389, "enableFloatingIP": false, "idleTimeoutInMinutes": 15, "protocol": "Tcp", "backendIPConfiguration": { "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkInterfaces/nic1/ipConfigurations/ipconfig1" } } } ], "outboundRules": [], "inboundNatPools": [] } } ] } } } } analysis-0.21.1/fixtures/azure/examples/NetworkInterfaceTapConfigurationCreate.json000066400000000000000000000030741413705513100307250ustar00rootroot00000000000000{ "parameters": { "subscriptionId": "subid", "resourceGroupName": "testrg", "networkInterfaceName": "mynic", "tapConfigurationName": "tapconfiguration1", "api-version": "2020-04-01", "tapConfigurationParameters": { "properties": { "virtualNetworkTap": { "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworkTaps/testvtap" } } } }, "responses": { "200": { "body": { "name": "tapConfiguration1", "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkInterfaces/mynic/tapConfigurations/tapConfiguration1", "etag": "etag", "type": "Microsoft.Network/networkInterfaces/tapConfigurations", "properties": { "virtualNetworkTap": { "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworkTaps/testvtap" }, "provisioningState": "Succeded" } } }, "201": { "body": { "name": "tapConfiguration1", "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkInterfaces/mynic/tapConfigurations/tapConfiguration1", "etag": "etag", "type": "Microsoft.Network/networkInterfaces/tapConfigurations", "properties": { "virtualNetworkTap": { "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworkTaps/testvtap" }, "provisioningState": "Succeded" } } } } } analysis-0.21.1/fixtures/azure/examples/NetworkInterfaceTapConfigurationDelete.json000066400000000000000000000004451413705513100307230ustar00rootroot00000000000000{ "parameters": { "api-version": "2020-04-01", "subscriptionId": "subid", "resourceGroupName": "rg1", "networkInterfaceName": "test-networkinterface", "tapConfigurationName": "test-tapconfiguration" }, "responses": { "200": {}, "202": {}, "204": {} } } analysis-0.21.1/fixtures/azure/examples/NetworkInterfaceTapConfigurationGet.json000066400000000000000000000014361413705513100302410ustar00rootroot00000000000000{ "parameters": { "subscriptionId": "subid", "resourceGroupName": "testrg", "networkInterfaceName": "mynic", "tapConfigurationName": "tapconfiguration1", "api-version": "2020-04-01" }, "responses": { "200": { "body": { "name": "tapConfiguration1", "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkInterfaces/mynic/tapConfigurations/tapConfiguration1", "etag": "etag", "type": "Microsoft.Network/networkInterfaces/tapConfigurations", "properties": { "virtualNetworkTap": { "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworkTaps/testvtap" }, "provisioningState": "Succeded" } } } } } analysis-0.21.1/fixtures/azure/examples/NetworkInterfaceTapConfigurationList.json000066400000000000000000000015071413705513100304340ustar00rootroot00000000000000{ "parameters": { "api-version": "2020-04-01", "subscriptionId": "subid", "resourceGroupName": "rg1", "networkInterfaceName": "mynic" }, "responses": { "200": { "body": { "value": [ { "name": "tapConfiguration1", "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkInterfaces/mynic/tapConfigurations/tapConfiguration1", "etag": "etag", "type": "Microsoft.Network/networkInterfaces/tapConfigurations", "properties": { "virtualNetworkTap": { "id": "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworkTaps/testvtap" }, "provisioningState": "Succeded" } } ] } } } } analysis-0.21.1/fixtures/azure/examples/NetworkInterfaceUpdateTags.json000066400000000000000000000034121413705513100263620ustar00rootroot00000000000000{ "parameters": { "api-version": "2020-04-01", "subscriptionId": "subid", "resourceGroupName": "rg1", "networkInterfaceName": "test-nic", "parameters": { "tags": { "tag1": "value1", "tag2": "value2" } } }, "responses": { "200": { "body": { "name": "test-nic", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic", "location": "eastus", "tags": { "tag1": "value1", "tag2": "value2" }, "properties": { "provisioningState": "Succeeded", "ipConfigurations": [ { "name": "ipconfig1", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic/ipConfigurations/ipconfig1", "properties": { "provisioningState": "Succeeded", "privateIPAddress": "172.20.2.4", "privateIPAllocationMethod": "Dynamic", "publicIPAddress": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip" }, "subnet": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default" }, "primary": true, "privateIPAddressVersion": "IPv4" } } ], "dnsSettings": { "dnsServers": [], "appliedDnsServers": [] }, "enableAcceleratedNetworking": true, "enableIPForwarding": false }, "type": "Microsoft.Network/networkInterfaces" } } } } analysis-0.21.1/fixtures/azure/examples/PublicIpAddressCreateCustomizedValues.json000066400000000000000000000037231413705513100305230ustar00rootroot00000000000000{ "parameters": { "api-version": "2020-04-01", "subscriptionId": "subid", "resourceGroupName": "rg1", "publicIpAddressName": "test-ip", "zones": [ "1" ], "parameters": { "properties": { "publicIPAllocationMethod": "Static", "idleTimeoutInMinutes": 10, "publicIPAddressVersion": "IPv4" }, "sku": { "name": "Standard" }, "location": "eastus" } }, "responses": { "200": { "body": { "name": "testDNS-ip", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip", "location": "eastus", "zones": [ "1" ], "properties": { "provisioningState": "Succeeded", "publicIPAddressVersion": "IPv4", "publicIPAllocationMethod": "Static", "idleTimeoutInMinutes": 10, "ipConfiguration": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testDNS649/ipConfigurations/ipconfig1" } }, "sku": { "name": "Standard" }, "type": "Microsoft.Network/publicIPAddresses" } }, "201": { "body": { "name": "testDNS-ip", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip", "location": "eastus", "zones": [ "1" ], "properties": { "provisioningState": "Succeeded", "publicIPAddressVersion": "IPv4", "publicIPAllocationMethod": "Static", "idleTimeoutInMinutes": 10, "ipConfiguration": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testDNS649/ipConfigurations/ipconfig1" } }, "sku": { "name": "Standard" }, "type": "Microsoft.Network/publicIPAddresses" } } } } analysis-0.21.1/fixtures/azure/examples/PublicIpAddressCreateDefaults.json000066400000000000000000000032101413705513100267530ustar00rootroot00000000000000{ "parameters": { "api-version": "2020-04-01", "subscriptionId": "subid", "resourceGroupName": "rg1", "publicIpAddressName": "test-ip", "parameters": { "location": "eastus" } }, "responses": { "200": { "body": { "name": "testDNS-ip", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip", "location": "eastus", "properties": { "provisioningState": "Succeeded", "publicIPAddressVersion": "IPv4", "publicIPAllocationMethod": "Dynamic", "idleTimeoutInMinutes": 4, "ipConfiguration": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testDNS649/ipConfigurations/ipconfig1" } }, "sku": { "name": "Basic" }, "type": "Microsoft.Network/publicIPAddresses" } }, "201": { "body": { "name": "testDNS-ip", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip", "location": "eastus", "properties": { "provisioningState": "Succeeded", "publicIPAddressVersion": "IPv4", "publicIPAllocationMethod": "Dynamic", "idleTimeoutInMinutes": 4, "ipConfiguration": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testDNS649/ipConfigurations/ipconfig1" } }, "sku": { "name": "Basic" }, "type": "Microsoft.Network/publicIPAddresses" } } } } analysis-0.21.1/fixtures/azure/examples/PublicIpAddressCreateDns.json000066400000000000000000000036241413705513100257410ustar00rootroot00000000000000{ "parameters": { "api-version": "2020-04-01", "subscriptionId": "subid", "resourceGroupName": "rg1", "publicIpAddressName": "test-ip", "parameters": { "properties": { "dnsSettings": { "domainNameLabel": "dnslbl" } }, "location": "eastus" } }, "responses": { "200": { "body": { "name": "testDNS-ip", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip", "location": "eastus", "properties": { "provisioningState": "Succeeded", "publicIPAddressVersion": "IPv4", "publicIPAllocationMethod": "Dynamic", "idleTimeoutInMinutes": 4, "dnsSettings": { "domainNameLabel": "dnslbl", "fqdn": "dnslbl.westus.cloudapp.azure.com" }, "ipConfiguration": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testDNS649/ipConfigurations/ipconfig1" } }, "type": "Microsoft.Network/publicIPAddresses" } }, "201": { "body": { "name": "testDNS-ip", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip", "location": "eastus", "properties": { "provisioningState": "Succeeded", "publicIPAddressVersion": "IPv4", "publicIPAllocationMethod": "Dynamic", "idleTimeoutInMinutes": 4, "dnsSettings": { "domainNameLabel": "dnslbl", "fqdn": "dnslbl.westus.cloudapp.azure.com" }, "ipConfiguration": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testDNS649/ipConfigurations/ipconfig1" } }, "type": "Microsoft.Network/publicIPAddresses" } } } } analysis-0.21.1/fixtures/azure/examples/PublicIpAddressDelete.json000066400000000000000000000003411413705513100252640ustar00rootroot00000000000000{ "parameters": { "api-version": "2020-04-01", "subscriptionId": "subid", "resourceGroupName": "rg1", "publicIpAddressName": "test-ip" }, "responses": { "200": {}, "202": {}, "204": {} } } analysis-0.21.1/fixtures/azure/examples/PublicIpAddressGet.json000066400000000000000000000021051413705513100246010ustar00rootroot00000000000000{ "parameters": { "api-version": "2020-04-01", "subscriptionId": "subid", "resourceGroupName": "rg1", "publicIpAddressName": "testDNS-ip" }, "responses": { "200": { "body": { "name": "testDNS-ip", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/testDNS-ip", "location": "westus", "properties": { "provisioningState": "Succeeded", "publicIPAddressVersion": "IPv4", "publicIPAllocationMethod": "Dynamic", "idleTimeoutInMinutes": 4, "ipConfiguration": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testDNS649/ipConfigurations/ipconfig1" }, "ipTags": [ { "ipTagType": "FirstPartyUsage", "tag": "SQL" }, { "ipTagType": "FirstPartyUsage", "tag": "Storage" } ] }, "type": "Microsoft.Network/publicIPAddresses" } } } } analysis-0.21.1/fixtures/azure/examples/PublicIpAddressList.json000066400000000000000000000040571413705513100250050ustar00rootroot00000000000000{ "parameters": { "api-version": "2020-04-01", "subscriptionId": "subid", "resourceGroupName": "rg1" }, "responses": { "200": { "body": { "value": [ { "name": "testDNS-ip", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/testDNS-ip", "location": "westus", "properties": { "provisioningState": "Succeeded", "publicIPAddressVersion": "IPv4", "publicIPAllocationMethod": "Dynamic", "idleTimeoutInMinutes": 4, "ipConfiguration": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testDNS649/ipConfigurations/ipconfig1" }, "ipTags": [ { "ipTagType": "FirstPartyUsage", "tag": "SQL" }, { "ipTagType": "FirstPartyUsage", "tag": "Storage" } ] }, "type": "Microsoft.Network/publicIPAddresses" }, { "name": "ip03", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/ip03", "location": "westus", "properties": { "provisioningState": "Succeeded", "ipAddress": "40.85.154.247", "publicIPAddressVersion": "IPv4", "publicIPAllocationMethod": "Dynamic", "idleTimeoutInMinutes": 4, "dnsSettings": { "domainNameLabel": "testlbl", "fqdn": "testlbl.westus.cloudapp.azure.com" }, "ipConfiguration": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/testLb/frontendIPConfigurations/LoadBalancerFrontEnd" } }, "type": "Microsoft.Network/publicIPAddresses" } ] } } } } analysis-0.21.1/fixtures/azure/examples/PublicIpAddressListAll.json000066400000000000000000000033651413705513100254370ustar00rootroot00000000000000{ "parameters": { "api-version": "2020-04-01", "subscriptionId": "subid" }, "responses": { "200": { "body": { "value": [ { "name": "testDNS-ip", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/testDNS-ip", "location": "westus", "properties": { "provisioningState": "Succeeded", "publicIPAddressVersion": "IPv4", "publicIPAllocationMethod": "Dynamic", "idleTimeoutInMinutes": 4, "ipConfiguration": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testDNS649/ipConfigurations/ipconfig1" } }, "type": "Microsoft.Network/publicIPAddresses" }, { "name": "ip01", "id": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/publicIPAddresses/ip01", "location": "westus", "properties": { "provisioningState": "Succeeded", "ipAddress": "40.85.154.247", "publicIPAddressVersion": "IPv4", "publicIPAllocationMethod": "Dynamic", "idleTimeoutInMinutes": 4, "dnsSettings": { "domainNameLabel": "testlbl", "fqdn": "testlbl.westus.cloudapp.azure.com" }, "ipConfiguration": { "id": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/loadBalancers/testLb/frontendIPConfigurations/LoadBalancerFrontEnd" } }, "type": "Microsoft.Network/publicIPAddresses" } ] } } } } analysis-0.21.1/fixtures/azure/examples/PublicIpAddressUpdateTags.json000066400000000000000000000020071413705513100261240ustar00rootroot00000000000000{ "parameters": { "api-version": "2020-04-01", "subscriptionId": "subid", "resourceGroupName": "rg1", "publicIpAddressName": "test-ip", "parameters": { "tags": { "tag1": "value1", "tag2": "value2" } } }, "responses": { "200": { "body": { "name": "testDNS-ip", "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip", "location": "westus", "properties": { "provisioningState": "Succeeded", "publicIPAddressVersion": "IPv4", "publicIPAllocationMethod": "Static", "idleTimeoutInMinutes": 10, "ipConfiguration": { "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testDNS649/ipConfigurations/ipconfig1" } }, "tags": { "tag1": "value1", "tag2": "value2" }, "type": "Microsoft.Network/publicIPAddresses" } } } } analysis-0.21.1/fixtures/azure/loadBalancer.json000066400000000000000000002316621413705513100216710ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "NetworkManagementClient", "description": "The Microsoft Azure Network management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to manage your network resources. The API has entities that capture the relationship between an end user and the Microsoft Azure Networks service.", "version": "2020-04-01" }, "host": "management.azure.com", "schemes": [ "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "security": [ { "azure_auth": [ "user_impersonation" ] } ], "securityDefinitions": { "azure_auth": { "type": "oauth2", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "flow": "implicit", "description": "Azure Active Directory OAuth2 Flow.", "scopes": { "user_impersonation": "impersonate your user account" } } }, "paths": { "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}": { "delete": { "tags": [ "LoadBalancers" ], "operationId": "LoadBalancers_Delete", "description": "Deletes the specified load balancer.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "loadBalancerName", "in": "path", "required": true, "type": "string", "description": "The name of the load balancer." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "204": { "description": "Request successful. Resource does not exist." }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "200": { "description": "Delete successful." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Delete load balancer": { "$ref": "./examples/LoadBalancerDelete.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } }, "get": { "tags": [ "LoadBalancers" ], "operationId": "LoadBalancers_Get", "description": "Gets the specified load balancer.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "loadBalancerName", "in": "path", "required": true, "type": "string", "description": "The name of the load balancer." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" }, { "name": "$expand", "in": "query", "required": false, "type": "string", "description": "Expands referenced resources." } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting LoadBalancer resource.", "schema": { "$ref": "#/definitions/LoadBalancer" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Get load balancer": { "$ref": "./examples/LoadBalancerGet.json" } } }, "put": { "tags": [ "LoadBalancers" ], "operationId": "LoadBalancers_CreateOrUpdate", "description": "Creates or updates a load balancer.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "loadBalancerName", "in": "path", "required": true, "type": "string", "description": "The name of the load balancer." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/LoadBalancer" }, "description": "Parameters supplied to the create or update load balancer operation." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "201": { "description": "Create successful. The operation returns the resulting LoadBalancer resource.", "schema": { "$ref": "#/definitions/LoadBalancer" } }, "200": { "description": "Update successful. The operation returns the resulting LoadBalancer resource.", "schema": { "$ref": "#/definitions/LoadBalancer" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Create load balancer": { "$ref": "./examples/LoadBalancerCreate.json" }, "Create load balancer with Standard SKU": { "$ref": "./examples/LoadBalancerCreateStandardSku.json" }, "Create load balancer with Frontend IP in Zone 1": { "$ref": "./examples/LoadBalancerCreateWithZones.json" }, "Create load balancer with inbound nat pool": { "$ref": "./examples/LoadBalancerCreateWithInboundNatPool.json" }, "Create load balancer with outbound rules": { "$ref": "./examples/LoadBalancerCreateWithOutboundRules.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" } }, "patch": { "tags": [ "LoadBalancers" ], "operationId": "LoadBalancers_UpdateTags", "description": "Updates a load balancer tags.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "loadBalancerName", "in": "path", "required": true, "type": "string", "description": "The name of the load balancer." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "./network.json#/definitions/TagsObject" }, "description": "Parameters supplied to update load balancer tags." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting LoadBalancer resource.", "schema": { "$ref": "#/definitions/LoadBalancer" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Update load balancer tags": { "$ref": "./examples/LoadBalancerUpdateTags.json" } } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/loadBalancers": { "get": { "tags": [ "LoadBalancers" ], "operationId": "LoadBalancers_ListAll", "description": "Gets all the load balancers in a subscription.", "parameters": [ { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of LoadBalancer resources.", "schema": { "$ref": "#/definitions/LoadBalancerListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "List all load balancers": { "$ref": "./examples/LoadBalancerListAll.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers": { "get": { "tags": [ "LoadBalancers" ], "operationId": "LoadBalancers_List", "description": "Gets all the load balancers in a resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of LoadBalancer resources.", "schema": { "$ref": "#/definitions/LoadBalancerListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "List load balancers in resource group": { "$ref": "./examples/LoadBalancerList.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools": { "get": { "tags": [ "LoadBalancers" ], "operationId": "LoadBalancerBackendAddressPools_List", "description": "Gets all the load balancer backed address pools.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "loadBalancerName", "in": "path", "required": true, "type": "string", "description": "The name of the load balancer." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of LoadBalancer BackendAddressPool resources.", "schema": { "$ref": "#/definitions/LoadBalancerBackendAddressPoolListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "LoadBalancerBackendAddressPoolList": { "$ref": "./examples/LoadBalancerBackendAddressPoolList.json" }, "Load balancer with BackendAddressPool containing BackendAddresses": { "$ref": "./examples/LBBackendAddressPoolListWithBackendAddressesPoolType.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}": { "get": { "tags": [ "LoadBalancers" ], "operationId": "LoadBalancerBackendAddressPools_Get", "description": "Gets load balancer backend address pool.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "loadBalancerName", "in": "path", "required": true, "type": "string", "description": "The name of the load balancer." }, { "name": "backendAddressPoolName", "in": "path", "required": true, "type": "string", "description": "The name of the backend address pool." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns LoadBalancer BackendAddressPool resource.", "schema": { "$ref": "#/definitions/BackendAddressPool" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "LoadBalancerBackendAddressPoolGet": { "$ref": "./examples/LoadBalancerBackendAddressPoolGet.json" }, "LoadBalancer with BackendAddressPool with BackendAddresses": { "$ref": "./examples/LBBackendAddressPoolWithBackendAddressesGet.json" } } }, "put": { "tags": [ "LoadBalancers" ], "operationId": "LoadBalancerBackendAddressPools_CreateOrUpdate", "description": "Creates or updates a load balancer backend address pool.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "loadBalancerName", "in": "path", "required": true, "type": "string", "description": "The name of the load balancer." }, { "name": "backendAddressPoolName", "in": "path", "required": true, "type": "string", "description": "The name of the backend address pool." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/BackendAddressPool" }, "description": "Parameters supplied to the create or update load balancer backend address pool operation." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "201": { "description": "Create successful. The operation returns the resulting BackendAddressPool resource.", "schema": { "$ref": "#/definitions/BackendAddressPool" } }, "200": { "description": "Update successful. The operation returns the resulting BackendAddressPool resource.", "schema": { "$ref": "#/definitions/BackendAddressPool" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Update load balancer backend pool with backend addresses containing virtual network and IP address.": { "$ref": "./examples/LBBackendAddressPoolWithBackendAddressesPut.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" } }, "delete": { "tags": [ "LoadBalancers" ], "operationId": "LoadBalancerBackendAddressPools_Delete", "description": "Deletes the specified load balancer backend address pool.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "loadBalancerName", "in": "path", "required": true, "type": "string", "description": "The name of the load balancer." }, { "name": "backendAddressPoolName", "in": "path", "required": true, "type": "string", "description": "The name of the backend address pool." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "204": { "description": "Request successful. Resource does not exist." }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "200": { "description": "Delete successful." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "BackendAddressPoolDelete": { "$ref": "./examples/LoadBalancerBackendAddressPoolDelete.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/frontendIPConfigurations": { "get": { "tags": [ "LoadBalancers" ], "operationId": "LoadBalancerFrontendIPConfigurations_List", "description": "Gets all the load balancer frontend IP configurations.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "loadBalancerName", "in": "path", "required": true, "type": "string", "description": "The name of the load balancer." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of LoadBalancer FrontendIPConfiguration resources.", "schema": { "$ref": "#/definitions/LoadBalancerFrontendIPConfigurationListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "LoadBalancerFrontendIPConfigurationList": { "$ref": "./examples/LoadBalancerFrontendIPConfigurationList.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/frontendIPConfigurations/{frontendIPConfigurationName}": { "get": { "tags": [ "LoadBalancers" ], "operationId": "LoadBalancerFrontendIPConfigurations_Get", "description": "Gets load balancer frontend IP configuration.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "loadBalancerName", "in": "path", "required": true, "type": "string", "description": "The name of the load balancer." }, { "name": "frontendIPConfigurationName", "in": "path", "required": true, "type": "string", "description": "The name of the frontend IP configuration." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns LoadBalancer FrontendIPConfiguration resource.", "schema": { "$ref": "#/definitions/FrontendIPConfiguration" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "LoadBalancerFrontendIPConfigurationGet": { "$ref": "./examples/LoadBalancerFrontendIPConfigurationGet.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules": { "get": { "tags": [ "LoadBalancers" ], "operationId": "InboundNatRules_List", "description": "Gets all the inbound nat rules in a load balancer.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "loadBalancerName", "in": "path", "required": true, "type": "string", "description": "The name of the load balancer." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of LoadBalancer InboundNatRule resources.", "schema": { "$ref": "#/definitions/InboundNatRuleListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-pageable": { "nextLinkName": "nextLink" }, "x-ms-examples": { "InboundNatRuleList": { "$ref": "./examples/InboundNatRuleList.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}": { "delete": { "tags": [ "LoadBalancers" ], "operationId": "InboundNatRules_Delete", "description": "Deletes the specified load balancer inbound nat rule.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "loadBalancerName", "in": "path", "required": true, "type": "string", "description": "The name of the load balancer." }, { "name": "inboundNatRuleName", "in": "path", "required": true, "type": "string", "description": "The name of the inbound nat rule." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "204": { "description": "Request successful. Resource does not exist." }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "200": { "description": "Delete successful." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "InboundNatRuleDelete": { "$ref": "./examples/InboundNatRuleDelete.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } }, "get": { "tags": [ "LoadBalancers" ], "operationId": "InboundNatRules_Get", "description": "Gets the specified load balancer inbound nat rule.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "loadBalancerName", "in": "path", "required": true, "type": "string", "description": "The name of the load balancer." }, { "name": "inboundNatRuleName", "in": "path", "required": true, "type": "string", "description": "The name of the inbound nat rule." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" }, { "name": "$expand", "in": "query", "required": false, "type": "string", "description": "Expands referenced resources." } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting InboundNatRule resource.", "schema": { "$ref": "#/definitions/InboundNatRule" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "InboundNatRuleGet": { "$ref": "./examples/InboundNatRuleGet.json" } } }, "put": { "tags": [ "LoadBalancers" ], "operationId": "InboundNatRules_CreateOrUpdate", "description": "Creates or updates a load balancer inbound nat rule.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "loadBalancerName", "in": "path", "required": true, "type": "string", "description": "The name of the load balancer." }, { "name": "inboundNatRuleName", "in": "path", "required": true, "type": "string", "description": "The name of the inbound nat rule." }, { "name": "inboundNatRuleParameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/InboundNatRule" }, "description": "Parameters supplied to the create or update inbound nat rule operation." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "201": { "description": "Create successful. The operation returns the resulting InboundNatRule resource.", "schema": { "$ref": "#/definitions/InboundNatRule" } }, "200": { "description": "Update successful. The operation returns the resulting InboundNatRule resource.", "schema": { "$ref": "#/definitions/InboundNatRule" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" }, "x-ms-examples": { "InboundNatRuleCreate": { "$ref": "./examples/InboundNatRuleCreate.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/loadBalancingRules": { "get": { "tags": [ "LoadBalancers" ], "operationId": "LoadBalancerLoadBalancingRules_List", "description": "Gets all the load balancing rules in a load balancer.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "loadBalancerName", "in": "path", "required": true, "type": "string", "description": "The name of the load balancer." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of LoadBalancer LoadBalancingRule resources.", "schema": { "$ref": "#/definitions/LoadBalancerLoadBalancingRuleListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-pageable": { "nextLinkName": "nextLink" }, "x-ms-examples": { "LoadBalancerLoadBalancingRuleList": { "$ref": "./examples/LoadBalancerLoadBalancingRuleList.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/loadBalancingRules/{loadBalancingRuleName}": { "get": { "tags": [ "LoadBalancers" ], "operationId": "LoadBalancerLoadBalancingRules_Get", "description": "Gets the specified load balancer load balancing rule.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "loadBalancerName", "in": "path", "required": true, "type": "string", "description": "The name of the load balancer." }, { "name": "loadBalancingRuleName", "in": "path", "required": true, "type": "string", "description": "The name of the load balancing rule." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting LoadBalancingRule resource.", "schema": { "$ref": "#/definitions/LoadBalancingRule" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "LoadBalancerLoadBalancingRuleGet": { "$ref": "./examples/LoadBalancerLoadBalancingRuleGet.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/outboundRules": { "get": { "tags": [ "LoadBalancers" ], "operationId": "LoadBalancerOutboundRules_List", "description": "Gets all the outbound rules in a load balancer.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "loadBalancerName", "in": "path", "required": true, "type": "string", "description": "The name of the load balancer." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of LoadBalancer OutboundRule resources.", "schema": { "$ref": "#/definitions/LoadBalancerOutboundRuleListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-pageable": { "nextLinkName": "nextLink" }, "x-ms-examples": { "LoadBalancerOutboundRuleList": { "$ref": "./examples/LoadBalancerOutboundRuleList.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/outboundRules/{outboundRuleName}": { "get": { "tags": [ "LoadBalancers" ], "operationId": "LoadBalancerOutboundRules_Get", "description": "Gets the specified load balancer outbound rule.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "loadBalancerName", "in": "path", "required": true, "type": "string", "description": "The name of the load balancer." }, { "name": "outboundRuleName", "in": "path", "required": true, "type": "string", "description": "The name of the outbound rule." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting OutboundRule resource.", "schema": { "$ref": "#/definitions/OutboundRule" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "LoadBalancerOutboundRuleGet": { "$ref": "./examples/LoadBalancerOutboundRuleGet.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/networkInterfaces": { "get": { "tags": [ "LoadBalancers" ], "operationId": "LoadBalancerNetworkInterfaces_List", "description": "Gets associated load balancer network interfaces.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "loadBalancerName", "in": "path", "required": true, "type": "string", "description": "The name of the load balancer." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of NetworkInterface resources.", "schema": { "$ref": "./networkInterface.json#/definitions/NetworkInterfaceListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "LoadBalancerNetworkInterfaceListVmss": { "$ref": "./examples/LoadBalancerNetworkInterfaceListVmss.json" }, "LoadBalancerNetworkInterfaceListSimple": { "$ref": "./examples/LoadBalancerNetworkInterfaceListSimple.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes": { "get": { "tags": [ "LoadBalancers" ], "operationId": "LoadBalancerProbes_List", "description": "Gets all the load balancer probes.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "loadBalancerName", "in": "path", "required": true, "type": "string", "description": "The name of the load balancer." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of LoadBalancer Probe resources.", "schema": { "$ref": "#/definitions/LoadBalancerProbeListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "LoadBalancerProbeList": { "$ref": "./examples/LoadBalancerProbeList.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}": { "get": { "tags": [ "LoadBalancers" ], "operationId": "LoadBalancerProbes_Get", "description": "Gets load balancer probe.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "loadBalancerName", "in": "path", "required": true, "type": "string", "description": "The name of the load balancer." }, { "name": "probeName", "in": "path", "required": true, "type": "string", "description": "The name of the probe." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns LoadBalancer Probe resource.", "schema": { "$ref": "#/definitions/Probe" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "LoadBalancerProbeGet": { "$ref": "./examples/LoadBalancerProbeGet.json" } } } } }, "definitions": { "LoadBalancerSku": { "properties": { "name": { "type": "string", "description": "Name of a load balancer SKU.", "enum": [ "Basic", "Standard" ], "x-ms-enum": { "name": "LoadBalancerSkuName", "modelAsString": true } } }, "description": "SKU of a load balancer." }, "FrontendIPConfigurationPropertiesFormat": { "properties": { "inboundNatRules": { "readOnly": true, "type": "array", "items": { "$ref": "./network.json#/definitions/SubResource" }, "description": "An array of references to inbound rules that use this frontend IP." }, "inboundNatPools": { "readOnly": true, "type": "array", "items": { "$ref": "./network.json#/definitions/SubResource" }, "description": "An array of references to inbound pools that use this frontend IP." }, "outboundRules": { "readOnly": true, "type": "array", "items": { "$ref": "./network.json#/definitions/SubResource" }, "description": "An array of references to outbound rules that use this frontend IP." }, "loadBalancingRules": { "readOnly": true, "type": "array", "items": { "$ref": "./network.json#/definitions/SubResource" }, "description": "An array of references to load balancing rules that use this frontend IP." }, "privateIPAddress": { "type": "string", "description": "The private IP address of the IP configuration." }, "privateIPAllocationMethod": { "$ref": "./network.json#/definitions/IPAllocationMethod", "description": "The Private IP allocation method." }, "privateIPAddressVersion": { "$ref": "./network.json#/definitions/IPVersion", "description": "Whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4." }, "subnet": { "$ref": "./virtualNetwork.json#/definitions/Subnet", "description": "The reference to the subnet resource." }, "publicIPAddress": { "$ref": "./publicIpAddress.json#/definitions/PublicIPAddress", "description": "The reference to the Public IP resource." }, "publicIPPrefix": { "$ref": "./network.json#/definitions/SubResource", "description": "The reference to the Public IP Prefix resource." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the frontend IP configuration resource." } }, "description": "Properties of Frontend IP Configuration of the load balancer." }, "FrontendIPConfiguration": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/FrontendIPConfigurationPropertiesFormat", "description": "Properties of the load balancer probe." }, "name": { "type": "string", "description": "The name of the resource that is unique within the set of frontend IP configurations used by the load balancer. This name can be used to access the resource." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Type of the resource." }, "zones": { "type": "array", "items": { "type": "string" }, "description": "A list of availability zones denoting the IP allocated for the resource needs to come from." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Frontend IP address of the load balancer." }, "LoadBalancerBackendAddressPropertiesFormat": { "properties": { "virtualNetwork": { "$ref": "./network.json#/definitions/SubResource", "description": "Reference to an existing virtual network." }, "ipAddress": { "type": "string", "description": "IP Address belonging to the referenced virtual network.", "x-ms-azure-resource": false }, "networkInterfaceIPConfiguration": { "readOnly": true, "$ref": "./network.json#/definitions/SubResource", "description": "Reference to IP address defined in network interfaces." } }, "description": "Properties of the load balancer backend addresses." }, "LoadBalancerBackendAddress": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/LoadBalancerBackendAddressPropertiesFormat", "description": "Properties of load balancer backend address pool." }, "name": { "type": "string", "description": "Name of the backend address." } }, "description": "Load balancer backend addresses." }, "BackendAddressPoolPropertiesFormat": { "properties": { "loadBalancerBackendAddresses": { "type": "array", "items": { "$ref": "#/definitions/LoadBalancerBackendAddress" }, "description": "An array of backend addresses." }, "backendIPConfigurations": { "readOnly": true, "type": "array", "items": { "$ref": "./networkInterface.json#/definitions/NetworkInterfaceIPConfiguration" }, "description": "An array of references to IP addresses defined in network interfaces." }, "loadBalancingRules": { "readOnly": true, "type": "array", "items": { "$ref": "./network.json#/definitions/SubResource" }, "description": "An array of references to load balancing rules that use this backend address pool." }, "outboundRule": { "readOnly": true, "$ref": "./network.json#/definitions/SubResource", "description": "A reference to an outbound rule that uses this backend address pool." }, "outboundRules": { "readOnly": true, "type": "array", "items": { "$ref": "./network.json#/definitions/SubResource" }, "description": "An array of references to outbound rules that use this backend address pool." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the backend address pool resource." } }, "description": "Properties of the backend address pool." }, "BackendAddressPool": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/BackendAddressPoolPropertiesFormat", "description": "Properties of load balancer backend address pool." }, "name": { "type": "string", "description": "The name of the resource that is unique within the set of backend address pools used by the load balancer. This name can be used to access the resource." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Type of the resource." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Pool of backend IP addresses." }, "LoadBalancingRulePropertiesFormat": { "properties": { "frontendIPConfiguration": { "$ref": "./network.json#/definitions/SubResource", "description": "A reference to frontend IP addresses." }, "backendAddressPool": { "$ref": "./network.json#/definitions/SubResource", "description": "A reference to a pool of DIPs. Inbound traffic is randomly load balanced across IPs in the backend IPs." }, "probe": { "$ref": "./network.json#/definitions/SubResource", "description": "The reference to the load balancer probe used by the load balancing rule." }, "protocol": { "$ref": "#/definitions/TransportProtocol", "description": "The reference to the transport protocol used by the load balancing rule." }, "loadDistribution": { "type": "string", "description": "The load distribution policy for this rule.", "enum": [ "Default", "SourceIP", "SourceIPProtocol" ], "x-ms-enum": { "name": "LoadDistribution", "modelAsString": true } }, "frontendPort": { "type": "integer", "format": "int32", "description": "The port for the external endpoint. Port numbers for each rule must be unique within the Load Balancer. Acceptable values are between 0 and 65534. Note that value 0 enables \"Any Port\"." }, "backendPort": { "type": "integer", "format": "int32", "description": "The port used for internal connections on the endpoint. Acceptable values are between 0 and 65535. Note that value 0 enables \"Any Port\"." }, "idleTimeoutInMinutes": { "type": "integer", "format": "int32", "description": "The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to TCP." }, "enableFloatingIP": { "type": "boolean", "description": "Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn Availability Group. This setting is required when using the SQL AlwaysOn Availability Groups in SQL server. This setting can't be changed after you create the endpoint." }, "enableTcpReset": { "type": "boolean", "description": "Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP." }, "disableOutboundSnat": { "type": "boolean", "description": "Configures SNAT for the VMs in the backend pool to use the publicIP address specified in the frontend of the load balancing rule." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the load balancing rule resource." } }, "required": [ "protocol", "frontendPort" ], "description": "Properties of the load balancer." }, "LoadBalancingRule": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/LoadBalancingRulePropertiesFormat", "description": "Properties of load balancer load balancing rule." }, "name": { "type": "string", "description": "The name of the resource that is unique within the set of load balancing rules used by the load balancer. This name can be used to access the resource." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Type of the resource." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "A load balancing rule for a load balancer." }, "ProbePropertiesFormat": { "properties": { "loadBalancingRules": { "readOnly": true, "type": "array", "items": { "$ref": "./network.json#/definitions/SubResource" }, "description": "The load balancer rules that use this probe." }, "protocol": { "type": "string", "description": "The protocol of the end point. If 'Tcp' is specified, a received ACK is required for the probe to be successful. If 'Http' or 'Https' is specified, a 200 OK response from the specifies URI is required for the probe to be successful.", "enum": [ "Http", "Tcp", "Https" ], "x-ms-enum": { "name": "ProbeProtocol", "modelAsString": true } }, "port": { "type": "integer", "format": "int32", "description": "The port for communicating the probe. Possible values range from 1 to 65535, inclusive." }, "intervalInSeconds": { "type": "integer", "format": "int32", "description": "The interval, in seconds, for how frequently to probe the endpoint for health status. Typically, the interval is slightly less than half the allocated timeout period (in seconds) which allows two full probes before taking the instance out of rotation. The default value is 15, the minimum value is 5." }, "numberOfProbes": { "type": "integer", "format": "int32", "description": "The number of probes where if no response, will result in stopping further traffic from being delivered to the endpoint. This values allows endpoints to be taken out of rotation faster or slower than the typical times used in Azure." }, "requestPath": { "type": "string", "description": "The URI used for requesting health status from the VM. Path is required if a protocol is set to http. Otherwise, it is not allowed. There is no default value." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the probe resource." } }, "required": [ "protocol", "port" ], "description": "Load balancer probe resource." }, "Probe": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ProbePropertiesFormat", "description": "Properties of load balancer probe." }, "name": { "type": "string", "description": "The name of the resource that is unique within the set of probes used by the load balancer. This name can be used to access the resource." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Type of the resource." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "A load balancer probe." }, "InboundNatRulePropertiesFormat": { "properties": { "frontendIPConfiguration": { "$ref": "./network.json#/definitions/SubResource", "description": "A reference to frontend IP addresses." }, "backendIPConfiguration": { "readOnly": true, "$ref": "./networkInterface.json#/definitions/NetworkInterfaceIPConfiguration", "description": "A reference to a private IP address defined on a network interface of a VM. Traffic sent to the frontend port of each of the frontend IP configurations is forwarded to the backend IP." }, "protocol": { "$ref": "#/definitions/TransportProtocol", "description": "The reference to the transport protocol used by the load balancing rule." }, "frontendPort": { "type": "integer", "format": "int32", "description": "The port for the external endpoint. Port numbers for each rule must be unique within the Load Balancer. Acceptable values range from 1 to 65534." }, "backendPort": { "type": "integer", "format": "int32", "description": "The port used for the internal endpoint. Acceptable values range from 1 to 65535." }, "idleTimeoutInMinutes": { "type": "integer", "format": "int32", "description": "The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to TCP." }, "enableFloatingIP": { "type": "boolean", "description": "Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn Availability Group. This setting is required when using the SQL AlwaysOn Availability Groups in SQL server. This setting can't be changed after you create the endpoint." }, "enableTcpReset": { "type": "boolean", "description": "Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the inbound NAT rule resource." } }, "description": "Properties of the inbound NAT rule." }, "InboundNatRule": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/InboundNatRulePropertiesFormat", "description": "Properties of load balancer inbound nat rule." }, "name": { "type": "string", "description": "The name of the resource that is unique within the set of inbound NAT rules used by the load balancer. This name can be used to access the resource." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Type of the resource." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Inbound NAT rule of the load balancer." }, "InboundNatPoolPropertiesFormat": { "properties": { "frontendIPConfiguration": { "$ref": "./network.json#/definitions/SubResource", "description": "A reference to frontend IP addresses." }, "protocol": { "$ref": "#/definitions/TransportProtocol", "description": "The reference to the transport protocol used by the inbound NAT pool." }, "frontendPortRangeStart": { "type": "integer", "format": "int32", "description": "The first port number in the range of external ports that will be used to provide Inbound Nat to NICs associated with a load balancer. Acceptable values range between 1 and 65534." }, "frontendPortRangeEnd": { "type": "integer", "format": "int32", "description": "The last port number in the range of external ports that will be used to provide Inbound Nat to NICs associated with a load balancer. Acceptable values range between 1 and 65535." }, "backendPort": { "type": "integer", "format": "int32", "description": "The port used for internal connections on the endpoint. Acceptable values are between 1 and 65535." }, "idleTimeoutInMinutes": { "type": "integer", "format": "int32", "description": "The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to TCP." }, "enableFloatingIP": { "type": "boolean", "description": "Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn Availability Group. This setting is required when using the SQL AlwaysOn Availability Groups in SQL server. This setting can't be changed after you create the endpoint." }, "enableTcpReset": { "type": "boolean", "description": "Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the inbound NAT pool resource." } }, "required": [ "protocol", "frontendPortRangeStart", "frontendPortRangeEnd", "backendPort" ], "description": "Properties of Inbound NAT pool." }, "InboundNatPool": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/InboundNatPoolPropertiesFormat", "description": "Properties of load balancer inbound nat pool." }, "name": { "type": "string", "description": "The name of the resource that is unique within the set of inbound NAT pools used by the load balancer. This name can be used to access the resource." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Type of the resource." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Inbound NAT pool of the load balancer." }, "OutboundRulePropertiesFormat": { "properties": { "allocatedOutboundPorts": { "type": "integer", "format": "int32", "description": "The number of outbound ports to be used for NAT." }, "frontendIPConfigurations": { "type": "array", "items": { "$ref": "./network.json#/definitions/SubResource" }, "description": "The Frontend IP addresses of the load balancer." }, "backendAddressPool": { "$ref": "./network.json#/definitions/SubResource", "description": "A reference to a pool of DIPs. Outbound traffic is randomly load balanced across IPs in the backend IPs." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the outbound rule resource." }, "protocol": { "type": "string", "description": "The protocol for the outbound rule in load balancer.", "enum": [ "Tcp", "Udp", "All" ], "x-ms-enum": { "name": "LoadBalancerOutboundRuleProtocol", "modelAsString": true } }, "enableTcpReset": { "type": "boolean", "description": "Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP." }, "idleTimeoutInMinutes": { "type": "integer", "description": "The timeout for the TCP idle connection." } }, "required": [ "backendAddressPool", "frontendIPConfigurations", "protocol" ], "description": "Outbound rule of the load balancer." }, "OutboundRule": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/OutboundRulePropertiesFormat", "description": "Properties of load balancer outbound rule." }, "name": { "type": "string", "description": "The name of the resource that is unique within the set of outbound rules used by the load balancer. This name can be used to access the resource." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Type of the resource." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Outbound rule of the load balancer." }, "LoadBalancerPropertiesFormat": { "properties": { "frontendIPConfigurations": { "type": "array", "items": { "$ref": "#/definitions/FrontendIPConfiguration" }, "description": "Object representing the frontend IPs to be used for the load balancer." }, "backendAddressPools": { "type": "array", "items": { "$ref": "#/definitions/BackendAddressPool" }, "description": "Collection of backend address pools used by a load balancer." }, "loadBalancingRules": { "type": "array", "items": { "$ref": "#/definitions/LoadBalancingRule" }, "description": "Object collection representing the load balancing rules Gets the provisioning." }, "probes": { "type": "array", "items": { "$ref": "#/definitions/Probe" }, "description": "Collection of probe objects used in the load balancer." }, "inboundNatRules": { "type": "array", "items": { "$ref": "#/definitions/InboundNatRule" }, "description": "Collection of inbound NAT Rules used by a load balancer. Defining inbound NAT rules on your load balancer is mutually exclusive with defining an inbound NAT pool. Inbound NAT pools are referenced from virtual machine scale sets. NICs that are associated with individual virtual machines cannot reference an Inbound NAT pool. They have to reference individual inbound NAT rules." }, "inboundNatPools": { "type": "array", "items": { "$ref": "#/definitions/InboundNatPool" }, "description": "Defines an external port range for inbound NAT to a single backend port on NICs associated with a load balancer. Inbound NAT rules are created automatically for each NIC associated with the Load Balancer using an external port from this range. Defining an Inbound NAT pool on your Load Balancer is mutually exclusive with defining inbound Nat rules. Inbound NAT pools are referenced from virtual machine scale sets. NICs that are associated with individual virtual machines cannot reference an inbound NAT pool. They have to reference individual inbound NAT rules." }, "outboundRules": { "type": "array", "items": { "$ref": "#/definitions/OutboundRule" }, "description": "The outbound rules." }, "resourceGuid": { "readOnly": true, "type": "string", "description": "The resource GUID property of the load balancer resource." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the load balancer resource." } }, "description": "Properties of the load balancer." }, "LoadBalancer": { "properties": { "sku": { "$ref": "#/definitions/LoadBalancerSku", "description": "The load balancer SKU." }, "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/LoadBalancerPropertiesFormat", "description": "Properties of load balancer." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/Resource" } ], "description": "LoadBalancer resource." }, "LoadBalancerListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/LoadBalancer" }, "description": "A list of load balancers in a resource group." }, "nextLink": { "readOnly": true, "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for ListLoadBalancers API service call." }, "InboundNatRuleListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/InboundNatRule" }, "description": "A list of inbound nat rules in a load balancer." }, "nextLink": { "readOnly": true, "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for ListInboundNatRule API service call." }, "LoadBalancerBackendAddressPoolListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/BackendAddressPool" }, "description": "A list of backend address pools in a load balancer." }, "nextLink": { "readOnly": true, "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for ListBackendAddressPool API service call." }, "LoadBalancerFrontendIPConfigurationListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/FrontendIPConfiguration" }, "description": "A list of frontend IP configurations in a load balancer." }, "nextLink": { "readOnly": true, "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for ListFrontendIPConfiguration API service call." }, "LoadBalancerLoadBalancingRuleListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/LoadBalancingRule" }, "description": "A list of load balancing rules in a load balancer." }, "nextLink": { "readOnly": true, "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for ListLoadBalancingRule API service call." }, "LoadBalancerOutboundRuleListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/OutboundRule" }, "description": "A list of outbound rules in a load balancer." }, "nextLink": { "readOnly": true, "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for ListOutboundRule API service call." }, "LoadBalancerProbeListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/Probe" }, "description": "A list of probes in a load balancer." }, "nextLink": { "readOnly": true, "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for ListProbe API service call." }, "TransportProtocol": { "type": "string", "description": "The transport protocol for the endpoint.", "enum": [ "Udp", "Tcp", "All" ], "x-ms-enum": { "name": "TransportProtocol", "modelAsString": true } } } } analysis-0.21.1/fixtures/azure/network.json000066400000000000000000000234721413705513100210110ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "NetworkManagementClient", "description": "The Microsoft Azure Network management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to manage your network resources. The API has entities that capture the relationship between an end user and the Microsoft Azure Networks service.", "version": "2020-04-01" }, "host": "management.azure.com", "schemes": [ "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "security": [ { "azure_auth": [ "user_impersonation" ] } ], "securityDefinitions": { "azure_auth": { "type": "oauth2", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "flow": "implicit", "description": "Azure Active Directory OAuth2 Flow.", "scopes": { "user_impersonation": "impersonate your user account" } } }, "paths": {}, "definitions": { "ErrorDetails": { "properties": { "code": { "type": "string", "description": "Error code." }, "target": { "type": "string", "description": "Error target." }, "message": { "type": "string", "description": "Error message." } }, "description": "Common error details representation." }, "Error": { "properties": { "code": { "type": "string", "description": "Error code." }, "message": { "type": "string", "description": "Error message." }, "target": { "type": "string", "description": "Error target." }, "details": { "type": "array", "items": { "$ref": "#/definitions/ErrorDetails" }, "description": "Error details." }, "innerError": { "type": "string", "description": "Inner error message." } }, "description": "Common error representation." }, "CloudError": { "x-ms-external": true, "properties": { "error": { "$ref": "#/definitions/CloudErrorBody", "description": "Cloud error body." } }, "description": "An error response from the service." }, "CloudErrorBody": { "x-ms-external": true, "properties": { "code": { "type": "string", "description": "An identifier for the error. Codes are invariant and are intended to be consumed programmatically." }, "message": { "type": "string", "description": "A message describing the error, intended to be suitable for display in a user interface." }, "target": { "type": "string", "description": "The target of the particular error. For example, the name of the property in error." }, "details": { "type": "array", "items": { "$ref": "#/definitions/CloudErrorBody" }, "description": "A list of additional details about the error." } }, "description": "An error response from the service." }, "AzureAsyncOperationResult": { "properties": { "status": { "type": "string", "description": "Status of the Azure async operation.", "enum": [ "InProgress", "Succeeded", "Failed" ], "x-ms-enum": { "name": "NetworkOperationStatus", "modelAsString": true } }, "error": { "$ref": "#/definitions/Error", "description": "Details of the error occurred during specified asynchronous operation." } }, "description": "The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is in progress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure." }, "Resource": { "properties": { "id": { "type": "string", "description": "Resource ID." }, "name": { "readOnly": true, "type": "string", "description": "Resource name." }, "type": { "readOnly": true, "type": "string", "description": "Resource type." }, "location": { "type": "string", "description": "Resource location." }, "tags": { "type": "object", "additionalProperties": { "type": "string" }, "description": "Resource tags." } }, "description": "Common resource representation.", "x-ms-azure-resource": true }, "SubResource": { "properties": { "id": { "type": "string", "description": "Resource ID." } }, "description": "Reference to another subresource.", "x-ms-azure-resource": true }, "TagsObject": { "properties": { "tags": { "type": "object", "additionalProperties": { "type": "string" }, "description": "Resource tags." } }, "description": "Tags object for patch operations." }, "ManagedServiceIdentity": { "properties": { "principalId": { "readOnly": true, "type": "string", "description": "The principal id of the system assigned identity. This property will only be provided for a system assigned identity." }, "tenantId": { "readOnly": true, "type": "string", "description": "The tenant id of the system assigned identity. This property will only be provided for a system assigned identity." }, "type": { "type": "string", "description": "The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the virtual machine.", "enum": [ "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None" ], "x-ms-enum": { "name": "ResourceIdentityType", "modelAsString": false } }, "userAssignedIdentities": { "type": "object", "additionalProperties": { "type": "object", "properties": { "principalId": { "readOnly": true, "type": "string", "description": "The principal id of user assigned identity." }, "clientId": { "readOnly": true, "type": "string", "description": "The client id of user assigned identity." } } }, "description": "The list of user identities associated with resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'." } }, "description": "Identity for the resource." }, "ProvisioningState": { "type": "string", "readOnly": true, "description": "The current provisioning state.", "enum": [ "Succeeded", "Updating", "Deleting", "Failed" ], "x-ms-enum": { "name": "ProvisioningState", "modelAsString": true } }, "Access": { "type": "string", "description": "Access to be allowed or denied.", "enum": [ "Allow", "Deny" ], "x-ms-enum": { "name": "Access", "modelAsString": true } }, "AuthenticationMethod": { "type": "string", "description": "VPN client authentication method.", "enum": [ "EAPTLS", "EAPMSCHAPv2" ], "x-ms-enum": { "name": "AuthenticationMethod", "modelAsString": true } }, "IPAllocationMethod": { "type": "string", "description": "IP address allocation method.", "enum": [ "Static", "Dynamic" ], "x-ms-enum": { "name": "IPAllocationMethod", "modelAsString": true } }, "IPVersion": { "type": "string", "description": "IP address version.", "enum": [ "IPv4", "IPv6" ], "x-ms-enum": { "name": "IPVersion", "modelAsString": true } } }, "parameters": { "SubscriptionIdParameter": { "name": "subscriptionId", "in": "path", "required": true, "type": "string", "description": "The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call." }, "ApiVersionParameter": { "name": "api-version", "in": "query", "required": true, "type": "string", "description": "Client API version." }, "ApiVersionVmssParameter": { "name": "api-version", "in": "query", "required": true, "type": "string", "enum": [ "2017-03-30" ], "x-ms-enum": { "name": "ApiVersion", "modelAsString": true }, "description": "Client API version." } } } analysis-0.21.1/fixtures/azure/networkInterface.json000066400000000000000000001464361413705513100226400ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "NetworkManagementClient", "description": "The Microsoft Azure Network management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to manage your network resources. The API has entities that capture the relationship between an end user and the Microsoft Azure Networks service.", "version": "2020-04-01" }, "host": "management.azure.com", "schemes": [ "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "security": [ { "azure_auth": [ "user_impersonation" ] } ], "securityDefinitions": { "azure_auth": { "type": "oauth2", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "flow": "implicit", "description": "Azure Active Directory OAuth2 Flow.", "scopes": { "user_impersonation": "impersonate your user account" } } }, "paths": { "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}": { "delete": { "tags": [ "NetworkInterfaces" ], "operationId": "NetworkInterfaces_Delete", "description": "Deletes the specified network interface.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkInterfaceName", "in": "path", "required": true, "type": "string", "description": "The name of the network interface." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "204": { "description": "Request successful. Resource does not exist." }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "200": { "description": "Delete successful." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Delete network interface": { "$ref": "./examples/NetworkInterfaceDelete.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } }, "get": { "tags": [ "NetworkInterfaces" ], "operationId": "NetworkInterfaces_Get", "description": "Gets information about the specified network interface.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkInterfaceName", "in": "path", "required": true, "type": "string", "description": "The name of the network interface." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" }, { "name": "$expand", "in": "query", "required": false, "type": "string", "description": "Expands referenced resources." } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting NetworkInterface resource.", "schema": { "$ref": "#/definitions/NetworkInterface" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Get network interface": { "$ref": "./examples/NetworkInterfaceGet.json" } } }, "put": { "tags": [ "NetworkInterfaces" ], "operationId": "NetworkInterfaces_CreateOrUpdate", "description": "Creates or updates a network interface.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkInterfaceName", "in": "path", "required": true, "type": "string", "description": "The name of the network interface." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/NetworkInterface" }, "description": "Parameters supplied to the create or update network interface operation." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "201": { "description": "Create successful. The operation returns the resulting NetworkInterface resource.", "schema": { "$ref": "#/definitions/NetworkInterface" } }, "200": { "description": "Update successful. The operation returns the resulting NetworkInterface resource.", "schema": { "$ref": "#/definitions/NetworkInterface" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Create network interface": { "$ref": "./examples/NetworkInterfaceCreate.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" } }, "patch": { "tags": [ "NetworkInterfaces" ], "operationId": "NetworkInterfaces_UpdateTags", "description": "Updates a network interface tags.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkInterfaceName", "in": "path", "required": true, "type": "string", "description": "The name of the network interface." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "./network.json#/definitions/TagsObject" }, "description": "Parameters supplied to update network interface tags." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting NetworkInterface resource.", "schema": { "$ref": "#/definitions/NetworkInterface" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Update network interface tags": { "$ref": "./examples/NetworkInterfaceUpdateTags.json" } } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkInterfaces": { "get": { "tags": [ "NetworkInterfaces" ], "operationId": "NetworkInterfaces_ListAll", "description": "Gets all network interfaces in a subscription.", "parameters": [ { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of NetworkInterface resources.", "schema": { "$ref": "#/definitions/NetworkInterfaceListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "List all network interfaces": { "$ref": "./examples/NetworkInterfaceListAll.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces": { "get": { "tags": [ "NetworkInterfaces" ], "operationId": "NetworkInterfaces_List", "description": "Gets all network interfaces in a resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of NetworkInterface resources.", "schema": { "$ref": "#/definitions/NetworkInterfaceListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "List network interfaces in resource group": { "$ref": "./examples/NetworkInterfaceList.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable": { "post": { "tags": [ "NetworkInterfaces" ], "operationId": "NetworkInterfaces_GetEffectiveRouteTable", "description": "Gets all route tables applied to a network interface.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkInterfaceName", "in": "path", "required": true, "type": "string", "description": "The name of the network interface." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of EffectRoute resources.", "schema": { "$ref": "#/definitions/EffectiveRouteListResult" } }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Show network interface effective route tables": { "$ref": "./examples/NetworkInterfaceEffectiveRouteTableList.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveNetworkSecurityGroups": { "post": { "tags": [ "NetworkInterfaces" ], "operationId": "NetworkInterfaces_ListEffectiveNetworkSecurityGroups", "description": "Gets all network security groups applied to a network interface.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkInterfaceName", "in": "path", "required": true, "type": "string", "description": "The name of the network interface." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of NetworkSecurityGroup resources.", "schema": { "$ref": "#/definitions/EffectiveNetworkSecurityGroupListResult" } }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "List network interface effective network security groups": { "$ref": "./examples/NetworkInterfaceEffectiveNSGList.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/ipConfigurations": { "get": { "tags": [ "NetworkInterfaces" ], "operationId": "NetworkInterfaceIPConfigurations_List", "description": "Get all ip configurations in a network interface.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkInterfaceName", "in": "path", "required": true, "type": "string", "description": "The name of the network interface." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of NetworkInterface IPConfiguration resources.", "schema": { "$ref": "#/definitions/NetworkInterfaceIPConfigurationListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-pageable": { "nextLinkName": "nextLink" }, "x-ms-examples": { "NetworkInterfaceIPConfigurationList": { "$ref": "./examples/NetworkInterfaceIPConfigurationList.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName}": { "get": { "tags": [ "NetworkInterfaces" ], "operationId": "NetworkInterfaceIPConfigurations_Get", "description": "Gets the specified network interface ip configuration.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkInterfaceName", "in": "path", "required": true, "type": "string", "description": "The name of the network interface." }, { "name": "ipConfigurationName", "in": "path", "required": true, "type": "string", "description": "The name of the ip configuration name." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting NetworkInterface IPConfiguration resource.", "schema": { "$ref": "#/definitions/NetworkInterfaceIPConfiguration" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "NetworkInterfaceIPConfigurationGet": { "$ref": "./examples/NetworkInterfaceIPConfigurationGet.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/loadBalancers": { "get": { "tags": [ "NetworkInterfaces" ], "operationId": "NetworkInterfaceLoadBalancers_List", "description": "List all load balancers in a network interface.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkInterfaceName", "in": "path", "required": true, "type": "string", "description": "The name of the network interface." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of NetworkInterface LoadBalancer resources.", "schema": { "$ref": "#/definitions/NetworkInterfaceLoadBalancerListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-pageable": { "nextLinkName": "nextLink" }, "x-ms-examples": { "NetworkInterfaceLoadBalancerList": { "$ref": "./examples/NetworkInterfaceLoadBalancerList.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations/{tapConfigurationName}": { "delete": { "tags": [ "Network Interfaces" ], "operationId": "NetworkInterfaceTapConfigurations_Delete", "description": "Deletes the specified tap configuration from the NetworkInterface.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkInterfaceName", "in": "path", "required": true, "type": "string", "description": "The name of the network interface." }, { "name": "tapConfigurationName", "in": "path", "required": true, "type": "string", "description": "The name of the tap configuration." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Delete successful." }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "204": { "description": "Delete successful." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Delete tap configuration": { "$ref": "./examples/NetworkInterfaceTapConfigurationDelete.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } }, "get": { "tags": [ "NetworkInterfaces" ], "operationId": "NetworkInterfaceTapConfigurations_Get", "description": "Get the specified tap configuration on a network interface.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkInterfaceName", "in": "path", "required": true, "type": "string", "description": "The name of the network interface." }, { "name": "tapConfigurationName", "in": "path", "required": true, "type": "string", "description": "The name of the tap configuration." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a tap configuration.", "schema": { "$ref": "#/definitions/NetworkInterfaceTapConfiguration" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Get Network Interface Tap Configurations": { "$ref": "./examples/NetworkInterfaceTapConfigurationGet.json" } } }, "put": { "tags": [ "Network Interfaces" ], "operationId": "NetworkInterfaceTapConfigurations_CreateOrUpdate", "description": "Creates or updates a Tap configuration in the specified NetworkInterface.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkInterfaceName", "in": "path", "required": true, "type": "string", "description": "The name of the network interface." }, { "name": "tapConfigurationName", "in": "path", "required": true, "type": "string", "description": "The name of the tap configuration." }, { "name": "tapConfigurationParameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/NetworkInterfaceTapConfiguration" }, "description": "Parameters supplied to the create or update tap configuration operation." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting Tap Configuration resource.", "schema": { "$ref": "#/definitions/NetworkInterfaceTapConfiguration" } }, "201": { "description": "Create successful. The operation returns the resulting Tap configuration resource.", "schema": { "$ref": "#/definitions/NetworkInterfaceTapConfiguration" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Create Network Interface Tap Configurations": { "$ref": "./examples/NetworkInterfaceTapConfigurationCreate.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations": { "get": { "tags": [ "NetworkInterfaces" ], "operationId": "NetworkInterfaceTapConfigurations_List", "description": "Get all Tap configurations in a network interface.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkInterfaceName", "in": "path", "required": true, "type": "string", "description": "The name of the network interface." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of NetworkInterface TapConfiguration resources.", "schema": { "$ref": "#/definitions/NetworkInterfaceTapConfigurationListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "List virtual network tap configurations": { "$ref": "./examples/NetworkInterfaceTapConfigurationList.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } } }, "definitions": { "NetworkInterfaceTapConfiguration": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/NetworkInterfaceTapConfigurationPropertiesFormat", "description": "Properties of the Virtual Network Tap configuration." }, "name": { "type": "string", "description": "The name of the resource that is unique within a resource group. This name can be used to access the resource." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Sub Resource type." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Tap configuration in a Network Interface." }, "NetworkInterfaceTapConfigurationPropertiesFormat": { "properties": { "virtualNetworkTap": { "$ref": "./virtualNetworkTap.json#/definitions/VirtualNetworkTap", "description": "The reference to the Virtual Network Tap resource." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the network interface tap configuration resource." } }, "description": "Properties of Virtual Network Tap configuration." }, "NetworkInterfaceIPConfigurationPropertiesFormat": { "properties": { "virtualNetworkTaps": { "type": "array", "items": { "$ref": "./virtualNetworkTap.json#/definitions/VirtualNetworkTap" }, "description": "The reference to Virtual Network Taps." }, "applicationGatewayBackendAddressPools": { "type": "array", "items": { "$ref": "./applicationGateway.json#/definitions/ApplicationGatewayBackendAddressPool" }, "description": "The reference to ApplicationGatewayBackendAddressPool resource." }, "loadBalancerBackendAddressPools": { "type": "array", "items": { "$ref": "./loadBalancer.json#/definitions/BackendAddressPool" }, "description": "The reference to LoadBalancerBackendAddressPool resource." }, "loadBalancerInboundNatRules": { "type": "array", "items": { "$ref": "./loadBalancer.json#/definitions/InboundNatRule" }, "description": "A list of references of LoadBalancerInboundNatRules." }, "privateIPAddress": { "type": "string", "description": "Private IP address of the IP configuration." }, "privateIPAllocationMethod": { "$ref": "./network.json#/definitions/IPAllocationMethod", "description": "The private IP address allocation method." }, "privateIPAddressVersion": { "$ref": "./network.json#/definitions/IPVersion", "description": "Whether the specific IP configuration is IPv4 or IPv6. Default is IPv4." }, "subnet": { "$ref": "./virtualNetwork.json#/definitions/Subnet", "description": "Subnet bound to the IP configuration." }, "primary": { "type": "boolean", "description": "Whether this is a primary customer address on the network interface." }, "publicIPAddress": { "$ref": "./publicIpAddress.json#/definitions/PublicIPAddress", "description": "Public IP address bound to the IP configuration." }, "applicationSecurityGroups": { "type": "array", "items": { "$ref": "./applicationSecurityGroup.json#/definitions/ApplicationSecurityGroup" }, "description": "Application security groups in which the IP configuration is included." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the network interface IP configuration." }, "privateLinkConnectionProperties": { "$ref": "#/definitions/NetworkInterfaceIPConfigurationPrivateLinkConnectionProperties", "description": "PrivateLinkConnection properties for the network interface.", "readOnly": true } }, "description": "Properties of IP configuration." }, "NetworkInterfaceIPConfigurationPrivateLinkConnectionProperties": { "properties": { "groupId": { "type": "string", "readOnly": true, "description": "The group ID for current private link connection." }, "requiredMemberName": { "type": "string", "readOnly": true, "description": "The required member name for current private link connection." }, "fqdns": { "type": "array", "items": { "type": "string" }, "readOnly": true, "description": "List of FQDNs for current private link connection." } }, "description": "PrivateLinkConnection properties for the network interface." }, "NetworkInterfaceIPConfiguration": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/NetworkInterfaceIPConfigurationPropertiesFormat", "description": "Network interface IP configuration properties." }, "name": { "type": "string", "description": "The name of the resource that is unique within a resource group. This name can be used to access the resource." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "IPConfiguration in a network interface." }, "NetworkInterfaceDnsSettings": { "properties": { "dnsServers": { "type": "array", "items": { "type": "string" }, "description": "List of DNS servers IP addresses. Use 'AzureProvidedDNS' to switch to azure provided DNS resolution. 'AzureProvidedDNS' value cannot be combined with other IPs, it must be the only value in dnsServers collection." }, "appliedDnsServers": { "readOnly": true, "type": "array", "items": { "type": "string" }, "description": "If the VM that uses this NIC is part of an Availability Set, then this list will have the union of all DNS servers from all NICs that are part of the Availability Set. This property is what is configured on each of those VMs." }, "internalDnsNameLabel": { "type": "string", "description": "Relative DNS name for this NIC used for internal communications between VMs in the same virtual network." }, "internalFqdn": { "readOnly": true, "type": "string", "description": "Fully qualified DNS name supporting internal communications between VMs in the same virtual network." }, "internalDomainNameSuffix": { "readOnly": true, "type": "string", "description": "Even if internalDnsNameLabel is not specified, a DNS entry is created for the primary NIC of the VM. This DNS name can be constructed by concatenating the VM name with the value of internalDomainNameSuffix." } }, "description": "DNS settings of a network interface." }, "NetworkInterfacePropertiesFormat": { "properties": { "virtualMachine": { "$ref": "./network.json#/definitions/SubResource", "description": "The reference to a virtual machine.", "readOnly": true }, "networkSecurityGroup": { "$ref": "./networkSecurityGroup.json#/definitions/NetworkSecurityGroup", "description": "The reference to the NetworkSecurityGroup resource." }, "privateEndpoint": { "readOnly": true, "$ref": "./privateEndpoint.json#/definitions/PrivateEndpoint", "description": "A reference to the private endpoint to which the network interface is linked." }, "ipConfigurations": { "type": "array", "items": { "$ref": "#/definitions/NetworkInterfaceIPConfiguration" }, "description": "A list of IPConfigurations of the network interface." }, "tapConfigurations": { "readOnly": true, "type": "array", "items": { "$ref": "#/definitions/NetworkInterfaceTapConfiguration" }, "description": "A list of TapConfigurations of the network interface." }, "dnsSettings": { "$ref": "#/definitions/NetworkInterfaceDnsSettings", "description": "The DNS settings in network interface." }, "macAddress": { "readOnly": true, "type": "string", "description": "The MAC address of the network interface." }, "primary": { "readOnly": true, "type": "boolean", "description": "Whether this is a primary network interface on a virtual machine." }, "enableAcceleratedNetworking": { "type": "boolean", "description": "If the network interface is accelerated networking enabled." }, "enableIPForwarding": { "type": "boolean", "description": "Indicates whether IP forwarding is enabled on this network interface." }, "hostedWorkloads": { "type": "array", "items": { "type": "string" }, "readOnly": true, "description": "A list of references to linked BareMetal resources." }, "resourceGuid": { "readOnly": true, "type": "string", "description": "The resource GUID property of the network interface resource." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the network interface resource." } }, "description": "NetworkInterface properties." }, "NetworkInterface": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/NetworkInterfacePropertiesFormat", "description": "Properties of the network interface." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/Resource" } ], "description": "A network interface in a resource group." }, "NetworkInterfaceListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/NetworkInterface" }, "description": "A list of network interfaces in a resource group." }, "nextLink": { "readOnly": true, "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for the ListNetworkInterface API service call." }, "NetworkInterfaceTapConfigurationListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/NetworkInterfaceTapConfiguration" }, "description": "A list of tap configurations." }, "nextLink": { "readOnly": true, "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for list tap configurations API service call." }, "NetworkInterfaceIPConfigurationListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/NetworkInterfaceIPConfiguration" }, "description": "A list of ip configurations." }, "nextLink": { "readOnly": true, "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for list ip configurations API service call." }, "NetworkInterfaceLoadBalancerListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "./loadBalancer.json#/definitions/LoadBalancer" }, "description": "A list of load balancers." }, "nextLink": { "readOnly": true, "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for list ip configurations API service call." }, "EffectiveNetworkSecurityGroup": { "properties": { "networkSecurityGroup": { "$ref": "./network.json#/definitions/SubResource", "description": "The ID of network security group that is applied." }, "association": { "$ref": "#/definitions/EffectiveNetworkSecurityGroupAssociation", "description": "Associated resources." }, "effectiveSecurityRules": { "type": "array", "items": { "$ref": "#/definitions/EffectiveNetworkSecurityRule" }, "description": "A collection of effective security rules." }, "tagMap": { "type": "string", "additionalProperties": { "type": "array", "items": { "type": "string" }, "description": "List of IP Addresses within the tag (key)." }, "description": "Mapping of tags to list of IP Addresses included within the tag." } }, "description": "Effective network security group." }, "EffectiveNetworkSecurityGroupAssociation": { "properties": { "subnet": { "$ref": "./network.json#/definitions/SubResource", "description": "The ID of the subnet if assigned." }, "networkInterface": { "$ref": "./network.json#/definitions/SubResource", "description": "The ID of the network interface if assigned." } }, "description": "The effective network security group association." }, "EffectiveNetworkSecurityRule": { "properties": { "name": { "type": "string", "description": "The name of the security rule specified by the user (if created by the user)." }, "protocol": { "type": "string", "description": "The network protocol this rule applies to.", "enum": [ "Tcp", "Udp", "All" ], "x-ms-enum": { "name": "EffectiveSecurityRuleProtocol", "modelAsString": true } }, "sourcePortRange": { "type": "string", "description": "The source port or range." }, "destinationPortRange": { "type": "string", "description": "The destination port or range." }, "sourcePortRanges": { "type": "array", "items": { "type": "string" }, "description": "The source port ranges. Expected values include a single integer between 0 and 65535, a range using '-' as separator (e.g. 100-400), or an asterisk (*)." }, "destinationPortRanges": { "type": "array", "items": { "type": "string" }, "description": "The destination port ranges. Expected values include a single integer between 0 and 65535, a range using '-' as separator (e.g. 100-400), or an asterisk (*)." }, "sourceAddressPrefix": { "type": "string", "description": "The source address prefix." }, "destinationAddressPrefix": { "type": "string", "description": "The destination address prefix." }, "sourceAddressPrefixes": { "type": "array", "items": { "type": "string" }, "description": "The source address prefixes. Expected values include CIDR IP ranges, Default Tags (VirtualNetwork, AzureLoadBalancer, Internet), System Tags, and the asterisk (*)." }, "destinationAddressPrefixes": { "type": "array", "items": { "type": "string" }, "description": "The destination address prefixes. Expected values include CIDR IP ranges, Default Tags (VirtualNetwork, AzureLoadBalancer, Internet), System Tags, and the asterisk (*)." }, "expandedSourceAddressPrefix": { "type": "array", "items": { "type": "string" }, "description": "The expanded source address prefix." }, "expandedDestinationAddressPrefix": { "type": "array", "items": { "type": "string" }, "description": "Expanded destination address prefix." }, "access": { "$ref": "./networkSecurityGroup.json#/definitions/SecurityRuleAccess", "description": "Whether network traffic is allowed or denied." }, "priority": { "type": "integer", "format": "int32", "description": "The priority of the rule." }, "direction": { "$ref": "./networkSecurityGroup.json#/definitions/SecurityRuleDirection", "description": "The direction of the rule." } }, "description": "Effective network security rules." }, "EffectiveNetworkSecurityGroupListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/EffectiveNetworkSecurityGroup" }, "description": "A list of effective network security groups." }, "nextLink": { "readOnly": true, "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for list effective network security groups API service call." }, "EffectiveRoute": { "properties": { "name": { "type": "string", "description": "The name of the user defined route. This is optional." }, "disableBgpRoutePropagation": { "type": "boolean", "description": "If true, on-premises routes are not propagated to the network interfaces in the subnet." }, "source": { "type": "string", "description": "Who created the route.", "enum": [ "Unknown", "User", "VirtualNetworkGateway", "Default" ], "x-ms-enum": { "name": "EffectiveRouteSource", "modelAsString": true } }, "state": { "type": "string", "description": "The value of effective route.", "enum": [ "Active", "Invalid" ], "x-ms-enum": { "name": "EffectiveRouteState", "modelAsString": true } }, "addressPrefix": { "type": "array", "items": { "type": "string" }, "description": "The address prefixes of the effective routes in CIDR notation." }, "nextHopIpAddress": { "type": "array", "items": { "type": "string" }, "description": "The IP address of the next hop of the effective route." }, "nextHopType": { "$ref": "./routeTable.json#/definitions/RouteNextHopType", "description": "The type of Azure hop the packet should be sent to." } }, "description": "Effective Route." }, "EffectiveRouteListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/EffectiveRoute" }, "description": "A list of effective routes." }, "nextLink": { "readOnly": true, "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for list effective route API service call." }, "IPConfigurationPropertiesFormat": { "properties": { "privateIPAddress": { "type": "string", "description": "The private IP address of the IP configuration." }, "privateIPAllocationMethod": { "$ref": "./network.json#/definitions/IPAllocationMethod", "description": "The private IP address allocation method." }, "subnet": { "$ref": "./virtualNetwork.json#/definitions/Subnet", "description": "The reference to the subnet resource." }, "publicIPAddress": { "$ref": "./publicIpAddress.json#/definitions/PublicIPAddress", "description": "The reference to the public IP resource." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the IP configuration resource." } }, "description": "Properties of IP configuration." }, "IPConfiguration": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/IPConfigurationPropertiesFormat", "description": "Properties of the IP configuration." }, "name": { "type": "string", "description": "The name of the resource that is unique within a resource group. This name can be used to access the resource." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "IP configuration." } } } analysis-0.21.1/fixtures/azure/networkProfile.json000066400000000000000000000503401413705513100223240ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "NetworkManagementClient", "description": "The Microsoft Azure Network management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to manage your network resources. The API has entities that capture the relationship between an end user and the Microsoft Azure Networks service.", "version": "2020-04-01" }, "host": "management.azure.com", "schemes": [ "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "security": [ { "azure_auth": [ "user_impersonation" ] } ], "securityDefinitions": { "azure_auth": { "type": "oauth2", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "flow": "implicit", "description": "Azure Active Directory OAuth2 Flow.", "scopes": { "user_impersonation": "impersonate your user account" } } }, "paths": { "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName}": { "delete": { "tags": [ "NetworkProfiles" ], "operationId": "NetworkProfiles_Delete", "description": "Deletes the specified network profile.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkProfileName", "in": "path", "required": true, "type": "string", "description": "The name of the NetworkProfile." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "204": { "description": "Request successful. Resource does not exist." }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "200": { "description": "Delete successful." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Delete network profile": { "$ref": "./examples/NetworkProfileDelete.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } }, "get": { "tags": [ "NetworkProfiles" ], "operationId": "NetworkProfiles_Get", "description": "Gets the specified network profile in a specified resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkProfileName", "in": "path", "required": true, "type": "string", "description": "The name of the public IP prefix." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" }, { "name": "$expand", "in": "query", "required": false, "type": "string", "description": "Expands referenced resources." } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting NetworkProfile resource.", "schema": { "$ref": "#/definitions/NetworkProfile" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Get network profile": { "$ref": "./examples/NetworkProfileGetConfigOnly.json" }, "Get network profile with container network interfaces": { "$ref": "./examples/NetworkProfileGetWithContainerNic.json" } } }, "put": { "tags": [ "NetworkProfiles" ], "operationId": "NetworkProfiles_CreateOrUpdate", "description": "Creates or updates a network profile.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkProfileName", "in": "path", "required": true, "type": "string", "description": "The name of the network profile." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/NetworkProfile" }, "description": "Parameters supplied to the create or update network profile operation." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "201": { "description": "Create successful. The operation returns the resulting NetworkProfile resource.", "schema": { "$ref": "#/definitions/NetworkProfile" } }, "200": { "description": "Update successful. The operation returns the resulting NetworkProfile resource.", "schema": { "$ref": "#/definitions/NetworkProfile" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Create network profile defaults": { "$ref": "./examples/NetworkProfileCreateConfigOnly.json" } }, "x-ms-long-running-operation": false }, "patch": { "tags": [ "NetworkProfiles" ], "operationId": "NetworkProfiles_UpdateTags", "description": "Updates network profile tags.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkProfileName", "in": "path", "required": true, "type": "string", "description": "The name of the network profile." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "./network.json#/definitions/TagsObject" }, "description": "Parameters supplied to update network profile tags." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting NetworkProfile resource.", "schema": { "$ref": "#/definitions/NetworkProfile" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Update network profile tags": { "$ref": "./examples/NetworkProfileUpdateTags.json" } } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkProfiles": { "get": { "tags": [ "NetworkProfiles" ], "operationId": "NetworkProfiles_ListAll", "description": "Gets all the network profiles in a subscription.", "parameters": [ { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of NetworkProfile resources.", "schema": { "$ref": "#/definitions/NetworkProfileListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "List all network profiles": { "$ref": "./examples/NetworkProfileListAll.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles": { "get": { "tags": [ "NetworkProfiles" ], "operationId": "NetworkProfiles_List", "description": "Gets all network profiles in a resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of NetworkProfile resources.", "schema": { "$ref": "#/definitions/NetworkProfileListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "List resource group network profiles": { "$ref": "./examples/NetworkProfileList.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } } }, "definitions": { "NetworkProfilePropertiesFormat": { "properties": { "containerNetworkInterfaces": { "readOnly": true, "type": "array", "items": { "$ref": "#/definitions/ContainerNetworkInterface" }, "description": "List of child container network interfaces." }, "containerNetworkInterfaceConfigurations": { "type": "array", "items": { "$ref": "#/definitions/ContainerNetworkInterfaceConfiguration" }, "description": "List of chid container network interface configurations." }, "resourceGuid": { "readOnly": true, "type": "string", "description": "The resource GUID property of the network profile resource." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the network profile resource." } }, "description": "Network profile properties." }, "NetworkProfile": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/NetworkProfilePropertiesFormat", "description": "Network profile properties." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/Resource" } ], "description": "Network profile resource." }, "NetworkProfileListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/NetworkProfile" }, "description": "A list of network profiles that exist in a resource group." }, "nextLink": { "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for ListNetworkProfiles API service call." }, "ContainerNetworkInterfacePropertiesFormat": { "properties": { "containerNetworkInterfaceConfiguration": { "readOnly": true, "$ref": "#/definitions/ContainerNetworkInterfaceConfiguration", "description": "Container network interface configuration from which this container network interface is created." }, "container": { "$ref": "#/definitions/Container", "description": "Reference to the container to which this container network interface is attached." }, "ipConfigurations": { "readOnly": true, "type": "array", "items": { "$ref": "#/definitions/ContainerNetworkInterfaceIpConfiguration" }, "description": "Reference to the ip configuration on this container nic." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the container network interface resource." } }, "description": "Properties of container network interface." }, "ContainerNetworkInterface": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ContainerNetworkInterfacePropertiesFormat", "description": "Container network interface properties." }, "name": { "type": "string", "description": "The name of the resource. This name can be used to access the resource." }, "type": { "readOnly": true, "type": "string", "description": "Sub Resource type." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Container network interface child resource." }, "ContainerNetworkInterfaceConfigurationPropertiesFormat": { "properties": { "ipConfigurations": { "type": "array", "items": { "$ref": "#/definitions/IPConfigurationProfile" }, "description": "A list of ip configurations of the container network interface configuration." }, "containerNetworkInterfaces": { "type": "array", "items": { "$ref": "./network.json#/definitions/SubResource" }, "description": "A list of container network interfaces created from this container network interface configuration." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the container network interface configuration resource." } }, "description": "Container network interface configuration properties." }, "ContainerNetworkInterfaceConfiguration": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ContainerNetworkInterfaceConfigurationPropertiesFormat", "description": "Container network interface configuration properties." }, "name": { "type": "string", "description": "The name of the resource. This name can be used to access the resource." }, "type": { "readOnly": true, "type": "string", "description": "Sub Resource type." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Container network interface configuration child resource." }, "IPConfigurationProfilePropertiesFormat": { "properties": { "subnet": { "$ref": "./virtualNetwork.json#/definitions/Subnet", "description": "The reference to the subnet resource to create a container network interface ip configuration." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the IP configuration profile resource." } }, "description": "IP configuration profile properties." }, "IPConfigurationProfile": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/IPConfigurationProfilePropertiesFormat", "description": "Properties of the IP configuration profile." }, "name": { "type": "string", "description": "The name of the resource. This name can be used to access the resource." }, "type": { "readOnly": true, "type": "string", "description": "Sub Resource type." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "IP configuration profile child resource." }, "Container": { "properties": {}, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Reference to container resource in remote resource provider." }, "ContainerNetworkInterfaceIpConfigurationPropertiesFormat": { "properties": { "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the container network interface IP configuration resource." } }, "description": "Properties of the container network interface IP configuration." }, "ContainerNetworkInterfaceIpConfiguration": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ContainerNetworkInterfaceIpConfigurationPropertiesFormat", "description": "Properties of the container network interface IP configuration." }, "name": { "type": "string", "description": "The name of the resource. This name can be used to access the resource." }, "type": { "readOnly": true, "type": "string", "description": "Sub Resource type." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "description": "The ip configuration for a container network interface." } } } analysis-0.21.1/fixtures/azure/networkSecurityGroup.json000066400000000000000000001001251413705513100235450ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "NetworkManagementClient", "description": "The Microsoft Azure Network management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to manage your network resources. The API has entities that capture the relationship between an end user and the Microsoft Azure Networks service.", "version": "2020-04-01" }, "host": "management.azure.com", "schemes": [ "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "security": [ { "azure_auth": [ "user_impersonation" ] } ], "securityDefinitions": { "azure_auth": { "type": "oauth2", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "flow": "implicit", "description": "Azure Active Directory OAuth2 Flow.", "scopes": { "user_impersonation": "impersonate your user account" } } }, "paths": { "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}": { "delete": { "tags": [ "NetworkSecurityGroups" ], "operationId": "NetworkSecurityGroups_Delete", "description": "Deletes the specified network security group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkSecurityGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the network security group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "202": { "description": "Accepted and the operation will complete asynchronously." }, "200": { "description": "Delete successful." }, "204": { "description": "Request successful. Resource does not exist." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Delete network security group": { "$ref": "./examples/NetworkSecurityGroupDelete.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } }, "get": { "tags": [ "NetworkSecurityGroups" ], "operationId": "NetworkSecurityGroups_Get", "description": "Gets the specified network security group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkSecurityGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the network security group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" }, { "name": "$expand", "in": "query", "required": false, "type": "string", "description": "Expands referenced resources." } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting NetworkSecurityGroup resource.", "schema": { "$ref": "#/definitions/NetworkSecurityGroup" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Get network security group": { "$ref": "./examples/NetworkSecurityGroupGet.json" } } }, "put": { "tags": [ "NetworkSecurityGroups" ], "operationId": "NetworkSecurityGroups_CreateOrUpdate", "description": "Creates or updates a network security group in the specified resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkSecurityGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the network security group." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/NetworkSecurityGroup" }, "description": "Parameters supplied to the create or update network security group operation." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "201": { "description": "Create successful. The operation returns the resulting NetworkSecurityGroup resource.", "schema": { "$ref": "#/definitions/NetworkSecurityGroup" } }, "200": { "description": "Update successful. The operation returns the resulting NetworkSecurityGroup resource.", "schema": { "$ref": "#/definitions/NetworkSecurityGroup" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Create network security group": { "$ref": "./examples/NetworkSecurityGroupCreate.json" }, "Create network security group with rule": { "$ref": "./examples/NetworkSecurityGroupCreateWithRule.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" } }, "patch": { "tags": [ "NetworkSecurityGroups" ], "operationId": "NetworkSecurityGroups_UpdateTags", "description": "Updates a network security group tags.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkSecurityGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the network security group." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "./network.json#/definitions/TagsObject" }, "description": "Parameters supplied to update network security group tags." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting NetworkSecurityGroup resource.", "schema": { "$ref": "#/definitions/NetworkSecurityGroup" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Update network security group tags": { "$ref": "./examples/NetworkSecurityGroupUpdateTags.json" } } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkSecurityGroups": { "get": { "tags": [ "NetworkSecurityGroups" ], "operationId": "NetworkSecurityGroups_ListAll", "description": "Gets all network security groups in a subscription.", "parameters": [ { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of NetworkSecurityGroup resources.", "schema": { "$ref": "#/definitions/NetworkSecurityGroupListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "List all network security groups": { "$ref": "./examples/NetworkSecurityGroupListAll.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups": { "get": { "tags": [ "NetworkSecurityGroups" ], "operationId": "NetworkSecurityGroups_List", "description": "Gets all network security groups in a resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of NetworkSecurityGroup resources.", "schema": { "$ref": "#/definitions/NetworkSecurityGroupListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "List network security groups in resource group": { "$ref": "./examples/NetworkSecurityGroupList.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}": { "delete": { "tags": [ "SecurityRules" ], "operationId": "SecurityRules_Delete", "description": "Deletes the specified network security rule.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkSecurityGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the network security group." }, { "name": "securityRuleName", "in": "path", "required": true, "type": "string", "description": "The name of the security rule." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "204": { "description": "Request successful. Resource does not exist." }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "200": { "description": "Delete successful." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Delete network security rule from network security group": { "$ref": "./examples/NetworkSecurityGroupRuleDelete.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } }, "get": { "tags": [ "SecurityRules" ], "operationId": "SecurityRules_Get", "description": "Get the specified network security rule.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkSecurityGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the network security group." }, { "name": "securityRuleName", "in": "path", "required": true, "type": "string", "description": "The name of the security rule." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting SecurityRule resource.", "schema": { "$ref": "#/definitions/SecurityRule" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Get network security rule in network security group": { "$ref": "./examples/NetworkSecurityGroupRuleGet.json" } } }, "put": { "tags": [ "SecurityRules" ], "operationId": "SecurityRules_CreateOrUpdate", "description": "Creates or updates a security rule in the specified network security group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkSecurityGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the network security group." }, { "name": "securityRuleName", "in": "path", "required": true, "type": "string", "description": "The name of the security rule." }, { "name": "securityRuleParameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/SecurityRule" }, "description": "Parameters supplied to the create or update network security rule operation." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting SecurityRule resource.", "schema": { "$ref": "#/definitions/SecurityRule" } }, "201": { "description": "Create successful. The operation returns the resulting SecurityRule resource.", "schema": { "$ref": "#/definitions/SecurityRule" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Create security rule": { "$ref": "./examples/NetworkSecurityGroupRuleCreate.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules": { "get": { "tags": [ "SecurityRules" ], "operationId": "SecurityRules_List", "description": "Gets all security rules in a network security group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkSecurityGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the network security group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of SecurityRule resources.", "schema": { "$ref": "#/definitions/SecurityRuleListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "List network security rules in network security group": { "$ref": "./examples/NetworkSecurityGroupRuleList.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules": { "get": { "tags": [ "SecurityRules" ], "operationId": "DefaultSecurityRules_List", "description": "Gets all default security rules in a network security group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkSecurityGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the network security group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of SecurityRule resources.", "schema": { "$ref": "#/definitions/SecurityRuleListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "DefaultSecurityRuleList": { "$ref": "./examples/DefaultSecurityRuleList.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules/{defaultSecurityRuleName}": { "get": { "tags": [ "SecurityRules" ], "operationId": "DefaultSecurityRules_Get", "description": "Get the specified default network security rule.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkSecurityGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the network security group." }, { "name": "defaultSecurityRuleName", "in": "path", "required": true, "type": "string", "description": "The name of the default security rule." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting SecurityRule resource.", "schema": { "$ref": "#/definitions/SecurityRule" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "DefaultSecurityRuleGet": { "$ref": "./examples/DefaultSecurityRuleGet.json" } } } } }, "definitions": { "SecurityRulePropertiesFormat": { "properties": { "description": { "type": "string", "description": "A description for this rule. Restricted to 140 chars." }, "protocol": { "type": "string", "description": "Network protocol this rule applies to.", "enum": [ "Tcp", "Udp", "Icmp", "Esp", "*", "Ah" ], "x-ms-enum": { "name": "SecurityRuleProtocol", "modelAsString": true } }, "sourcePortRange": { "type": "string", "description": "The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports." }, "destinationPortRange": { "type": "string", "description": "The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports." }, "sourceAddressPrefix": { "type": "string", "description": "The CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from." }, "sourceAddressPrefixes": { "type": "array", "items": { "type": "string" }, "description": "The CIDR or source IP ranges." }, "sourceApplicationSecurityGroups": { "type": "array", "items": { "$ref": "./applicationSecurityGroup.json#/definitions/ApplicationSecurityGroup" }, "description": "The application security group specified as source." }, "destinationAddressPrefix": { "type": "string", "description": "The destination address prefix. CIDR or destination IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used." }, "destinationAddressPrefixes": { "type": "array", "items": { "type": "string" }, "description": "The destination address prefixes. CIDR or destination IP ranges." }, "destinationApplicationSecurityGroups": { "type": "array", "items": { "$ref": "./applicationSecurityGroup.json#/definitions/ApplicationSecurityGroup" }, "description": "The application security group specified as destination." }, "sourcePortRanges": { "type": "array", "items": { "type": "string", "description": "The source port." }, "description": "The source port ranges." }, "destinationPortRanges": { "type": "array", "items": { "type": "string", "description": "The destination port." }, "description": "The destination port ranges." }, "access": { "$ref": "#/definitions/SecurityRuleAccess", "description": "The network traffic is allowed or denied." }, "priority": { "type": "integer", "format": "int32", "description": "The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule." }, "direction": { "$ref": "#/definitions/SecurityRuleDirection", "description": "The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the security rule resource." } }, "required": [ "protocol", "access", "direction" ], "description": "Security rule resource." }, "SecurityRule": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/SecurityRulePropertiesFormat", "description": "Properties of the security rule." }, "name": { "type": "string", "description": "The name of the resource that is unique within a resource group. This name can be used to access the resource." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Network security rule." }, "SecurityRuleListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/SecurityRule" }, "description": "The security rules in a network security group." }, "nextLink": { "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for ListSecurityRule API service call. Retrieves all security rules that belongs to a network security group." }, "NetworkSecurityGroupPropertiesFormat": { "properties": { "securityRules": { "type": "array", "items": { "$ref": "#/definitions/SecurityRule" }, "description": "A collection of security rules of the network security group." }, "defaultSecurityRules": { "readOnly": true, "type": "array", "items": { "$ref": "#/definitions/SecurityRule" }, "description": "The default security rules of network security group." }, "networkInterfaces": { "readOnly": true, "type": "array", "items": { "$ref": "./networkInterface.json#/definitions/NetworkInterface" }, "description": "A collection of references to network interfaces." }, "subnets": { "readOnly": true, "type": "array", "items": { "$ref": "./virtualNetwork.json#/definitions/Subnet" }, "description": "A collection of references to subnets." }, "flowLogs": { "readOnly": true, "type": "array", "items": { "$ref": "./networkWatcher.json#/definitions/FlowLog" }, "description": "A collection of references to flow log resources." }, "resourceGuid": { "readOnly": true, "type": "string", "description": "The resource GUID property of the network security group resource." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the network security group resource." } }, "description": "Network Security Group resource." }, "NetworkSecurityGroup": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/NetworkSecurityGroupPropertiesFormat", "description": "Properties of the network security group." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/Resource" } ], "description": "NetworkSecurityGroup resource." }, "NetworkSecurityGroupListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/NetworkSecurityGroup" }, "description": "A list of NetworkSecurityGroup resources." }, "nextLink": { "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for ListNetworkSecurityGroups API service call." }, "SecurityRuleAccess": { "type": "string", "description": "Whether network traffic is allowed or denied.", "enum": [ "Allow", "Deny" ], "x-ms-enum": { "name": "SecurityRuleAccess", "modelAsString": true } }, "SecurityRuleDirection": { "type": "string", "description": "The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.", "enum": [ "Inbound", "Outbound" ], "x-ms-enum": { "name": "SecurityRuleDirection", "modelAsString": true } } } } analysis-0.21.1/fixtures/azure/networkWatcher.json000066400000000000000000004351451413705513100223330ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "NetworkManagementClient", "description": "The Microsoft Azure Network management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to manage your network resources. The API has entities that capture the relationship between an end user and the Microsoft Azure Networks service.", "version": "2020-04-01" }, "host": "management.azure.com", "schemes": [ "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "security": [ { "azure_auth": [ "user_impersonation" ] } ], "securityDefinitions": { "azure_auth": { "type": "oauth2", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "flow": "implicit", "description": "Azure Active Directory OAuth2 Flow.", "scopes": { "user_impersonation": "impersonate your user account" } } }, "paths": { "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}": { "put": { "tags": [ "NetworkWatchers" ], "operationId": "NetworkWatchers_CreateOrUpdate", "description": "Creates or updates a network watcher in the specified resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/NetworkWatcher" }, "description": "Parameters that define the network watcher resource." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting network watcher resource.", "schema": { "$ref": "#/definitions/NetworkWatcher" } }, "201": { "description": "Create successful. The operation returns the resulting network watcher resource.", "schema": { "$ref": "#/definitions/NetworkWatcher" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Create network watcher": { "$ref": "./examples/NetworkWatcherCreate.json" } } }, "get": { "tags": [ "NetworkWatchers" ], "operationId": "NetworkWatchers_Get", "description": "Gets the specified network watcher by resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a network watcher resource.", "schema": { "$ref": "#/definitions/NetworkWatcher" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Get network watcher": { "$ref": "./examples/NetworkWatcherGet.json" } } }, "delete": { "tags": [ "NetworkWatchers" ], "operationId": "NetworkWatchers_Delete", "description": "Deletes the specified network watcher resource.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "202": { "description": "Accepted and the operation will complete asynchronously." }, "204": { "description": "Delete successful." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Delete network watcher": { "$ref": "./examples/NetworkWatcherDelete.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } }, "patch": { "tags": [ "NetworkWatchers" ], "operationId": "NetworkWatchers_UpdateTags", "description": "Updates a network watcher tags.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "./network.json#/definitions/TagsObject" }, "description": "Parameters supplied to update network watcher tags." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting network watcher resource.", "schema": { "$ref": "#/definitions/NetworkWatcher" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Update network watcher tags": { "$ref": "./examples/NetworkWatcherUpdateTags.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers": { "get": { "tags": [ "NetworkWatchers" ], "operationId": "NetworkWatchers_List", "description": "Gets all network watchers by resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of network watcher resources.", "schema": { "$ref": "#/definitions/NetworkWatcherListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-pageable": { "nextLinkName": null }, "x-ms-examples": { "List network watchers": { "$ref": "./examples/NetworkWatcherList.json" } } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkWatchers": { "get": { "tags": [ "NetworkWatchers" ], "operationId": "NetworkWatchers_ListAll", "description": "Gets all network watchers by subscription.", "parameters": [ { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of network watcher resources.", "schema": { "$ref": "#/definitions/NetworkWatcherListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-pageable": { "nextLinkName": null }, "x-ms-examples": { "List all network watchers": { "$ref": "./examples/NetworkWatcherListAll.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/topology": { "post": { "tags": [ "NetworkWatchers" ], "operationId": "NetworkWatchers_GetTopology", "description": "Gets the current network topology by resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/TopologyParameters" }, "description": "Parameters that define the representation of topology." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns the topology of resource group.", "schema": { "$ref": "#/definitions/Topology" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Get Topology": { "$ref": "./examples/NetworkWatcherTopologyGet.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/ipFlowVerify": { "post": { "tags": [ "NetworkWatchers" ], "operationId": "NetworkWatchers_VerifyIPFlow", "description": "Verify IP flow from the specified VM to a location given the currently configured NSG rules.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/VerificationIPFlowParameters" }, "description": "Parameters that define the IP flow to be verified." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns the result of IP flow verification.", "schema": { "$ref": "#/definitions/VerificationIPFlowResult" } }, "202": { "description": "Accepted and the operation will complete asynchronously.", "schema": { "$ref": "#/definitions/VerificationIPFlowResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Ip flow verify": { "$ref": "./examples/NetworkWatcherIpFlowVerify.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/nextHop": { "post": { "tags": [ "NetworkWatchers" ], "operationId": "NetworkWatchers_GetNextHop", "description": "Gets the next hop from the specified VM.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/NextHopParameters" }, "description": "Parameters that define the source and destination endpoint." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns the next hop from the VM.", "schema": { "$ref": "#/definitions/NextHopResult" } }, "202": { "description": "Accepted and the operation will complete asynchronously.", "schema": { "$ref": "#/definitions/NextHopResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Get next hop": { "$ref": "./examples/NetworkWatcherNextHopGet.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/securityGroupView": { "post": { "tags": [ "NetworkWatchers" ], "operationId": "NetworkWatchers_GetVMSecurityRules", "description": "Gets the configured and effective security group rules on the specified VM.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/SecurityGroupViewParameters" }, "description": "Parameters that define the VM to check security groups for." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns security group rules on the VM.", "schema": { "$ref": "#/definitions/SecurityGroupViewResult" } }, "202": { "description": "Accepted and the operation will complete asynchronously.", "schema": { "$ref": "#/definitions/SecurityGroupViewResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Get security group view": { "$ref": "./examples/NetworkWatcherSecurityGroupViewGet.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}": { "put": { "tags": [ "PacketCaptures" ], "operationId": "PacketCaptures_Create", "description": "Create and start a packet capture on the specified VM.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher." }, { "name": "packetCaptureName", "in": "path", "required": true, "type": "string", "description": "The name of the packet capture session." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/PacketCapture" }, "description": "Parameters that define the create packet capture operation." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "201": { "description": "Request successful. The operation returns the resulting packet capture session.", "schema": { "$ref": "#/definitions/PacketCaptureResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Create packet capture": { "$ref": "./examples/NetworkWatcherPacketCaptureCreate.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" } }, "get": { "tags": [ "PacketCaptures" ], "operationId": "PacketCaptures_Get", "description": "Gets a packet capture session by name.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher." }, { "name": "packetCaptureName", "in": "path", "required": true, "type": "string", "description": "The name of the packet capture session." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a packet capture session.", "schema": { "$ref": "#/definitions/PacketCaptureResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Get packet capture": { "$ref": "./examples/NetworkWatcherPacketCaptureGet.json" } } }, "delete": { "tags": [ "PacketCaptures" ], "operationId": "PacketCaptures_Delete", "description": "Deletes the specified packet capture session.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher." }, { "name": "packetCaptureName", "in": "path", "required": true, "type": "string", "description": "The name of the packet capture session." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "204": { "description": "Delete successful." }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Delete packet capture": { "$ref": "./examples/NetworkWatcherPacketCaptureDelete.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/stop": { "post": { "tags": [ "PacketCaptures" ], "operationId": "PacketCaptures_Stop", "description": "Stops a specified packet capture session.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher." }, { "name": "packetCaptureName", "in": "path", "required": true, "type": "string", "description": "The name of the packet capture session." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation stops the packet capture session." }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Stop packet capture": { "$ref": "./examples/NetworkWatcherPacketCaptureStop.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/queryStatus": { "post": { "tags": [ "PacketCaptures" ], "operationId": "PacketCaptures_GetStatus", "description": "Query the status of a running packet capture session.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the Network Watcher resource." }, { "name": "packetCaptureName", "in": "path", "required": true, "type": "string", "description": "The name given to the packet capture session." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Successful query of packet capture status.", "schema": { "$ref": "#/definitions/PacketCaptureQueryStatusResult" } }, "202": { "description": "Accepted query status of packet capture.", "schema": { "$ref": "#/definitions/PacketCaptureQueryStatusResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Query packet capture status": { "$ref": "./examples/NetworkWatcherPacketCaptureQueryStatus.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures": { "get": { "tags": [ "PacketCaptures" ], "operationId": "PacketCaptures_List", "description": "Lists all packet capture sessions within the specified resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the Network Watcher resource." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Successful packet capture enumeration request.", "schema": { "$ref": "#/definitions/PacketCaptureListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-pageable": { "nextLinkName": null }, "x-ms-examples": { "List packet captures": { "$ref": "./examples/NetworkWatcherPacketCapturesList.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/troubleshoot": { "post": { "tags": [ "NetworkWatchers" ], "operationId": "NetworkWatchers_GetTroubleshooting", "description": "Initiate troubleshooting on a specified resource.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher resource." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/TroubleshootingParameters" }, "description": "Parameters that define the resource to troubleshoot." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Successful troubleshooting request.", "schema": { "$ref": "#/definitions/TroubleshootingResult" } }, "202": { "description": "Accepted get troubleshooting request.", "schema": { "$ref": "#/definitions/TroubleshootingResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Get troubleshooting": { "$ref": "./examples/NetworkWatcherTroubleshootGet.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryTroubleshootResult": { "post": { "tags": [ "NetworkWatchers" ], "operationId": "NetworkWatchers_GetTroubleshootingResult", "description": "Get the last completed troubleshooting result on a specified resource.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher resource." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/QueryTroubleshootingParameters" }, "description": "Parameters that define the resource to query the troubleshooting result." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Successful get troubleshooting result request.", "schema": { "$ref": "#/definitions/TroubleshootingResult" } }, "202": { "description": "Accepted get troubleshooting result request.", "schema": { "$ref": "#/definitions/TroubleshootingResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Get troubleshoot result": { "$ref": "./examples/NetworkWatcherTroubleshootResultQuery.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/configureFlowLog": { "post": { "tags": [ "NetworkWatchers", "TrafficAnalytics" ], "operationId": "NetworkWatchers_SetFlowLogConfiguration", "description": "Configures flow log and traffic analytics (optional) on a specified resource.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher resource." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/FlowLogInformation" }, "description": "Parameters that define the configuration of flow log." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Successful request for setting flow log and traffic analytics (optional) configuration.", "schema": { "$ref": "#/definitions/FlowLogInformation" } }, "202": { "description": "Accepted and the operation will complete asynchronously.", "schema": { "$ref": "#/definitions/FlowLogInformation" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Configure flow log": { "$ref": "./examples/NetworkWatcherFlowLogConfigure.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryFlowLogStatus": { "post": { "tags": [ "NetworkWatchers", "TrafficAnalytics" ], "operationId": "NetworkWatchers_GetFlowLogStatus", "description": "Queries status of flow log and traffic analytics (optional) on a specified resource.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher resource." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/FlowLogStatusParameters" }, "description": "Parameters that define a resource to query flow log and traffic analytics (optional) status." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Successful request for query flow log and traffic analytics (optional) status.", "schema": { "$ref": "#/definitions/FlowLogInformation" } }, "202": { "description": "Accepted and the operation will complete asynchronously.", "schema": { "$ref": "#/definitions/FlowLogInformation" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Get flow log status": { "$ref": "./examples/NetworkWatcherFlowLogStatusQuery.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectivityCheck": { "post": { "tags": [ "NetworkWatchers" ], "operationId": "NetworkWatchers_CheckConnectivity", "description": "Verifies the possibility of establishing a direct TCP connection from a virtual machine to a given endpoint including another VM or an arbitrary remote server.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher resource." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/ConnectivityParameters" }, "description": "Parameters that determine how the connectivity check will be performed." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Successful request for checking connectivity.", "schema": { "$ref": "#/definitions/ConnectivityInformation" } }, "202": { "description": "Accepted and the operation will complete asynchronously.", "schema": { "$ref": "#/definitions/ConnectivityInformation" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Check connectivity": { "$ref": "./examples/NetworkWatcherConnectivityCheck.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/azureReachabilityReport": { "post": { "tags": [ "NetworkWatchers" ], "operationId": "NetworkWatchers_GetAzureReachabilityReport", "description": "NOTE: This feature is currently in preview and still being tested for stability. Gets the relative latency score for internet service providers from a specified location to Azure regions.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher resource." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/AzureReachabilityReportParameters" }, "description": "Parameters that determine Azure reachability report configuration." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Successful request for Azure reachability report.", "schema": { "$ref": "#/definitions/AzureReachabilityReport" } }, "202": { "description": "Accepted and the operation will complete asynchronously.", "schema": { "$ref": "#/definitions/AzureReachabilityReport" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Get Azure Reachability Report": { "$ref": "./examples/NetworkWatcherAzureReachabilityReportGet.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/availableProvidersList": { "post": { "tags": [ "NetworkWatchers" ], "operationId": "NetworkWatchers_ListAvailableProviders", "description": "NOTE: This feature is currently in preview and still being tested for stability. Lists all available internet service providers for a specified Azure region.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher resource." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/AvailableProvidersListParameters" }, "description": "Parameters that scope the list of available providers." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Successful request for list of available providers.", "schema": { "$ref": "#/definitions/AvailableProvidersList" } }, "202": { "description": "Accepted and the operation will complete asynchronously.", "schema": { "$ref": "#/definitions/AvailableProvidersList" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Get Available Providers List": { "$ref": "./examples/NetworkWatcherAvailableProvidersListGet.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/networkConfigurationDiagnostic": { "post": { "tags": [ "NetworkWatchers" ], "operationId": "NetworkWatchers_GetNetworkConfigurationDiagnostic", "description": "Gets Network Configuration Diagnostic data to help customers understand and debug network behavior. It provides detailed information on what security rules were applied to a specified traffic flow and the result of evaluating these rules. Customers must provide details of a flow like source, destination, protocol, etc. The API returns whether traffic was allowed or denied, the rules evaluated for the specified flow and the evaluation results.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/NetworkConfigurationDiagnosticParameters" }, "description": "Parameters to get network configuration diagnostic." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns the result of network configuration diagnostic.", "schema": { "$ref": "#/definitions/NetworkConfigurationDiagnosticResponse" } }, "202": { "description": "Accepted and the operation will complete asynchronously.", "schema": { "$ref": "#/definitions/NetworkConfigurationDiagnosticResponse" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Network configuration diagnostic": { "$ref": "./examples/NetworkWatcherNetworkConfigurationDiagnostic.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}": { "put": { "tags": [ "ConnectionMonitors" ], "operationId": "ConnectionMonitors_CreateOrUpdate", "description": "Create or update a connection monitor.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group containing Network Watcher." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the Network Watcher resource." }, { "name": "connectionMonitorName", "in": "path", "required": true, "type": "string", "description": "The name of the connection monitor." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/ConnectionMonitor" }, "description": "Parameters that define the operation to create a connection monitor." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting network watcher resource.", "schema": { "$ref": "#/definitions/ConnectionMonitorResult" } }, "201": { "description": "Create successful. The operation returns the resulting network watcher resource.", "schema": { "$ref": "#/definitions/ConnectionMonitorResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./networkWatcher.json#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Create connection monitor V1": { "$ref": "./examples/NetworkWatcherConnectionMonitorCreate.json" }, "Create connection monitor V2": { "$ref": "./examples/NetworkWatcherConnectionMonitorV2Create.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" } }, "get": { "tags": [ "ConnectionMonitors" ], "operationId": "ConnectionMonitors_Get", "description": "Gets a connection monitor by name.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group containing Network Watcher." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the Network Watcher resource." }, { "name": "connectionMonitorName", "in": "path", "required": true, "type": "string", "description": "The name of the connection monitor." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a connection monitor.", "schema": { "$ref": "#/definitions/ConnectionMonitorResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./networkWatcher.json#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Get connection monitor": { "$ref": "./examples/NetworkWatcherConnectionMonitorGet.json" } } }, "delete": { "tags": [ "ConnectionMonitors" ], "operationId": "ConnectionMonitors_Delete", "description": "Deletes the specified connection monitor.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group containing Network Watcher." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the Network Watcher resource." }, { "name": "connectionMonitorName", "in": "path", "required": true, "type": "string", "description": "The name of the connection monitor." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "204": { "description": "Delete successful." }, "202": { "description": "Accepted. The operation will complete asynchronously." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./networkWatcher.json#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Delete connection monitor": { "$ref": "./examples/NetworkWatcherConnectionMonitorDelete.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } }, "patch": { "tags": [ "ConnectionMonitors" ], "operationId": "ConnectionMonitors_UpdateTags", "description": "Update tags of the specified connection monitor.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher." }, { "name": "connectionMonitorName", "in": "path", "required": true, "type": "string", "description": "The name of the connection monitor." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "./network.json#/definitions/TagsObject" }, "description": "Parameters supplied to update connection monitor tags." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns updated connection monitor.", "schema": { "$ref": "#/definitions/ConnectionMonitorResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./networkWatcher.json#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Update connection monitor tags": { "$ref": "./examples/NetworkWatcherConnectionMonitorUpdateTags.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/stop": { "post": { "tags": [ "ConnectionMonitors" ], "operationId": "ConnectionMonitors_Stop", "description": "Stops the specified connection monitor.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group containing Network Watcher." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the Network Watcher resource." }, { "name": "connectionMonitorName", "in": "path", "required": true, "type": "string", "description": "The name of the connection monitor." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation stops the connection monitor." }, "202": { "description": "Accepted. The operation will complete asynchronously." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./networkWatcher.json#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Stop connection monitor": { "$ref": "./examples/NetworkWatcherConnectionMonitorStop.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/start": { "post": { "tags": [ "ConnectionMonitors" ], "operationId": "ConnectionMonitors_Start", "description": "Starts the specified connection monitor.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group containing Network Watcher." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the Network Watcher resource." }, { "name": "connectionMonitorName", "in": "path", "required": true, "type": "string", "description": "The name of the connection monitor." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation starts the connection monitor." }, "202": { "description": "Accepted. The operation will complete asynchronously." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./networkWatcher.json#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Start connection monitor": { "$ref": "./examples/NetworkWatcherConnectionMonitorStart.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/query": { "post": { "tags": [ "ConnectionMonitors" ], "operationId": "ConnectionMonitors_Query", "description": "Query a snapshot of the most recent connection states.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group containing Network Watcher." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the Network Watcher resource." }, { "name": "connectionMonitorName", "in": "path", "required": true, "type": "string", "description": "The name given to the connection monitor." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Successful query of connection states.", "schema": { "$ref": "#/definitions/ConnectionMonitorQueryResult" } }, "202": { "description": "Accepted query of connection states.", "schema": { "$ref": "#/definitions/ConnectionMonitorQueryResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./networkWatcher.json#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Query connection monitor": { "$ref": "./examples/NetworkWatcherConnectionMonitorQuery.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors": { "get": { "tags": [ "ConnectionMonitors" ], "operationId": "ConnectionMonitors_List", "description": "Lists all connection monitors for the specified Network Watcher.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group containing Network Watcher." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the Network Watcher resource." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Successful connection monitor enumeration request.", "schema": { "$ref": "#/definitions/ConnectionMonitorListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./networkWatcher.json#/definitions/ErrorResponse" } } }, "x-ms-pageable": { "nextLinkName": null }, "x-ms-examples": { "List connection monitors": { "$ref": "./examples/NetworkWatcherConnectionMonitorList.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}": { "put": { "tags": [ "FlowLogs" ], "operationId": "FlowLogs_CreateOrUpdate", "description": "Create or update a flow log for the specified network security group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher." }, { "name": "flowLogName", "in": "path", "required": true, "type": "string", "description": "The name of the flow log." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/FlowLog" }, "description": "Parameters that define the create or update flow log resource." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "201": { "description": "Request successful. The operation returns the resulting flow log resource.", "schema": { "$ref": "#/definitions/FlowLog" } }, "200": { "description": "Update successful. The operation returns the resulting flow log resource.", "schema": { "$ref": "#/definitions/FlowLog" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Create or update flow log": { "$ref": "./examples/NetworkWatcherFlowLogCreate.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" } }, "get": { "tags": [ "FlowLogs" ], "operationId": "FlowLogs_Get", "description": "Gets a flow log resource by name.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher." }, { "name": "flowLogName", "in": "path", "required": true, "type": "string", "description": "The name of the flow log resource." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a flow log resource.", "schema": { "$ref": "#/definitions/FlowLog" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Get flow log": { "$ref": "./examples/NetworkWatcherFlowLogGet.json" } } }, "delete": { "tags": [ "FlowLogs" ], "operationId": "FlowLogs_Delete", "description": "Deletes the specified flow log resource.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the network watcher." }, { "name": "flowLogName", "in": "path", "required": true, "type": "string", "description": "The name of the flow log resource." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "204": { "description": "Delete successful." }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Delete flow log": { "$ref": "./examples/NetworkWatcherFlowLogDelete.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs": { "get": { "tags": [ "FlowLogs" ], "operationId": "FlowLogs_List", "description": "Lists all flow log resources for the specified Network Watcher.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group containing Network Watcher." }, { "name": "networkWatcherName", "in": "path", "required": true, "type": "string", "description": "The name of the Network Watcher resource." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Successful flow log enumeration request.", "schema": { "$ref": "#/definitions/FlowLogListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./networkWatcher.json#/definitions/ErrorResponse" } } }, "x-ms-pageable": { "nextLinkName": "nextLink" }, "x-ms-examples": { "List connection monitors": { "$ref": "./examples/NetworkWatcherFlowLogList.json" } } } } }, "definitions": { "ErrorResponse": { "description": "The error object.", "properties": { "error": { "title": "Error", "$ref": "./network.json#/definitions/ErrorDetails", "description": "The error details object." } } }, "NetworkWatcher": { "properties": { "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/NetworkWatcherPropertiesFormat", "description": "Properties of the network watcher." } }, "allOf": [ { "$ref": "./network.json#/definitions/Resource" } ], "description": "Network watcher in a resource group." }, "NetworkWatcherPropertiesFormat": { "properties": { "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the network watcher resource." } }, "description": "The network watcher properties." }, "NetworkWatcherListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/NetworkWatcher" }, "description": "List of network watcher resources." } }, "description": "Response for ListNetworkWatchers API service call." }, "TopologyParameters": { "properties": { "targetResourceGroupName": { "type": "string", "description": "The name of the target resource group to perform topology on." }, "targetVirtualNetwork": { "$ref": "./network.json#/definitions/SubResource", "description": "The reference to the Virtual Network resource." }, "targetSubnet": { "$ref": "./network.json#/definitions/SubResource", "description": "The reference to the Subnet resource." } }, "description": "Parameters that define the representation of topology." }, "Topology": { "properties": { "id": { "readOnly": true, "type": "string", "description": "GUID representing the operation id." }, "createdDateTime": { "readOnly": true, "type": "string", "format": "date-time", "description": "The datetime when the topology was initially created for the resource group." }, "lastModified": { "readOnly": true, "type": "string", "format": "date-time", "description": "The datetime when the topology was last modified." }, "resources": { "type": "array", "items": { "$ref": "#/definitions/TopologyResource" }, "description": "A list of topology resources." } }, "description": "Topology of the specified resource group." }, "TopologyResource": { "properties": { "name": { "type": "string", "description": "Name of the resource." }, "id": { "type": "string", "description": "ID of the resource." }, "location": { "type": "string", "description": "Resource location." }, "associations": { "type": "array", "description": "Holds the associations the resource has with other resources in the resource group.", "items": { "$ref": "#/definitions/TopologyAssociation" } } }, "description": "The network resource topology information for the given resource group." }, "TopologyAssociation": { "properties": { "name": { "type": "string", "description": "The name of the resource that is associated with the parent resource." }, "resourceId": { "type": "string", "description": "The ID of the resource that is associated with the parent resource." }, "associationType": { "type": "string", "enum": [ "Associated", "Contains" ], "x-ms-enum": { "name": "AssociationType", "modelAsString": true }, "description": "The association type of the child resource to the parent resource." } }, "description": "Resources that have an association with the parent resource." }, "VerificationIPFlowParameters": { "description": "Parameters that define the IP flow to be verified.", "required": [ "targetResourceId", "direction", "protocol", "localPort", "remotePort", "localIPAddress", "remoteIPAddress" ], "properties": { "targetResourceId": { "type": "string", "description": "The ID of the target resource to perform next-hop on." }, "direction": { "$ref": "#/definitions/Direction", "description": "The direction of the packet represented as a 5-tuple." }, "protocol": { "type": "string", "enum": [ "TCP", "UDP" ], "x-ms-enum": { "name": "IpFlowProtocol", "modelAsString": true }, "description": "Protocol to be verified on." }, "localPort": { "type": "string", "description": "The local port. Acceptable values are a single integer in the range (0-65535). Support for * for the source port, which depends on the direction." }, "remotePort": { "type": "string", "description": "The remote port. Acceptable values are a single integer in the range (0-65535). Support for * for the source port, which depends on the direction." }, "localIPAddress": { "type": "string", "description": "The local IP address. Acceptable values are valid IPv4 addresses." }, "remoteIPAddress": { "type": "string", "description": "The remote IP address. Acceptable values are valid IPv4 addresses." }, "targetNicResourceId": { "type": "string", "description": "The NIC ID. (If VM has multiple NICs and IP forwarding is enabled on any of them, then this parameter must be specified. Otherwise optional)." } } }, "VerificationIPFlowResult": { "description": "Results of IP flow verification on the target resource.", "properties": { "access": { "$ref": "./network.json#/definitions/Access", "description": "Indicates whether the traffic is allowed or denied." }, "ruleName": { "type": "string", "description": "Name of the rule. If input is not matched against any security rule, it is not displayed." } } }, "NextHopParameters": { "description": "Parameters that define the source and destination endpoint.", "required": [ "targetResourceId", "sourceIPAddress", "destinationIPAddress" ], "properties": { "targetResourceId": { "type": "string", "description": "The resource identifier of the target resource against which the action is to be performed." }, "sourceIPAddress": { "type": "string", "description": "The source IP address." }, "destinationIPAddress": { "type": "string", "description": "The destination IP address." }, "targetNicResourceId": { "type": "string", "description": "The NIC ID. (If VM has multiple NICs and IP forwarding is enabled on any of the nics, then this parameter must be specified. Otherwise optional)." } } }, "NextHopResult": { "description": "The information about next hop from the specified VM.", "properties": { "nextHopType": { "type": "string", "enum": [ "Internet", "VirtualAppliance", "VirtualNetworkGateway", "VnetLocal", "HyperNetGateway", "None" ], "x-ms-enum": { "name": "NextHopType", "modelAsString": true }, "description": "Next hop type." }, "nextHopIpAddress": { "type": "string", "description": "Next hop IP Address." }, "routeTableId": { "type": "string", "description": "The resource identifier for the route table associated with the route being returned. If the route being returned does not correspond to any user created routes then this field will be the string 'System Route'." } } }, "SecurityGroupViewParameters": { "description": "Parameters that define the VM to check security groups for.", "required": [ "targetResourceId" ], "properties": { "targetResourceId": { "type": "string", "description": "ID of the target VM." } } }, "SecurityGroupViewResult": { "description": "The information about security rules applied to the specified VM.", "properties": { "networkInterfaces": { "type": "array", "description": "List of network interfaces on the specified VM.", "items": { "$ref": "#/definitions/SecurityGroupNetworkInterface" } } } }, "SecurityGroupNetworkInterface": { "description": "Network interface and all its associated security rules.", "properties": { "id": { "type": "string", "description": "ID of the network interface." }, "securityRuleAssociations": { "$ref": "#/definitions/SecurityRuleAssociations", "description": "All security rules associated with the network interface." } } }, "SecurityRuleAssociations": { "description": "All security rules associated with the network interface.", "properties": { "networkInterfaceAssociation": { "$ref": "#/definitions/NetworkInterfaceAssociation", "description": "Network interface and it's custom security rules." }, "subnetAssociation": { "$ref": "#/definitions/SubnetAssociation", "description": "Subnet and it's custom security rules." }, "defaultSecurityRules": { "type": "array", "items": { "$ref": "./networkSecurityGroup.json#/definitions/SecurityRule" }, "description": "Collection of default security rules of the network security group." }, "effectiveSecurityRules": { "type": "array", "items": { "$ref": "./networkInterface.json#/definitions/EffectiveNetworkSecurityRule" }, "description": "Collection of effective security rules." } } }, "NetworkInterfaceAssociation": { "description": "Network interface and its custom security rules.", "properties": { "id": { "readOnly": true, "type": "string", "description": "Network interface ID." }, "securityRules": { "type": "array", "description": "Collection of custom security rules.", "items": { "$ref": "./networkSecurityGroup.json#/definitions/SecurityRule" } } } }, "SubnetAssociation": { "description": "Subnet and it's custom security rules.", "properties": { "id": { "readOnly": true, "type": "string", "description": "Subnet ID." }, "securityRules": { "type": "array", "description": "Collection of custom security rules.", "items": { "$ref": "./networkSecurityGroup.json#/definitions/SecurityRule" } } } }, "PacketCapture": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/PacketCaptureParameters", "description": "Properties of the packet capture." } }, "required": [ "properties" ], "description": "Parameters that define the create packet capture operation." }, "PacketCaptureParameters": { "properties": { "target": { "type": "string", "description": "The ID of the targeted resource, only VM is currently supported." }, "bytesToCapturePerPacket": { "type": "integer", "default": 0, "description": "Number of bytes captured per packet, the remaining bytes are truncated." }, "totalBytesPerSession": { "type": "integer", "default": 1073741824, "description": "Maximum size of the capture output." }, "timeLimitInSeconds": { "type": "integer", "default": 18000, "description": "Maximum duration of the capture session in seconds." }, "storageLocation": { "$ref": "#/definitions/PacketCaptureStorageLocation", "description": "The storage location for a packet capture session." }, "filters": { "type": "array", "items": { "$ref": "#/definitions/PacketCaptureFilter" }, "description": "A list of packet capture filters." } }, "required": [ "target", "storageLocation" ], "description": "Parameters that define the create packet capture operation." }, "PacketCaptureStorageLocation": { "properties": { "storageId": { "type": "string", "description": "The ID of the storage account to save the packet capture session. Required if no local file path is provided." }, "storagePath": { "type": "string", "description": "The URI of the storage path to save the packet capture. Must be a well-formed URI describing the location to save the packet capture." }, "filePath": { "type": "string", "description": "A valid local path on the targeting VM. Must include the name of the capture file (*.cap). For linux virtual machine it must start with /var/captures. Required if no storage ID is provided, otherwise optional." } }, "description": "The storage location for a packet capture session." }, "PacketCaptureFilter": { "properties": { "protocol": { "type": "string", "enum": [ "TCP", "UDP", "Any" ], "x-ms-enum": { "name": "PcProtocol", "modelAsString": true }, "default": "Any", "description": "Protocol to be filtered on." }, "localIPAddress": { "type": "string", "description": "Local IP Address to be filtered on. Notation: \"127.0.0.1\" for single address entry. \"127.0.0.1-127.0.0.255\" for range. \"127.0.0.1;127.0.0.5\"? for multiple entries. Multiple ranges not currently supported. Mixing ranges with multiple entries not currently supported. Default = null." }, "remoteIPAddress": { "type": "string", "description": "Local IP Address to be filtered on. Notation: \"127.0.0.1\" for single address entry. \"127.0.0.1-127.0.0.255\" for range. \"127.0.0.1;127.0.0.5;\" for multiple entries. Multiple ranges not currently supported. Mixing ranges with multiple entries not currently supported. Default = null." }, "localPort": { "type": "string", "description": "Local port to be filtered on. Notation: \"80\" for single port entry.\"80-85\" for range. \"80;443;\" for multiple entries. Multiple ranges not currently supported. Mixing ranges with multiple entries not currently supported. Default = null." }, "remotePort": { "type": "string", "description": "Remote port to be filtered on. Notation: \"80\" for single port entry.\"80-85\" for range. \"80;443;\" for multiple entries. Multiple ranges not currently supported. Mixing ranges with multiple entries not currently supported. Default = null." } }, "description": "Filter that is applied to packet capture request. Multiple filters can be applied." }, "PacketCaptureListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/PacketCaptureResult" }, "description": "Information about packet capture sessions." } }, "description": "List of packet capture sessions." }, "PacketCaptureResult": { "properties": { "name": { "readOnly": true, "type": "string", "description": "Name of the packet capture session." }, "id": { "readOnly": true, "type": "string", "description": "ID of the packet capture operation." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/PacketCaptureResultProperties", "description": "Properties of the packet capture result." } }, "description": "Information about packet capture session." }, "PacketCaptureResultProperties": { "properties": { "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the packet capture session." } }, "allOf": [ { "$ref": "#/definitions/PacketCaptureParameters" } ], "description": "The properties of a packet capture session." }, "PacketCaptureQueryStatusResult": { "properties": { "name": { "type": "string", "description": "The name of the packet capture resource." }, "id": { "type": "string", "description": "The ID of the packet capture resource." }, "captureStartTime": { "type": "string", "format": "date-time", "description": "The start time of the packet capture session." }, "packetCaptureStatus": { "type": "string", "enum": [ "NotStarted", "Running", "Stopped", "Error", "Unknown" ], "x-ms-enum": { "name": "PcStatus", "modelAsString": true }, "description": "The status of the packet capture session." }, "stopReason": { "type": "string", "description": "The reason the current packet capture session was stopped." }, "packetCaptureError": { "type": "array", "description": "List of errors of packet capture session.", "items": { "type": "string", "enum": [ "InternalError", "AgentStopped", "CaptureFailed", "LocalFileFailed", "StorageFailed" ], "x-ms-enum": { "name": "PcError", "modelAsString": true } } } }, "description": "Status of packet capture session." }, "TroubleshootingParameters": { "description": "Parameters that define the resource to troubleshoot.", "required": [ "targetResourceId", "properties" ], "properties": { "targetResourceId": { "description": "The target resource to troubleshoot.", "type": "string" }, "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/TroubleshootingProperties", "description": "Properties of the troubleshooting resource." } } }, "QueryTroubleshootingParameters": { "description": "Parameters that define the resource to query the troubleshooting result.", "required": [ "targetResourceId" ], "properties": { "targetResourceId": { "description": "The target resource ID to query the troubleshooting result.", "type": "string" } } }, "TroubleshootingProperties": { "description": "Storage location provided for troubleshoot.", "required": [ "storageId", "storagePath" ], "properties": { "storageId": { "description": "The ID for the storage account to save the troubleshoot result.", "type": "string" }, "storagePath": { "description": "The path to the blob to save the troubleshoot result in.", "type": "string" } } }, "TroubleshootingResult": { "description": "Troubleshooting information gained from specified resource.", "properties": { "startTime": { "type": "string", "format": "date-time", "description": "The start time of the troubleshooting." }, "endTime": { "type": "string", "format": "date-time", "description": "The end time of the troubleshooting." }, "code": { "type": "string", "description": "The result code of the troubleshooting." }, "results": { "type": "array", "description": "Information from troubleshooting.", "items": { "$ref": "#/definitions/TroubleshootingDetails" } } } }, "TroubleshootingDetails": { "description": "Information gained from troubleshooting of specified resource.", "properties": { "id": { "type": "string", "description": "The id of the get troubleshoot operation." }, "reasonType": { "type": "string", "description": "Reason type of failure." }, "summary": { "type": "string", "description": "A summary of troubleshooting." }, "detail": { "type": "string", "description": "Details on troubleshooting results." }, "recommendedActions": { "type": "array", "description": "List of recommended actions.", "items": { "$ref": "#/definitions/TroubleshootingRecommendedActions" } } } }, "TroubleshootingRecommendedActions": { "description": "Recommended actions based on discovered issues.", "properties": { "actionId": { "description": "ID of the recommended action.", "type": "string" }, "actionText": { "description": "Description of recommended actions.", "type": "string" }, "actionUri": { "description": "The uri linking to a documentation for the recommended troubleshooting actions.", "type": "string" }, "actionUriText": { "description": "The information from the URI for the recommended troubleshooting actions.", "type": "string" } } }, "FlowLogListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/FlowLog" }, "description": "Information about flow log resource." }, "nextLink": { "readOnly": true, "type": "string", "description": "The URL to get the next set of results." } }, "description": "List of flow logs." }, "FlowLog": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/FlowLogPropertiesFormat", "description": "Properties of the flow log." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/Resource" } ], "description": "A flow log resource." }, "FlowLogPropertiesFormat": { "description": "Parameters that define the configuration of flow log.", "required": [ "targetResourceId", "storageId" ], "properties": { "targetResourceId": { "description": "ID of network security group to which flow log will be applied.", "type": "string" }, "targetResourceGuid": { "readOnly": true, "description": "Guid of network security group to which flow log will be applied.", "type": "string" }, "storageId": { "description": "ID of the storage account which is used to store the flow log.", "type": "string" }, "enabled": { "description": "Flag to enable/disable flow logging.", "type": "boolean" }, "retentionPolicy": { "$ref": "#/definitions/RetentionPolicyParameters", "description": "Parameters that define the retention policy for flow log." }, "format": { "$ref": "#/definitions/FlowLogFormatParameters", "description": "Parameters that define the flow log format." }, "flowAnalyticsConfiguration": { "$ref": "#/definitions/TrafficAnalyticsProperties", "description": "Parameters that define the configuration of traffic analytics." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the flow log." } } }, "FlowLogProperties": { "description": "Parameters that define the configuration of flow log.", "required": [ "storageId", "enabled" ], "properties": { "storageId": { "description": "ID of the storage account which is used to store the flow log.", "type": "string" }, "enabled": { "description": "Flag to enable/disable flow logging.", "type": "boolean" }, "retentionPolicy": { "$ref": "#/definitions/RetentionPolicyParameters", "description": "Parameters that define the retention policy for flow log." }, "format": { "$ref": "#/definitions/FlowLogFormatParameters", "description": "Parameters that define the flow log format." } } }, "FlowLogStatusParameters": { "description": "Parameters that define a resource to query flow log and traffic analytics (optional) status.", "required": [ "targetResourceId" ], "properties": { "targetResourceId": { "description": "The target resource where getting the flow log and traffic analytics (optional) status.", "type": "string" } } }, "RetentionPolicyParameters": { "description": "Parameters that define the retention policy for flow log.", "properties": { "days": { "description": "Number of days to retain flow log records.", "type": "integer", "default": 0 }, "enabled": { "description": "Flag to enable/disable retention.", "type": "boolean", "default": false } } }, "FlowLogFormatParameters": { "description": "Parameters that define the flow log format.", "properties": { "type": { "type": "string", "description": "The file type of flow log.", "enum": [ "JSON" ], "x-ms-enum": { "name": "FlowLogFormatType", "modelAsString": true } }, "version": { "description": "The version (revision) of the flow log.", "type": "integer", "default": 0 } } }, "FlowLogInformation": { "description": "Information on the configuration of flow log and traffic analytics (optional) .", "required": [ "targetResourceId", "properties" ], "properties": { "targetResourceId": { "description": "The ID of the resource to configure for flow log and traffic analytics (optional) .", "type": "string" }, "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/FlowLogProperties", "description": "Properties of the flow log." }, "flowAnalyticsConfiguration": { "$ref": "#/definitions/TrafficAnalyticsProperties", "description": "Parameters that define the configuration of traffic analytics." } } }, "TrafficAnalyticsProperties": { "description": "Parameters that define the configuration of traffic analytics.", "properties": { "networkWatcherFlowAnalyticsConfiguration": { "$ref": "#/definitions/TrafficAnalyticsConfigurationProperties", "description": "Parameters that define the configuration of traffic analytics." } } }, "TrafficAnalyticsConfigurationProperties": { "description": "Parameters that define the configuration of traffic analytics.", "properties": { "enabled": { "description": "Flag to enable/disable traffic analytics.", "type": "boolean" }, "workspaceId": { "description": "The resource guid of the attached workspace.", "type": "string" }, "workspaceRegion": { "description": "The location of the attached workspace.", "type": "string" }, "workspaceResourceId": { "description": "Resource Id of the attached workspace.", "type": "string" }, "trafficAnalyticsInterval": { "description": "The interval in minutes which would decide how frequently TA service should do flow analytics.", "type": "integer" } } }, "ConnectivityParameters": { "description": "Parameters that determine how the connectivity check will be performed.", "required": [ "source", "destination" ], "properties": { "source": { "$ref": "#/definitions/ConnectivitySource", "description": "The source of the connection." }, "destination": { "$ref": "#/definitions/ConnectivityDestination", "description": "The destination of connection." }, "protocol": { "type": "string", "description": "Network protocol.", "enum": [ "Tcp", "Http", "Https", "Icmp" ], "x-ms-enum": { "name": "Protocol", "modelAsString": true } }, "protocolConfiguration": { "$ref": "#/definitions/ProtocolConfiguration", "description": "Configuration of the protocol." }, "preferredIPVersion": { "$ref": "./network.json#/definitions/IPVersion", "description": "Preferred IP version of the connection." } } }, "ConnectivitySource": { "description": "Parameters that define the source of the connection.", "required": [ "resourceId" ], "properties": { "resourceId": { "description": "The ID of the resource from which a connectivity check will be initiated.", "type": "string" }, "port": { "description": "The source port from which a connectivity check will be performed.", "type": "integer" } } }, "ConnectivityDestination": { "description": "Parameters that define destination of connection.", "properties": { "resourceId": { "description": "The ID of the resource to which a connection attempt will be made.", "type": "string" }, "address": { "description": "The IP address or URI the resource to which a connection attempt will be made.", "type": "string" }, "port": { "description": "Port on which check connectivity will be performed.", "type": "integer" } } }, "ConnectivityInformation": { "description": "Information on the connectivity status.", "properties": { "hops": { "readOnly": true, "type": "array", "description": "List of hops between the source and the destination.", "items": { "$ref": "#/definitions/ConnectivityHop" } }, "connectionStatus": { "readOnly": true, "type": "string", "enum": [ "Unknown", "Connected", "Disconnected", "Degraded" ], "x-ms-enum": { "name": "ConnectionStatus", "modelAsString": true }, "description": "The connection status." }, "avgLatencyInMs": { "description": "Average latency in milliseconds.", "readOnly": true, "type": "integer" }, "minLatencyInMs": { "description": "Minimum latency in milliseconds.", "readOnly": true, "type": "integer" }, "maxLatencyInMs": { "description": "Maximum latency in milliseconds.", "readOnly": true, "type": "integer" }, "probesSent": { "description": "Total number of probes sent.", "readOnly": true, "type": "integer" }, "probesFailed": { "description": "Number of failed probes.", "readOnly": true, "type": "integer" } } }, "ConnectivityHop": { "description": "Information about a hop between the source and the destination.", "properties": { "type": { "description": "The type of the hop.", "readOnly": true, "type": "string" }, "id": { "description": "The ID of the hop.", "readOnly": true, "type": "string" }, "address": { "description": "The IP address of the hop.", "readOnly": true, "type": "string" }, "resourceId": { "description": "The ID of the resource corresponding to this hop.", "readOnly": true, "type": "string" }, "nextHopIds": { "readOnly": true, "type": "array", "description": "List of next hop identifiers.", "items": { "type": "string" } }, "issues": { "readOnly": true, "type": "array", "description": "List of issues.", "items": { "$ref": "#/definitions/ConnectivityIssue" } } } }, "ConnectivityIssue": { "description": "Information about an issue encountered in the process of checking for connectivity.", "properties": { "origin": { "readOnly": true, "type": "string", "enum": [ "Local", "Inbound", "Outbound" ], "x-ms-enum": { "name": "Origin", "modelAsString": true }, "description": "The origin of the issue." }, "severity": { "readOnly": true, "type": "string", "enum": [ "Error", "Warning" ], "x-ms-enum": { "name": "Severity", "modelAsString": true }, "description": "The severity of the issue." }, "type": { "readOnly": true, "type": "string", "enum": [ "Unknown", "AgentStopped", "GuestFirewall", "DnsResolution", "SocketBind", "NetworkSecurityRule", "UserDefinedRoute", "PortThrottled", "Platform" ], "x-ms-enum": { "name": "IssueType", "modelAsString": true }, "description": "The type of issue." }, "context": { "readOnly": true, "type": "array", "description": "Provides additional context on the issue.", "items": { "$ref": "#/definitions/IssueContext" } } } }, "IssueContext": { "description": "A key-value pair that provides additional context on the issue.", "type": "object", "additionalProperties": { "type": "string" } }, "ProtocolConfiguration": { "description": "Configuration of the protocol.", "properties": { "HTTPConfiguration": { "$ref": "#/definitions/HTTPConfiguration", "description": "HTTP configuration of the connectivity check." } } }, "HTTPConfiguration": { "properties": { "method": { "type": "string", "description": "HTTP method.", "enum": [ "Get" ], "x-ms-enum": { "name": "HTTPMethod", "modelAsString": true } }, "headers": { "type": "array", "description": "List of HTTP headers.", "items": { "$ref": "#/definitions/HTTPHeader" } }, "validStatusCodes": { "type": "array", "items": { "type": "integer" }, "description": "Valid status codes." } }, "description": "HTTP configuration of the connectivity check." }, "HTTPHeader": { "properties": { "name": { "type": "string", "description": "The name in HTTP header." }, "value": { "type": "string", "description": "The value in HTTP header." } }, "description": "The HTTP header." }, "AzureReachabilityReportParameters": { "properties": { "providerLocation": { "$ref": "#/definitions/AzureReachabilityReportLocation", "description": "Parameters that define a geographic location." }, "providers": { "type": "array", "items": { "type": "string" }, "description": "List of Internet service providers." }, "azureLocations": { "type": "array", "items": { "type": "string" }, "description": "Optional Azure regions to scope the query to." }, "startTime": { "type": "string", "format": "date-time", "description": "The start time for the Azure reachability report." }, "endTime": { "type": "string", "format": "date-time", "description": "The end time for the Azure reachability report." } }, "required": [ "providerLocation", "startTime", "endTime" ], "description": "Geographic and time constraints for Azure reachability report." }, "AzureReachabilityReportLocation": { "properties": { "country": { "type": "string", "description": "The name of the country." }, "state": { "type": "string", "description": "The name of the state." }, "city": { "type": "string", "description": "The name of the city or town." } }, "required": [ "country" ], "description": "Parameters that define a geographic location." }, "AzureReachabilityReport": { "properties": { "aggregationLevel": { "type": "string", "description": "The aggregation level of Azure reachability report. Can be Country, State or City." }, "providerLocation": { "$ref": "#/definitions/AzureReachabilityReportLocation", "description": "Parameters that define a geographic location." }, "reachabilityReport": { "type": "array", "description": "List of Azure reachability report items.", "items": { "$ref": "#/definitions/AzureReachabilityReportItem" } } }, "required": [ "aggregationLevel", "providerLocation", "reachabilityReport" ], "description": "Azure reachability report details." }, "AzureReachabilityReportItem": { "properties": { "provider": { "type": "string", "description": "The Internet service provider." }, "azureLocation": { "type": "string", "description": "The Azure region." }, "latencies": { "type": "array", "description": "List of latency details for each of the time series.", "items": { "$ref": "#/definitions/AzureReachabilityReportLatencyInfo" } } }, "description": "Azure reachability report details for a given provider location." }, "AzureReachabilityReportLatencyInfo": { "properties": { "timeStamp": { "type": "string", "format": "date-time", "description": "The time stamp." }, "score": { "type": "integer", "description": "The relative latency score between 1 and 100, higher values indicating a faster connection.", "minimum": 1, "maximum": 100 } }, "description": "Details on latency for a time series." }, "AvailableProvidersListParameters": { "properties": { "azureLocations": { "type": "array", "items": { "type": "string" }, "description": "A list of Azure regions." }, "country": { "type": "string", "description": "The country for available providers list." }, "state": { "type": "string", "description": "The state for available providers list." }, "city": { "type": "string", "description": "The city or town for available providers list." } }, "description": "Constraints that determine the list of available Internet service providers." }, "AvailableProvidersList": { "properties": { "countries": { "type": "array", "description": "List of available countries.", "items": { "$ref": "#/definitions/AvailableProvidersListCountry" } } }, "required": [ "countries" ], "description": "List of available countries with details." }, "AvailableProvidersListCountry": { "properties": { "countryName": { "type": "string", "description": "The country name." }, "providers": { "type": "array", "items": { "type": "string" }, "description": "A list of Internet service providers." }, "states": { "type": "array", "description": "List of available states in the country.", "items": { "$ref": "#/definitions/AvailableProvidersListState" } } }, "description": "Country details." }, "AvailableProvidersListState": { "properties": { "stateName": { "type": "string", "description": "The state name." }, "providers": { "type": "array", "items": { "type": "string" }, "description": "A list of Internet service providers." }, "cities": { "type": "array", "description": "List of available cities or towns in the state.", "items": { "$ref": "#/definitions/AvailableProvidersListCity" } } }, "description": "State details." }, "AvailableProvidersListCity": { "properties": { "cityName": { "type": "string", "description": "The city or town name." }, "providers": { "type": "array", "items": { "type": "string" }, "description": "A list of Internet service providers." } }, "description": "City or town details." }, "NetworkConfigurationDiagnosticParameters": { "description": "Parameters to get network configuration diagnostic.", "required": [ "targetResourceId", "profiles" ], "properties": { "targetResourceId": { "type": "string", "description": "The ID of the target resource to perform network configuration diagnostic. Valid options are VM, NetworkInterface, VMSS/NetworkInterface and Application Gateway." }, "verbosityLevel": { "type": "string", "enum": [ "Normal", "Minimum", "Full" ], "x-ms-enum": { "name": "VerbosityLevel", "modelAsString": true }, "description": "Verbosity level." }, "profiles": { "type": "array", "description": "List of network configuration diagnostic profiles.", "items": { "$ref": "#/definitions/NetworkConfigurationDiagnosticProfile" } } } }, "NetworkConfigurationDiagnosticProfile": { "description": "Parameters to compare with network configuration.", "required": [ "direction", "protocol", "source", "destination", "destinationPort" ], "properties": { "direction": { "$ref": "#/definitions/Direction", "description": "The direction of the traffic." }, "protocol": { "type": "string", "description": "Protocol to be verified on. Accepted values are '*', TCP, UDP." }, "source": { "type": "string", "description": "Traffic source. Accepted values are '*', IP Address/CIDR, Service Tag." }, "destination": { "type": "string", "description": "Traffic destination. Accepted values are: '*', IP Address/CIDR, Service Tag." }, "destinationPort": { "type": "string", "description": "Traffic destination port. Accepted values are '*' and a single port in the range (0 - 65535)." } } }, "NetworkConfigurationDiagnosticResponse": { "description": "Results of network configuration diagnostic on the target resource.", "properties": { "results": { "readOnly": true, "type": "array", "description": "List of network configuration diagnostic results.", "items": { "$ref": "#/definitions/NetworkConfigurationDiagnosticResult" } } } }, "NetworkConfigurationDiagnosticResult": { "description": "Network configuration diagnostic result corresponded to provided traffic query.", "properties": { "profile": { "$ref": "#/definitions/NetworkConfigurationDiagnosticProfile", "description": "Network configuration diagnostic profile." }, "networkSecurityGroupResult": { "$ref": "#/definitions/NetworkSecurityGroupResult", "description": "Network security group result." } } }, "NetworkSecurityGroupResult": { "description": "Network configuration diagnostic result corresponded provided traffic query.", "properties": { "securityRuleAccessResult": { "$ref": "./networkSecurityGroup.json#/definitions/SecurityRuleAccess", "description": "The network traffic is allowed or denied." }, "evaluatedNetworkSecurityGroups": { "readOnly": true, "type": "array", "description": "List of results network security groups diagnostic.", "items": { "$ref": "#/definitions/EvaluatedNetworkSecurityGroup" } } } }, "EvaluatedNetworkSecurityGroup": { "description": "Results of network security group evaluation.", "properties": { "networkSecurityGroupId": { "type": "string", "description": "Network security group ID." }, "appliedTo": { "type": "string", "description": "Resource ID of nic or subnet to which network security group is applied." }, "matchedRule": { "$ref": "#/definitions/MatchedRule", "description": "Matched network security rule." }, "rulesEvaluationResult": { "readOnly": true, "type": "array", "description": "List of network security rules evaluation results.", "items": { "$ref": "#/definitions/NetworkSecurityRulesEvaluationResult" } } } }, "MatchedRule": { "description": "Matched rule.", "properties": { "ruleName": { "type": "string", "description": "Name of the matched network security rule." }, "action": { "type": "string", "description": "The network traffic is allowed or denied. Possible values are 'Allow' and 'Deny'." } } }, "NetworkSecurityRulesEvaluationResult": { "description": "Network security rules evaluation result.", "properties": { "name": { "type": "string", "description": "Name of the network security rule." }, "protocolMatched": { "type": "boolean", "description": "Value indicating whether protocol is matched." }, "sourceMatched": { "type": "boolean", "description": "Value indicating whether source is matched." }, "sourcePortMatched": { "type": "boolean", "description": "Value indicating whether source port is matched." }, "destinationMatched": { "type": "boolean", "description": "Value indicating whether destination is matched." }, "destinationPortMatched": { "type": "boolean", "description": "Value indicating whether destination port is matched." } } }, "Direction": { "type": "string", "description": "The direction of the traffic.", "enum": [ "Inbound", "Outbound" ], "x-ms-enum": { "name": "Direction", "modelAsString": true } }, "ConnectionMonitor": { "properties": { "location": { "type": "string", "description": "Connection monitor location." }, "tags": { "type": "object", "additionalProperties": { "type": "string" }, "description": "Connection monitor tags." }, "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ConnectionMonitorParameters", "description": "Properties of the connection monitor." } }, "required": [ "properties" ], "description": "Parameters that define the operation to create a connection monitor." }, "ConnectionMonitorParameters": { "properties": { "source": { "$ref": "#/definitions/ConnectionMonitorSource", "description": "Describes the source of connection monitor." }, "destination": { "$ref": "#/definitions/ConnectionMonitorDestination", "description": "Describes the destination of connection monitor." }, "autoStart": { "type": "boolean", "default": true, "description": "Determines if the connection monitor will start automatically once created." }, "monitoringIntervalInSeconds": { "type": "integer", "default": 60, "description": "Monitoring interval in seconds." }, "endpoints": { "type": "array", "description": "List of connection monitor endpoints.", "items": { "$ref": "#/definitions/ConnectionMonitorEndpoint" } }, "testConfigurations": { "type": "array", "description": "List of connection monitor test configurations.", "items": { "$ref": "#/definitions/ConnectionMonitorTestConfiguration" } }, "testGroups": { "type": "array", "description": "List of connection monitor test groups.", "items": { "$ref": "#/definitions/ConnectionMonitorTestGroup" } }, "outputs": { "type": "array", "description": "List of connection monitor outputs.", "items": { "$ref": "#/definitions/ConnectionMonitorOutput" } }, "notes": { "type": "string", "description": "Optional notes to be associated with the connection monitor." } }, "description": "Parameters that define the operation to create a connection monitor." }, "ConnectionMonitorSource": { "properties": { "resourceId": { "type": "string", "description": "The ID of the resource used as the source by connection monitor." }, "port": { "type": "integer", "description": "The source port used by connection monitor." } }, "required": [ "resourceId" ], "description": "Describes the source of connection monitor." }, "ConnectionMonitorDestination": { "properties": { "resourceId": { "type": "string", "description": "The ID of the resource used as the destination by connection monitor." }, "address": { "type": "string", "description": "Address of the connection monitor destination (IP or domain name)." }, "port": { "type": "integer", "description": "The destination port used by connection monitor." } }, "description": "Describes the destination of connection monitor." }, "ConnectionMonitorEndpoint": { "properties": { "name": { "type": "string", "description": "The name of the connection monitor endpoint." }, "resourceId": { "type": "string", "description": "Resource ID of the connection monitor endpoint." }, "address": { "type": "string", "description": "Address of the connection monitor endpoint (IP or domain name)." }, "filter": { "$ref": "#/definitions/ConnectionMonitorEndpointFilter", "description": "Filter for sub-items within the endpoint." } }, "required": [ "name" ], "description": "Describes the connection monitor endpoint." }, "ConnectionMonitorEndpointFilter": { "properties": { "type": { "type": "string", "enum": [ "Include" ], "x-ms-enum": { "name": "ConnectionMonitorEndpointFilterType", "modelAsString": true }, "description": "The behavior of the endpoint filter. Currently only 'Include' is supported." }, "items": { "type": "array", "description": "List of items in the filter.", "items": { "$ref": "#/definitions/ConnectionMonitorEndpointFilterItem" } } }, "description": "Describes the connection monitor endpoint filter." }, "ConnectionMonitorEndpointFilterItem": { "properties": { "type": { "type": "string", "enum": [ "AgentAddress" ], "x-ms-enum": { "name": "ConnectionMonitorEndpointFilterItemType", "modelAsString": true }, "description": "The type of item included in the filter. Currently only 'AgentAddress' is supported." }, "address": { "type": "string", "description": "The address of the filter item." } }, "description": "Describes the connection monitor endpoint filter item." }, "ConnectionMonitorTestGroup": { "properties": { "name": { "type": "string", "description": "The name of the connection monitor test group." }, "disable": { "type": "boolean", "description": "Value indicating whether test group is disabled." }, "testConfigurations": { "type": "array", "items": { "type": "string" }, "description": "List of test configuration names." }, "sources": { "type": "array", "items": { "type": "string" }, "description": "List of source endpoint names." }, "destinations": { "type": "array", "items": { "type": "string" }, "description": "List of destination endpoint names." } }, "required": [ "name", "testConfigurations", "sources", "destinations" ], "description": "Describes the connection monitor test group." }, "ConnectionMonitorTestConfiguration": { "properties": { "name": { "type": "string", "description": "The name of the connection monitor test configuration." }, "testFrequencySec": { "type": "integer", "description": "The frequency of test evaluation, in seconds." }, "protocol": { "type": "string", "enum": [ "Tcp", "Http", "Icmp" ], "x-ms-enum": { "name": "ConnectionMonitorTestConfigurationProtocol", "modelAsString": true }, "description": "The protocol to use in test evaluation." }, "preferredIPVersion": { "type": "string", "enum": [ "IPv4", "IPv6" ], "x-ms-enum": { "name": "PreferredIPVersion", "modelAsString": true }, "description": "The preferred IP version to use in test evaluation. The connection monitor may choose to use a different version depending on other parameters." }, "httpConfiguration": { "$ref": "#/definitions/ConnectionMonitorHttpConfiguration", "description": "The parameters used to perform test evaluation over HTTP." }, "tcpConfiguration": { "$ref": "#/definitions/ConnectionMonitorTcpConfiguration", "description": "The parameters used to perform test evaluation over TCP." }, "icmpConfiguration": { "$ref": "#/definitions/ConnectionMonitorIcmpConfiguration", "description": "The parameters used to perform test evaluation over ICMP." }, "successThreshold": { "$ref": "#/definitions/ConnectionMonitorSuccessThreshold", "description": "The threshold for declaring a test successful." } }, "required": [ "name", "protocol" ], "description": "Describes a connection monitor test configuration." }, "ConnectionMonitorHttpConfiguration": { "properties": { "port": { "type": "integer", "description": "The port to connect to." }, "method": { "type": "string", "description": "The HTTP method to use.", "enum": [ "Get", "Post" ], "x-ms-enum": { "name": "HTTPConfigurationMethod", "modelAsString": true } }, "path": { "type": "string", "description": "The path component of the URI. For instance, \"/dir1/dir2\"." }, "requestHeaders": { "type": "array", "description": "The HTTP headers to transmit with the request.", "items": { "$ref": "#/definitions/HTTPHeader" } }, "validStatusCodeRanges": { "type": "array", "items": { "type": "string" }, "description": "HTTP status codes to consider successful. For instance, \"2xx,301-304,418\"." }, "preferHTTPS": { "type": "boolean", "description": "Value indicating whether HTTPS is preferred over HTTP in cases where the choice is not explicit." } }, "description": "Describes the HTTP configuration." }, "ConnectionMonitorTcpConfiguration": { "properties": { "port": { "type": "integer", "description": "The port to connect to." }, "disableTraceRoute": { "type": "boolean", "description": "Value indicating whether path evaluation with trace route should be disabled." } }, "description": "Describes the TCP configuration." }, "ConnectionMonitorIcmpConfiguration": { "properties": { "disableTraceRoute": { "type": "boolean", "description": "Value indicating whether path evaluation with trace route should be disabled." } }, "description": "Describes the ICMP configuration." }, "ConnectionMonitorSuccessThreshold": { "properties": { "checksFailedPercent": { "type": "integer", "description": "The maximum percentage of failed checks permitted for a test to evaluate as successful." }, "roundTripTimeMs": { "type": "number", "description": "The maximum round-trip time in milliseconds permitted for a test to evaluate as successful." } }, "description": "Describes the threshold for declaring a test successful." }, "ConnectionMonitorOutput": { "properties": { "type": { "type": "string", "description": "Connection monitor output destination type. Currently, only \"Workspace\" is supported.", "enum": [ "Workspace" ], "x-ms-enum": { "name": "OutputType", "modelAsString": true } }, "workspaceSettings": { "$ref": "#/definitions/ConnectionMonitorWorkspaceSettings", "description": "Describes the settings for producing output into a log analytics workspace." } }, "description": "Describes a connection monitor output destination." }, "ConnectionMonitorWorkspaceSettings": { "properties": { "workspaceResourceId": { "type": "string", "description": "Log analytics workspace resource ID." } }, "description": "Describes the settings for producing output into a log analytics workspace." }, "ConnectionStateSnapshot": { "properties": { "connectionState": { "type": "string", "enum": [ "Reachable", "Unreachable", "Unknown" ], "x-ms-enum": { "name": "ConnectionState", "modelAsString": true }, "description": "The connection state." }, "startTime": { "type": "string", "format": "date-time", "description": "The start time of the connection snapshot." }, "endTime": { "type": "string", "format": "date-time", "description": "The end time of the connection snapshot." }, "evaluationState": { "type": "string", "enum": [ "NotStarted", "InProgress", "Completed" ], "x-ms-enum": { "name": "EvaluationState", "modelAsString": true }, "description": "Connectivity analysis evaluation state." }, "avgLatencyInMs": { "type": "integer", "description": "Average latency in ms." }, "minLatencyInMs": { "type": "integer", "description": "Minimum latency in ms." }, "maxLatencyInMs": { "type": "integer", "description": "Maximum latency in ms." }, "probesSent": { "type": "integer", "description": "The number of sent probes." }, "probesFailed": { "type": "integer", "description": "The number of failed probes." }, "hops": { "readOnly": true, "type": "array", "description": "List of hops between the source and the destination.", "items": { "$ref": "./networkWatcher.json#/definitions/ConnectivityHop" } } }, "description": "Connection state snapshot." }, "ConnectionMonitorListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/ConnectionMonitorResult" }, "description": "Information about connection monitors." } }, "description": "List of connection monitors." }, "ConnectionMonitorResult": { "x-ms-azure-resource": true, "properties": { "name": { "readOnly": true, "type": "string", "description": "Name of the connection monitor." }, "id": { "readOnly": true, "type": "string", "description": "ID of the connection monitor." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Connection monitor type." }, "location": { "type": "string", "description": "Connection monitor location." }, "tags": { "type": "object", "additionalProperties": { "type": "string" }, "description": "Connection monitor tags." }, "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ConnectionMonitorResultProperties", "description": "Properties of the connection monitor result." } }, "description": "Information about the connection monitor." }, "ConnectionMonitorResultProperties": { "properties": { "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the connection monitor." }, "startTime": { "readOnly": true, "type": "string", "format": "date-time", "description": "The date and time when the connection monitor was started." }, "monitoringStatus": { "readOnly": true, "type": "string", "description": "The monitoring status of the connection monitor." }, "connectionMonitorType": { "readOnly": true, "type": "string", "enum": [ "MultiEndpoint", "SingleSourceDestination" ], "x-ms-enum": { "name": "ConnectionMonitorType", "modelAsString": true }, "description": "Type of connection monitor." } }, "allOf": [ { "$ref": "#/definitions/ConnectionMonitorParameters" } ], "description": "Describes the properties of a connection monitor." }, "ConnectionMonitorQueryResult": { "properties": { "sourceStatus": { "type": "string", "enum": [ "Unknown", "Active", "Inactive" ], "x-ms-enum": { "name": "ConnectionMonitorSourceStatus", "modelAsString": true }, "description": "Status of connection monitor source." }, "states": { "type": "array", "items": { "$ref": "#/definitions/ConnectionStateSnapshot" }, "description": "Information about connection states." } }, "description": "List of connection states snapshots." } } } analysis-0.21.1/fixtures/azure/privateEndpoint.json000066400000000000000000000770361413705513100225000ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "NetworkManagementClient", "description": "The Microsoft Azure Network management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to manage your network resources. The API has entities that capture the relationship between an end user and the Microsoft Azure Networks service.", "version": "2020-04-01" }, "host": "management.azure.com", "schemes": [ "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "security": [ { "azure_auth": [ "user_impersonation" ] } ], "securityDefinitions": { "azure_auth": { "type": "oauth2", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "flow": "implicit", "description": "Azure Active Directory OAuth2 Flow.", "scopes": { "user_impersonation": "impersonate your user account" } } }, "paths": { "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}": { "delete": { "tags": [ "PrivateEndpoints" ], "operationId": "PrivateEndpoints_Delete", "description": "Deletes the specified private endpoint.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "privateEndpointName", "in": "path", "required": true, "type": "string", "description": "The name of the private endpoint." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "202": { "description": "Accepted and the operation will complete asynchronously." }, "204": { "description": "Delete successful." }, "200": { "description": "Delete successful." }, "default": { "description": "Error.", "schema": { "$ref": "./network.json#/definitions/Error" } } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" }, "x-ms-examples": { "Delete private endpoint": { "$ref": "./examples/PrivateEndpointDelete.json" } } }, "get": { "tags": [ "PrivateEndpoints" ], "operationId": "PrivateEndpoints_Get", "description": "Gets the specified private endpoint by resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "privateEndpointName", "in": "path", "required": true, "type": "string", "description": "The name of the private endpoint." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" }, { "name": "$expand", "in": "query", "required": false, "type": "string", "description": "Expands referenced resources." } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting private endpoint resource.", "schema": { "$ref": "#/definitions/PrivateEndpoint" } }, "default": { "description": "Error.", "schema": { "$ref": "./network.json#/definitions/Error" } } }, "x-ms-examples": { "Get private endpoint": { "$ref": "./examples/PrivateEndpointGet.json" }, "Get private endpoint with manual approval connection": { "$ref": "./examples/PrivateEndpointGetForManualApproval.json" } } }, "put": { "tags": [ "PrivateEndpoints" ], "operationId": "PrivateEndpoints_CreateOrUpdate", "description": "Creates or updates an private endpoint in the specified resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "privateEndpointName", "in": "path", "required": true, "type": "string", "description": "The name of the private endpoint." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/PrivateEndpoint" }, "description": "Parameters supplied to the create or update private endpoint operation." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting private endpoint resource.", "schema": { "$ref": "#/definitions/PrivateEndpoint" } }, "201": { "description": "Create successful. The operation returns the resulting private endpoint resource.", "schema": { "$ref": "#/definitions/PrivateEndpoint" } }, "default": { "description": "Error.", "schema": { "$ref": "./network.json#/definitions/Error" } } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" }, "x-ms-examples": { "Create private endpoint": { "$ref": "./examples/PrivateEndpointCreate.json" }, "Create private endpoint with manual approval connection": { "$ref": "./examples/PrivateEndpointCreateForManualApproval.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints": { "get": { "tags": [ "PrivateEndpoints" ], "operationId": "PrivateEndpoints_List", "description": "Gets all private endpoints in a resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of private endpoint resources.", "schema": { "$ref": "#/definitions/PrivateEndpointListResult" } }, "default": { "description": "Error.", "schema": { "$ref": "./network.json#/definitions/Error" } } }, "x-ms-examples": { "List private endpoints in resource group": { "$ref": "./examples/PrivateEndpointList.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/privateEndpoints": { "get": { "tags": [ "PrivateEndpoints" ], "operationId": "PrivateEndpoints_ListBySubscription", "description": "Gets all private endpoints in a subscription.", "parameters": [ { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of private endpoint resources.", "schema": { "$ref": "#/definitions/PrivateEndpointListResult" } }, "default": { "description": "Error.", "schema": { "$ref": "./network.json#/definitions/Error" } } }, "x-ms-examples": { "List all private endpoints": { "$ref": "./examples/PrivateEndpointListAll.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availablePrivateEndpointTypes": { "get": { "operationId": "AvailablePrivateEndpointTypes_List", "description": "Returns all of the resource types that can be linked to a Private Endpoint in this subscription in this region.", "parameters": [ { "name": "location", "in": "path", "required": true, "type": "string", "description": "The location of the domain name." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. Returns all of the resource types that can be linked to a Private Endpoint in this subscription in this region.", "schema": { "$ref": "#/definitions/AvailablePrivateEndpointTypesResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Get available PrivateEndpoint types": { "$ref": "./examples/AvailablePrivateEndpointTypesGet.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availablePrivateEndpointTypes": { "get": { "operationId": "AvailablePrivateEndpointTypes_ListByResourceGroup", "description": "Returns all of the resource types that can be linked to a Private Endpoint in this subscription in this region.", "parameters": [ { "name": "location", "in": "path", "required": true, "type": "string", "description": "The location of the domain name." }, { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" }, { "$ref": "./network.json#/parameters/ApiVersionParameter" } ], "responses": { "200": { "description": "Request successful. Returns all of the resource types that can be linked to a Private Endpoint in this subscription in this region.", "schema": { "$ref": "#/definitions/AvailablePrivateEndpointTypesResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Get available PrivateEndpoint types in the resource group": { "$ref": "./examples/AvailablePrivateEndpointTypesResourceGroupGet.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}": { "delete": { "tags": [ "PrivateDnsZoneGroups" ], "operationId": "PrivateDnsZoneGroups_Delete", "description": "Deletes the specified private dns zone group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "privateEndpointName", "in": "path", "required": true, "type": "string", "description": "The name of the private endpoint." }, { "name": "privateDnsZoneGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the private dns zone group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "202": { "description": "Accepted and the operation will complete asynchronously." }, "204": { "description": "Request successful. Resource does not exist." }, "200": { "description": "Delete successful." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" }, "x-ms-examples": { "Delete private dns zone group": { "$ref": "./examples/PrivateEndpointDnsZoneGroupDelete.json" } } }, "get": { "tags": [ "PrivateDnsZoneGroups" ], "operationId": "PrivateDnsZoneGroups_Get", "description": "Gets the private dns zone group resource by specified private dns zone group name.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "privateEndpointName", "in": "path", "required": true, "type": "string", "description": "The name of the private endpoint." }, { "name": "privateDnsZoneGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the private dns zone group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting privateDnsZoneGroup resource.", "schema": { "$ref": "#/definitions/PrivateDnsZoneGroup" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Get private dns zone group": { "$ref": "./examples/PrivateEndpointDnsZoneGroupGet.json" } } }, "put": { "tags": [ "PrivateDnsZoneGroups" ], "operationId": "PrivateDnsZoneGroups_CreateOrUpdate", "description": "Creates or updates a private dns zone group in the specified private endpoint.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "privateEndpointName", "in": "path", "required": true, "type": "string", "description": "The name of the private endpoint." }, { "name": "privateDnsZoneGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the private dns zone group." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/PrivateDnsZoneGroup" }, "description": "Parameters supplied to the create or update private dns zone group operation." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting PrivateDnsZoneGroup resource.", "schema": { "$ref": "#/definitions/PrivateDnsZoneGroup" } }, "201": { "description": "Create successful. The operation returns the resulting PrivateDnsZoneGroup resource.", "schema": { "$ref": "#/definitions/PrivateDnsZoneGroup" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" }, "x-ms-examples": { "Create private dns zone group": { "$ref": "./examples/PrivateEndpointDnsZoneGroupCreate.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups": { "get": { "tags": [ "PrivateDnsZoneGroups" ], "operationId": "PrivateDnsZoneGroups_List", "description": "Gets all private dns zone groups in a private endpoint.", "parameters": [ { "name": "privateEndpointName", "in": "path", "required": true, "type": "string", "description": "The name of the private endpoint." }, { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of private dns zone group resources.", "schema": { "$ref": "#/definitions/PrivateDnsZoneGroupListResult" } }, "default": { "description": "Error.", "schema": { "$ref": "./network.json#/definitions/Error" } } }, "x-ms-examples": { "List private endpoints in resource group": { "$ref": "./examples/PrivateEndpointDnsZoneGroupList.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } } }, "definitions": { "PrivateEndpoint": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/PrivateEndpointProperties", "description": "Properties of the private endpoint." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/Resource" } ], "description": "Private endpoint resource." }, "PrivateEndpointProperties": { "properties": { "subnet": { "$ref": "./virtualNetwork.json#/definitions/Subnet", "description": "The ID of the subnet from which the private IP will be allocated." }, "networkInterfaces": { "type": "array", "readOnly": true, "items": { "$ref": "./networkInterface.json#/definitions/NetworkInterface" }, "description": "An array of references to the network interfaces created for this private endpoint." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the private endpoint resource." }, "privateLinkServiceConnections": { "type": "array", "items": { "$ref": "#/definitions/PrivateLinkServiceConnection" }, "description": "A grouping of information about the connection to the remote resource." }, "manualPrivateLinkServiceConnections": { "type": "array", "items": { "$ref": "#/definitions/PrivateLinkServiceConnection" }, "description": "A grouping of information about the connection to the remote resource. Used when the network admin does not have access to approve connections to the remote resource." }, "customDnsConfigs": { "type": "array", "items": { "$ref": "#/definitions/CustomDnsConfigPropertiesFormat" }, "description": "An array of custom dns configurations." } }, "description": "Properties of the private endpoint." }, "CustomDnsConfigPropertiesFormat": { "properties": { "fqdn": { "type": "string", "description": "Fqdn that resolves to private endpoint ip address." }, "ipAddresses": { "type": "array", "items": { "type": "string" }, "description": "A list of private ip addresses of the private endpoint." } }, "description": "Contains custom Dns resolution configuration from customer." }, "PrivateLinkServiceConnection": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/PrivateLinkServiceConnectionProperties", "description": "Properties of the private link service connection." }, "name": { "type": "string", "description": "The name of the resource that is unique within a resource group. This name can be used to access the resource." }, "type": { "readOnly": true, "type": "string", "description": "The resource type." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "PrivateLinkServiceConnection resource." }, "PrivateLinkServiceConnectionProperties": { "properties": { "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the private link service connection resource." }, "privateLinkServiceId": { "type": "string", "description": "The resource id of private link service." }, "groupIds": { "type": "array", "items": { "type": "string" }, "description": "The ID(s) of the group(s) obtained from the remote resource that this private endpoint should connect to." }, "requestMessage": { "type": "string", "description": "A message passed to the owner of the remote resource with this connection request. Restricted to 140 chars." }, "privateLinkServiceConnectionState": { "$ref": "./privateLinkService.json#/definitions/PrivateLinkServiceConnectionState", "description": "A collection of read-only information about the state of the connection to the remote resource." } }, "description": "Properties of the PrivateLinkServiceConnection." }, "PrivateEndpointListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/PrivateEndpoint" }, "description": "A list of private endpoint resources in a resource group." }, "nextLink": { "type": "string", "description": "The URL to get the next set of results.", "readOnly": true } }, "description": "Response for the ListPrivateEndpoints API service call." }, "PrivateDnsZoneGroupListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/PrivateDnsZoneGroup" }, "description": "A list of private dns zone group resources in a private endpoint." }, "nextLink": { "type": "string", "description": "The URL to get the next set of results.", "readOnly": true } }, "description": "Response for the ListPrivateDnsZoneGroups API service call." }, "AvailablePrivateEndpointTypesResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/AvailablePrivateEndpointType" }, "description": "An array of available privateEndpoint type." }, "nextLink": { "readOnly": true, "type": "string", "description": "The URL to get the next set of results." } }, "description": "An array of available PrivateEndpoint types." }, "AvailablePrivateEndpointType": { "properties": { "name": { "type": "string", "description": "The name of the service and resource." }, "id": { "type": "string", "description": "A unique identifier of the AvailablePrivateEndpoint Type resource." }, "type": { "type": "string", "description": "Resource type." }, "resourceName": { "type": "string", "description": "The name of the service and resource." } }, "description": "The information of an AvailablePrivateEndpointType." }, "PrivateDnsZoneGroup": { "properties": { "name": { "type": "string", "description": "Name of the resource that is unique within a resource group. This name can be used to access the resource." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/PrivateDnsZoneGroupPropertiesFormat", "description": "Properties of the private dns zone group." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Private dns zone group resource." }, "PrivateDnsZoneGroupPropertiesFormat": { "properties": { "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the private dns zone group resource." }, "privateDnsZoneConfigs": { "type": "array", "items": { "$ref": "#/definitions/PrivateDnsZoneConfig" }, "description": "A collection of private dns zone configurations of the private dns zone group." } }, "description": "Properties of the private dns zone group." }, "PrivateDnsZoneConfig": { "properties": { "name": { "type": "string", "description": "Name of the resource that is unique within a resource group. This name can be used to access the resource." }, "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/PrivateDnsZonePropertiesFormat", "description": "Properties of the private dns zone configuration." } }, "description": "PrivateDnsZoneConfig resource." }, "PrivateDnsZonePropertiesFormat": { "properties": { "privateDnsZoneId": { "type": "string", "description": "The resource id of the private dns zone." }, "recordSets": { "type": "array", "readOnly": true, "items": { "$ref": "#/definitions/RecordSet" }, "description": "A collection of information regarding a recordSet, holding information to identify private resources." } }, "description": "Properties of the private dns zone configuration resource." }, "RecordSet": { "properties": { "recordType": { "type": "string", "description": "Resource record type." }, "recordSetName": { "type": "string", "description": "Recordset name." }, "fqdn": { "type": "string", "description": "Fqdn that resolves to private endpoint ip address." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the recordset." }, "ttl": { "type": "integer", "description": "Recordset time to live." }, "ipAddresses": { "type": "array", "items": { "type": "string" }, "description": "The private ip address of the private endpoint." } }, "description": "A collective group of information about the record set information." } } } analysis-0.21.1/fixtures/azure/privateLinkService.json000066400000000000000000001077301413705513100231310ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "NetworkManagementClient", "description": "The Microsoft Azure Network management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to manage your network resources. The API has entities that capture the relationship between an end user and the Microsoft Azure Networks service.", "version": "2020-04-01" }, "host": "management.azure.com", "schemes": [ "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "security": [ { "azure_auth": [ "user_impersonation" ] } ], "securityDefinitions": { "azure_auth": { "type": "oauth2", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "flow": "implicit", "description": "Azure Active Directory OAuth2 Flow.", "scopes": { "user_impersonation": "impersonate your user account" } } }, "paths": { "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}": { "delete": { "tags": [ "PrivateLinkServices" ], "operationId": "PrivateLinkServices_Delete", "description": "Deletes the specified private link service.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "serviceName", "in": "path", "required": true, "type": "string", "description": "The name of the private link service." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "202": { "description": "Accepted and the operation will complete asynchronously." }, "204": { "description": "Delete successful." }, "200": { "description": "Delete successful." }, "default": { "description": "Error.", "schema": { "$ref": "./network.json#/definitions/Error" } } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" }, "x-ms-examples": { "Delete private link service": { "$ref": "./examples/PrivateLinkServiceDelete.json" } } }, "get": { "tags": [ "PrivateLinkServices" ], "operationId": "PrivateLinkServices_Get", "description": "Gets the specified private link service by resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "serviceName", "in": "path", "required": true, "type": "string", "description": "The name of the private link service." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" }, { "name": "$expand", "in": "query", "required": false, "type": "string", "description": "Expands referenced resources." } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting PrivateLinkService resource.", "schema": { "$ref": "#/definitions/PrivateLinkService" } }, "default": { "description": "Error.", "schema": { "$ref": "./network.json#/definitions/Error" } } }, "x-ms-examples": { "Get private link service": { "$ref": "./examples/PrivateLinkServiceGet.json" } } }, "put": { "tags": [ "PrivateLinkService" ], "operationId": "PrivateLinkServices_CreateOrUpdate", "description": "Creates or updates an private link service in the specified resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "serviceName", "in": "path", "required": true, "type": "string", "description": "The name of the private link service." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/PrivateLinkService" }, "description": "Parameters supplied to the create or update private link service operation." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting privateLinkService resource.", "schema": { "$ref": "#/definitions/PrivateLinkService" } }, "201": { "description": "Create successful. The operation returns the resulting privateLinkService resource.", "schema": { "$ref": "#/definitions/PrivateLinkService" } }, "default": { "description": "Error.", "schema": { "$ref": "./network.json#/definitions/Error" } } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" }, "x-ms-examples": { "Create private link service": { "$ref": "./examples/PrivateLinkServiceCreate.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices": { "get": { "tags": [ "PrivateLinkServices" ], "operationId": "PrivateLinkServices_List", "description": "Gets all private link services in a resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of privateLinkService resources.", "schema": { "$ref": "#/definitions/PrivateLinkServiceListResult" } }, "default": { "description": "Error.", "schema": { "$ref": "./network.json#/definitions/Error" } } }, "x-ms-examples": { "List private link service in resource group": { "$ref": "./examples/PrivateLinkServiceList.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/privateLinkServices": { "get": { "tags": [ "PrivateLinkServices" ], "operationId": "PrivateLinkServices_ListBySubscription", "description": "Gets all private link service in a subscription.", "parameters": [ { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of PrivateLinkService resources.", "schema": { "$ref": "#/definitions/PrivateLinkServiceListResult" } }, "default": { "description": "Error.", "schema": { "$ref": "./network.json#/definitions/Error" } } }, "x-ms-examples": { "List all private list service": { "$ref": "./examples/PrivateLinkServiceListAll.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}": { "get": { "tags": [ "PrivateLinkServices" ], "operationId": "PrivateLinkServices_GetPrivateEndpointConnection", "description": "Get the specific private end point connection by specific private link service in the resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "serviceName", "in": "path", "required": true, "type": "string", "description": "The name of the private link service." }, { "name": "peConnectionName", "in": "path", "required": true, "type": "string", "description": "The name of the private end point connection." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" }, { "name": "$expand", "in": "query", "required": false, "type": "string", "description": "Expands referenced resources." } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting private end point connection resource.", "schema": { "$ref": "#/definitions/PrivateEndpointConnection" } }, "default": { "description": "Error.", "schema": { "$ref": "./network.json#/definitions/Error" } } }, "x-ms-examples": { "Get private end point connection": { "$ref": "./examples/PrivateLinkServiceGetPrivateEndpointConnection.json" } } }, "put": { "tags": [ "PrivateLinkServices" ], "operationId": "PrivateLinkServices_UpdatePrivateEndpointConnection", "description": "Approve or reject private end point connection for a private link service in a subscription.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "serviceName", "in": "path", "required": true, "type": "string", "description": "The name of the private link service." }, { "name": "peConnectionName", "in": "path", "required": true, "type": "string", "description": "The name of the private end point connection." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/PrivateEndpointConnection" }, "description": "Parameters supplied to approve or reject the private end point connection." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting PrivateEndpointConnection resource.", "schema": { "$ref": "#/definitions/PrivateEndpointConnection" } }, "default": { "description": "Error.", "schema": { "$ref": "./network.json#/definitions/Error" } } }, "x-ms-examples": { "approve or reject private end point connection for a private link service": { "$ref": "./examples/PrivateLinkServiceUpdatePrivateEndpointConnection.json" } } }, "delete": { "tags": [ "PrivateLinkServices" ], "operationId": "PrivateLinkServices_DeletePrivateEndpointConnection", "description": "Delete private end point connection for a private link service in a subscription.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "serviceName", "in": "path", "required": true, "type": "string", "description": "The name of the private link service." }, { "name": "peConnectionName", "in": "path", "required": true, "type": "string", "description": "The name of the private end point connection." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "202": { "description": "Accepted and the operation will complete asynchronously." }, "204": { "description": "Delete successful." }, "200": { "description": "Delete successful." }, "default": { "description": "Error.", "schema": { "$ref": "./network.json#/definitions/Error" } } }, "x-ms-examples": { "delete private end point connection for a private link service": { "$ref": "./examples/PrivateLinkServiceDeletePrivateEndpointConnection.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections": { "get": { "tags": [ "PrivateLinkServices" ], "operationId": "PrivateLinkServices_ListPrivateEndpointConnections", "description": "Gets all private end point connections for a specific private link service.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "serviceName", "in": "path", "required": true, "type": "string", "description": "The name of the private link service." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of private end point connection resources.", "schema": { "$ref": "#/definitions/PrivateEndpointConnectionListResult" } }, "default": { "description": "Error.", "schema": { "$ref": "./network.json#/definitions/Error" } } }, "x-ms-examples": { "List private link service in resource group": { "$ref": "./examples/PrivateLinkServiceListPrivateEndpointConnection.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility": { "post": { "tags": [ "PrivateLinkServices" ], "operationId": "PrivateLinkServices_CheckPrivateLinkServiceVisibility", "description": "Checks whether the subscription is visible to private link service.", "parameters": [ { "name": "location", "in": "path", "required": true, "type": "string", "description": "The location of the domain name." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/CheckPrivateLinkServiceVisibilityRequest" }, "description": "The request body of CheckPrivateLinkService API call." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. Returns whether the subscription is visible to private link service.", "schema": { "$ref": "#/definitions/PrivateLinkServiceVisibility" } }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" }, "x-ms-examples": { "Check private link service visibility": { "$ref": "./examples/CheckPrivateLinkServiceVisibility.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility": { "post": { "tags": [ "PrivateLinkServices" ], "operationId": "PrivateLinkServices_CheckPrivateLinkServiceVisibilityByResourceGroup", "description": "Checks whether the subscription is visible to private link service in the specified resource group.", "parameters": [ { "name": "location", "in": "path", "required": true, "type": "string", "description": "The location of the domain name." }, { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/CheckPrivateLinkServiceVisibilityRequest" }, "description": "The request body of CheckPrivateLinkService API call." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. Returns whether the subscription is visible to private link service.", "schema": { "$ref": "#/definitions/PrivateLinkServiceVisibility" } }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" }, "x-ms-examples": { "Check private link service visibility": { "$ref": "./examples/CheckPrivateLinkServiceVisibilityByResourceGroup.json" } } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/autoApprovedPrivateLinkServices": { "get": { "tags": [ "PrivateLinkServices" ], "operationId": "PrivateLinkServices_ListAutoApprovedPrivateLinkServices", "description": "Returns all of the private link service ids that can be linked to a Private Endpoint with auto approved in this subscription in this region.", "parameters": [ { "name": "location", "in": "path", "required": true, "type": "string", "description": "The location of the domain name." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. Returns all of the private link service ids that can be linked to a Private Endpoint with auto approved in this subscription in this region.", "schema": { "$ref": "#/definitions/AutoApprovedPrivateLinkServicesResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Get list of private link service id that can be linked to a private end point with auto approved": { "$ref": "./examples/AutoApprovedPrivateLinkServicesGet.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/autoApprovedPrivateLinkServices": { "get": { "tags": [ "PrivateLinkServices" ], "operationId": "PrivateLinkServices_ListAutoApprovedPrivateLinkServicesByResourceGroup", "description": "Returns all of the private link service ids that can be linked to a Private Endpoint with auto approved in this subscription in this region.", "parameters": [ { "name": "location", "in": "path", "required": true, "type": "string", "description": "The location of the domain name." }, { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. Returns all of the private link service ids that can be linked to a Private Endpoint with auto approved in this subscription in this region.", "schema": { "$ref": "#/definitions/AutoApprovedPrivateLinkServicesResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Get list of private link service id that can be linked to a private end point with auto approved": { "$ref": "./examples/AutoApprovedPrivateLinkServicesResourceGroupGet.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } } }, "definitions": { "PrivateLinkService": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/PrivateLinkServiceProperties", "description": "Properties of the private link service." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/Resource" } ], "description": "Private link service resource." }, "PrivateLinkServiceProperties": { "properties": { "loadBalancerFrontendIpConfigurations": { "type": "array", "items": { "$ref": "./loadBalancer.json#/definitions/FrontendIPConfiguration" }, "description": "An array of references to the load balancer IP configurations." }, "ipConfigurations": { "type": "array", "items": { "$ref": "#/definitions/PrivateLinkServiceIpConfiguration" }, "description": "An array of private link service IP configurations." }, "networkInterfaces": { "type": "array", "readOnly": true, "items": { "$ref": "./networkInterface.json#/definitions/NetworkInterface" }, "description": "An array of references to the network interfaces created for this private link service." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the private link service resource." }, "privateEndpointConnections": { "readOnly": true, "type": "array", "items": { "$ref": "#/definitions/PrivateEndpointConnection" }, "description": "An array of list about connections to the private endpoint." }, "visibility": { "allOf": [ { "$ref": "#/definitions/ResourceSet" } ], "description": "The visibility list of the private link service." }, "autoApproval": { "allOf": [ { "$ref": "#/definitions/ResourceSet" } ], "description": "The auto-approval list of the private link service." }, "fqdns": { "type": "array", "items": { "type": "string" }, "description": "The list of Fqdn." }, "alias": { "readOnly": true, "type": "string", "description": "The alias of the private link service." }, "enableProxyProtocol": { "type": "boolean", "description": "Whether the private link service is enabled for proxy protocol or not." } }, "description": "Properties of the private link service." }, "ResourceSet": { "properties": { "subscriptions": { "type": "array", "items": { "type": "string" }, "description": "The list of subscriptions." } }, "description": "The base resource set for visibility and auto-approval." }, "PrivateLinkServiceIpConfiguration": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/PrivateLinkServiceIpConfigurationProperties", "description": "Properties of the private link service ip configuration." }, "name": { "type": "string", "description": "The name of private link service ip configuration." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "The resource type." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "The private link service ip configuration." }, "PrivateLinkServiceIpConfigurationProperties": { "properties": { "privateIPAddress": { "type": "string", "description": "The private IP address of the IP configuration." }, "privateIPAllocationMethod": { "$ref": "./network.json#/definitions/IPAllocationMethod", "description": "The private IP address allocation method." }, "subnet": { "$ref": "./virtualNetwork.json#/definitions/Subnet", "description": "The reference to the subnet resource." }, "primary": { "type": "boolean", "description": "Whether the ip configuration is primary or not." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the private link service IP configuration resource." }, "privateIPAddressVersion": { "$ref": "./network.json#/definitions/IPVersion", "description": "Whether the specific IP configuration is IPv4 or IPv6. Default is IPv4." } }, "description": "Properties of private link service IP configuration." }, "PrivateEndpointConnection": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/PrivateEndpointConnectionProperties", "description": "Properties of the private end point connection." }, "name": { "type": "string", "description": "The name of the resource that is unique within a resource group. This name can be used to access the resource." }, "type": { "readOnly": true, "type": "string", "description": "The resource type." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "PrivateEndpointConnection resource." }, "PrivateEndpointConnectionProperties": { "properties": { "privateEndpoint": { "readOnly": true, "$ref": "./privateEndpoint.json#/definitions/PrivateEndpoint", "description": "The resource of private end point." }, "privateLinkServiceConnectionState": { "$ref": "#/definitions/PrivateLinkServiceConnectionState", "description": "A collection of information about the state of the connection between service consumer and provider." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the private endpoint connection resource." }, "linkIdentifier": { "readOnly": true, "type": "string", "description": "The consumer link id." } }, "description": "Properties of the PrivateEndpointConnectProperties." }, "PrivateLinkServiceConnectionState": { "properties": { "status": { "type": "string", "description": "Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service." }, "description": { "type": "string", "description": "The reason for approval/rejection of the connection." }, "actionsRequired": { "type": "string", "description": "A message indicating if changes on the service provider require any updates on the consumer." } }, "description": "A collection of information about the state of the connection between service consumer and provider." }, "PrivateLinkServiceListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/PrivateLinkService" }, "description": "A list of PrivateLinkService resources in a resource group." }, "nextLink": { "type": "string", "description": "The URL to get the next set of results.", "readOnly": true } }, "description": "Response for the ListPrivateLinkService API service call." }, "PrivateEndpointConnectionListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/PrivateEndpointConnection" }, "description": "A list of PrivateEndpointConnection resources for a specific private link service." }, "nextLink": { "type": "string", "description": "The URL to get the next set of results.", "readOnly": true } }, "description": "Response for the ListPrivateEndpointConnection API service call." }, "CheckPrivateLinkServiceVisibilityRequest": { "properties": { "privateLinkServiceAlias": { "type": "string", "description": "The alias of the private link service." } }, "description": "Request body of the CheckPrivateLinkServiceVisibility API service call." }, "PrivateLinkServiceVisibility": { "properties": { "visible": { "type": "boolean", "description": "Private Link Service Visibility (True/False)." } }, "description": "Response for the CheckPrivateLinkServiceVisibility API service call." }, "AutoApprovedPrivateLinkServicesResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/AutoApprovedPrivateLinkService" }, "description": "An array of auto approved private link service." }, "nextLink": { "readOnly": true, "type": "string", "description": "The URL to get the next set of results." } }, "description": "An array of private link service id that can be linked to a private end point with auto approved." }, "AutoApprovedPrivateLinkService": { "properties": { "privateLinkService": { "type": "string", "description": "The id of the private link service resource." } }, "description": "The information of an AutoApprovedPrivateLinkService." } } } analysis-0.21.1/fixtures/azure/publicIpAddress.json000066400000000000000000000436121413705513100223730ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "NetworkManagementClient", "description": "The Microsoft Azure Network management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to manage your network resources. The API has entities that capture the relationship between an end user and the Microsoft Azure Networks service.", "version": "2020-04-01" }, "host": "management.azure.com", "schemes": [ "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "security": [ { "azure_auth": [ "user_impersonation" ] } ], "securityDefinitions": { "azure_auth": { "type": "oauth2", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "flow": "implicit", "description": "Azure Active Directory OAuth2 Flow.", "scopes": { "user_impersonation": "impersonate your user account" } } }, "paths": { "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}": { "delete": { "tags": [ "PublicIPAddresses" ], "operationId": "PublicIPAddresses_Delete", "description": "Deletes the specified public IP address.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "publicIpAddressName", "in": "path", "required": true, "type": "string", "description": "The name of the subnet." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "204": { "description": "Request successful. Resource does not exist." }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "200": { "description": "Delete successful." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Delete public IP address": { "$ref": "./examples/PublicIpAddressDelete.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } }, "get": { "tags": [ "PublicIPAddresses" ], "operationId": "PublicIPAddresses_Get", "description": "Gets the specified public IP address in a specified resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "publicIpAddressName", "in": "path", "required": true, "type": "string", "description": "The name of the subnet." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" }, { "name": "$expand", "in": "query", "required": false, "type": "string", "description": "Expands referenced resources." } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting PublicIPAddress resource.", "schema": { "$ref": "#/definitions/PublicIPAddress" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Get public IP address": { "$ref": "./examples/PublicIpAddressGet.json" } } }, "put": { "tags": [ "PublicIPAddresses" ], "operationId": "PublicIPAddresses_CreateOrUpdate", "description": "Creates or updates a static or dynamic public IP address.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "publicIpAddressName", "in": "path", "required": true, "type": "string", "description": "The name of the public IP address." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/PublicIPAddress" }, "description": "Parameters supplied to the create or update public IP address operation." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "201": { "description": "Create successful. The operation returns the resulting PublicIPAddress resource.", "schema": { "$ref": "#/definitions/PublicIPAddress" } }, "200": { "description": "Update successful. The operation returns the resulting PublicIPAddress resource.", "schema": { "$ref": "#/definitions/PublicIPAddress" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Create public IP address defaults": { "$ref": "./examples/PublicIpAddressCreateDefaults.json" }, "Create public IP address allocation method": { "$ref": "./examples/PublicIpAddressCreateCustomizedValues.json" }, "Create public IP address DNS": { "$ref": "./examples/PublicIpAddressCreateDns.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" } }, "patch": { "tags": [ "PublicIPAddresses" ], "operationId": "PublicIPAddresses_UpdateTags", "description": "Updates public IP address tags.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "publicIpAddressName", "in": "path", "required": true, "type": "string", "description": "The name of the public IP address." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "./network.json#/definitions/TagsObject" }, "description": "Parameters supplied to update public IP address tags." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting PublicIPAddress resource.", "schema": { "$ref": "#/definitions/PublicIPAddress" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Update public IP address tags": { "$ref": "./examples/PublicIpAddressUpdateTags.json" } } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPAddresses": { "get": { "tags": [ "PublicIPAddresses" ], "operationId": "PublicIPAddresses_ListAll", "description": "Gets all the public IP addresses in a subscription.", "parameters": [ { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of PublicIPAddress resources.", "schema": { "$ref": "#/definitions/PublicIPAddressListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "List all public IP addresses": { "$ref": "./examples/PublicIpAddressListAll.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses": { "get": { "tags": [ "PublicIPAddresses" ], "operationId": "PublicIPAddresses_List", "description": "Gets all public IP addresses in a resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of PublicIPAddress resources.", "schema": { "$ref": "#/definitions/PublicIPAddressListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "List resource group public IP addresses": { "$ref": "./examples/PublicIpAddressList.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } } }, "definitions": { "PublicIPAddressSku": { "properties": { "name": { "type": "string", "description": "Name of a public IP address SKU.", "enum": [ "Basic", "Standard" ], "x-ms-enum": { "name": "PublicIPAddressSkuName", "modelAsString": true } } }, "description": "SKU of a public IP address." }, "PublicIPAddressPropertiesFormat": { "properties": { "publicIPAllocationMethod": { "$ref": "./network.json#/definitions/IPAllocationMethod", "description": "The public IP address allocation method." }, "publicIPAddressVersion": { "$ref": "./network.json#/definitions/IPVersion", "description": "The public IP address version." }, "ipConfiguration": { "readOnly": true, "$ref": "./networkInterface.json#/definitions/IPConfiguration", "description": "The IP configuration associated with the public IP address." }, "dnsSettings": { "$ref": "#/definitions/PublicIPAddressDnsSettings", "description": "The FQDN of the DNS record associated with the public IP address." }, "ddosSettings": { "$ref": "#/definitions/DdosSettings", "description": "The DDoS protection custom policy associated with the public IP address." }, "ipTags": { "type": "array", "items": { "$ref": "#/definitions/IpTag" }, "description": "The list of tags associated with the public IP address." }, "ipAddress": { "type": "string", "description": "The IP address associated with the public IP address resource." }, "publicIPPrefix": { "$ref": "./network.json#/definitions/SubResource", "description": "The Public IP Prefix this Public IP Address should be allocated from." }, "idleTimeoutInMinutes": { "type": "integer", "format": "int32", "description": "The idle timeout of the public IP address." }, "resourceGuid": { "readOnly": true, "type": "string", "description": "The resource GUID property of the public IP address resource." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the public IP address resource." } }, "description": "Public IP address properties." }, "PublicIPAddress": { "properties": { "sku": { "$ref": "#/definitions/PublicIPAddressSku", "description": "The public IP address SKU." }, "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/PublicIPAddressPropertiesFormat", "description": "Public IP address properties." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "zones": { "type": "array", "items": { "type": "string" }, "description": "A list of availability zones denoting the IP allocated for the resource needs to come from." } }, "allOf": [ { "$ref": "./network.json#/definitions/Resource" } ], "description": "Public IP address resource." }, "PublicIPAddressListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/PublicIPAddress" }, "description": "A list of public IP addresses that exists in a resource group." }, "nextLink": { "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for ListPublicIpAddresses API service call." }, "PublicIPAddressDnsSettings": { "properties": { "domainNameLabel": { "type": "string", "description": "The domain name label. The concatenation of the domain name label and the regionalized DNS zone make up the fully qualified domain name associated with the public IP address. If a domain name label is specified, an A DNS record is created for the public IP in the Microsoft Azure DNS system." }, "fqdn": { "type": "string", "description": "The Fully Qualified Domain Name of the A DNS record associated with the public IP. This is the concatenation of the domainNameLabel and the regionalized DNS zone." }, "reverseFqdn": { "type": "string", "description": "The reverse FQDN. A user-visible, fully qualified domain name that resolves to this public IP address. If the reverseFqdn is specified, then a PTR DNS record is created pointing from the IP address in the in-addr.arpa domain to the reverse FQDN." } }, "description": "Contains FQDN of the DNS record associated with the public IP address." }, "DdosSettings": { "properties": { "ddosCustomPolicy": { "readOnly": false, "$ref": "./network.json#/definitions/SubResource", "description": "The DDoS custom policy associated with the public IP." }, "protectionCoverage": { "readOnly": false, "type": "string", "enum": [ "Basic", "Standard" ], "x-ms-enum": { "name": "DdosSettingsProtectionCoverage", "modelAsString": true }, "description": "The DDoS protection policy customizability of the public IP. Only standard coverage will have the ability to be customized." }, "protectedIP": { "readOnly": false, "type": "boolean", "description": "Enables DDoS protection on the public IP." } }, "description": "Contains the DDoS protection settings of the public IP." }, "IpTag": { "properties": { "ipTagType": { "type": "string", "description": "The IP tag type. Example: FirstPartyUsage." }, "tag": { "type": "string", "description": "The value of the IP tag associated with the public IP. Example: SQL." } }, "description": "Contains the IpTag associated with the object." } } } analysis-0.21.1/fixtures/azure/routeTable.json000066400000000000000000000555511413705513100214310ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "NetworkManagementClient", "description": "The Microsoft Azure Network management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to manage your network resources. The API has entities that capture the relationship between an end user and the Microsoft Azure Networks service.", "version": "2020-04-01" }, "host": "management.azure.com", "schemes": [ "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "security": [ { "azure_auth": [ "user_impersonation" ] } ], "securityDefinitions": { "azure_auth": { "type": "oauth2", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "flow": "implicit", "description": "Azure Active Directory OAuth2 Flow.", "scopes": { "user_impersonation": "impersonate your user account" } } }, "paths": { "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}": { "delete": { "tags": [ "RouteTables" ], "operationId": "RouteTables_Delete", "description": "Deletes the specified route table.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "routeTableName", "in": "path", "required": true, "type": "string", "description": "The name of the route table." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "204": { "description": "Request successful. Resource does not exist." }, "200": { "description": "Request successful. Operation to delete was accepted." }, "202": { "description": "Accepted. If route table not found returned synchronously, otherwise if found returned asynchronously." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" }, "x-ms-examples": { "Delete route table": { "$ref": "./examples/RouteTableDelete.json" } } }, "get": { "tags": [ "RouteTables" ], "operationId": "RouteTables_Get", "description": "Gets the specified route table.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "routeTableName", "in": "path", "required": true, "type": "string", "description": "The name of the route table." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" }, { "name": "$expand", "in": "query", "required": false, "type": "string", "description": "Expands referenced resources." } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting RouteTable resource.", "schema": { "$ref": "#/definitions/RouteTable" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Get route table": { "$ref": "./examples/RouteTableGet.json" } } }, "put": { "tags": [ "RouteTables" ], "operationId": "RouteTables_CreateOrUpdate", "description": "Create or updates a route table in a specified resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "routeTableName", "in": "path", "required": true, "type": "string", "description": "The name of the route table." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/RouteTable" }, "description": "Parameters supplied to the create or update route table operation." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting RouteTable resource.", "schema": { "$ref": "#/definitions/RouteTable" } }, "201": { "description": "Create successful. The operation returns the resulting RouteTable resource.", "schema": { "$ref": "#/definitions/RouteTable" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Create route table": { "$ref": "./examples/RouteTableCreate.json" }, "Create route table with route": { "$ref": "./examples/RouteTableCreateWithRoute.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" } }, "patch": { "tags": [ "RouteTables" ], "operationId": "RouteTables_UpdateTags", "description": "Updates a route table tags.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "routeTableName", "in": "path", "required": true, "type": "string", "description": "The name of the route table." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "./network.json#/definitions/TagsObject" }, "description": "Parameters supplied to update route table tags." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting RouteTable resource.", "schema": { "$ref": "#/definitions/RouteTable" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Update route table tags": { "$ref": "./examples/RouteTableUpdateTags.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables": { "get": { "tags": [ "RouteTables" ], "operationId": "RouteTables_List", "description": "Gets all route tables in a resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of RouteTable resources.", "schema": { "$ref": "#/definitions/RouteTableListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "List route tables in resource group": { "$ref": "./examples/RouteTableList.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/routeTables": { "get": { "tags": [ "RouteTables" ], "operationId": "RouteTables_ListAll", "description": "Gets all route tables in a subscription.", "parameters": [ { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of RouteTable resources.", "schema": { "$ref": "#/definitions/RouteTableListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "List all route tables": { "$ref": "./examples/RouteTableListAll.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}": { "delete": { "tags": [ "Routes" ], "operationId": "Routes_Delete", "description": "Deletes the specified route from a route table.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "routeTableName", "in": "path", "required": true, "type": "string", "description": "The name of the route table." }, { "name": "routeName", "in": "path", "required": true, "type": "string", "description": "The name of the route." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "202": { "description": "Accepted and the operation will complete asynchronously." }, "200": { "description": "Accepted." }, "204": { "description": "Route was deleted or not found." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Delete route": { "$ref": "./examples/RouteTableRouteDelete.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } }, "get": { "tags": [ "Routes" ], "operationId": "Routes_Get", "description": "Gets the specified route from a route table.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "routeTableName", "in": "path", "required": true, "type": "string", "description": "The name of the route table." }, { "name": "routeName", "in": "path", "required": true, "type": "string", "description": "The name of the route." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting Route resource.", "schema": { "$ref": "#/definitions/Route" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Get route": { "$ref": "./examples/RouteTableRouteGet.json" } } }, "put": { "tags": [ "Routes" ], "operationId": "Routes_CreateOrUpdate", "description": "Creates or updates a route in the specified route table.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "routeTableName", "in": "path", "required": true, "type": "string", "description": "The name of the route table." }, { "name": "routeName", "in": "path", "required": true, "type": "string", "description": "The name of the route." }, { "name": "routeParameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/Route" }, "description": "Parameters supplied to the create or update route operation." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting Route resource.", "schema": { "$ref": "#/definitions/Route" } }, "201": { "description": "Create successful. The operation returns the resulting Route resource.", "schema": { "$ref": "#/definitions/Route" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Create route": { "$ref": "./examples/RouteTableRouteCreate.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes": { "get": { "tags": [ "Routes" ], "operationId": "Routes_List", "description": "Gets all routes in a route table.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "routeTableName", "in": "path", "required": true, "type": "string", "description": "The name of the route table." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of Route resources.", "schema": { "$ref": "#/definitions/RouteListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-pageable": { "nextLinkName": "nextLink" }, "x-ms-examples": { "List routes": { "$ref": "./examples/RouteTableRouteList.json" } } } } }, "definitions": { "RoutePropertiesFormat": { "properties": { "addressPrefix": { "type": "string", "description": "The destination CIDR to which the route applies." }, "nextHopType": { "$ref": "#/definitions/RouteNextHopType", "description": "The type of Azure hop the packet should be sent to." }, "nextHopIpAddress": { "type": "string", "description": "The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the route resource." } }, "required": [ "nextHopType" ], "description": "Route resource." }, "Route": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/RoutePropertiesFormat", "description": "Properties of the route." }, "name": { "type": "string", "description": "The name of the resource that is unique within a resource group. This name can be used to access the resource." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Route resource." }, "RouteTablePropertiesFormat": { "properties": { "routes": { "type": "array", "items": { "$ref": "#/definitions/Route" }, "description": "Collection of routes contained within a route table." }, "subnets": { "readOnly": true, "type": "array", "items": { "$ref": "./virtualNetwork.json#/definitions/Subnet" }, "description": "A collection of references to subnets." }, "disableBgpRoutePropagation": { "type": "boolean", "description": "Whether to disable the routes learned by BGP on that route table. True means disable." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the route table resource." } }, "description": "Route Table resource." }, "RouteTable": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/RouteTablePropertiesFormat", "description": "Properties of the route table." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/Resource" } ], "description": "Route table resource." }, "RouteTableListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/RouteTable" }, "description": "A list of route tables in a resource group." }, "nextLink": { "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for the ListRouteTable API service call." }, "RouteListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/Route" }, "description": "A list of routes in a resource group." }, "nextLink": { "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for the ListRoute API service call." }, "RouteNextHopType": { "type": "string", "description": "The type of Azure hop the packet should be sent to.", "enum": [ "VirtualNetworkGateway", "VnetLocal", "Internet", "VirtualAppliance", "None" ], "x-ms-enum": { "name": "RouteNextHopType", "modelAsString": true } } } } analysis-0.21.1/fixtures/azure/serviceEndpointPolicy.json000066400000000000000000000615071413705513100236420ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "NetworkManagementClient", "description": "The Microsoft Azure Network management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to manage your network resources. The API has entities that capture the relationship between an end user and the Microsoft Azure Networks service.", "version": "2020-04-01" }, "host": "management.azure.com", "schemes": [ "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "security": [ { "azure_auth": [ "user_impersonation" ] } ], "securityDefinitions": { "azure_auth": { "type": "oauth2", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "flow": "implicit", "description": "Azure Active Directory OAuth2 Flow.", "scopes": { "user_impersonation": "impersonate your user account" } } }, "paths": { "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}": { "delete": { "tags": [ "ServiceEndpointPolicies" ], "operationId": "ServiceEndpointPolicies_Delete", "description": "Deletes the specified service endpoint policy.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "serviceEndpointPolicyName", "in": "path", "required": true, "type": "string", "description": "The name of the service endpoint policy." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "202": { "description": "Accepted and the operation will complete asynchronously." }, "200": { "description": "Delete successful." }, "204": { "description": "Request successful. Resource does not exist." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Delete service endpoint policy": { "$ref": "./examples/ServiceEndpointPolicyDelete.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } }, "get": { "tags": [ "ServiceEndpointPolicies" ], "operationId": "ServiceEndpointPolicies_Get", "description": "Gets the specified service Endpoint Policies in a specified resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "serviceEndpointPolicyName", "in": "path", "required": true, "type": "string", "description": "The name of the service endpoint policy." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" }, { "name": "$expand", "in": "query", "required": false, "type": "string", "description": "Expands referenced resources." } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting ServiceEndpointPolicy resource.", "schema": { "$ref": "#/definitions/ServiceEndpointPolicy" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Get service endPoint Policy": { "$ref": "./examples/ServiceEndpointPolicyGet.json" } } }, "put": { "tags": [ "ServiceEndpointPolicies" ], "operationId": "ServiceEndpointPolicies_CreateOrUpdate", "description": "Creates or updates a service Endpoint Policies.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "serviceEndpointPolicyName", "in": "path", "required": true, "type": "string", "description": "The name of the service endpoint policy." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/ServiceEndpointPolicy" }, "description": "Parameters supplied to the create or update service endpoint policy operation." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "201": { "description": "Create successful. The operation returns the resulting ServiceEndpointPolicy resource.", "schema": { "$ref": "#/definitions/ServiceEndpointPolicy" } }, "200": { "description": "Update successful. The operation returns the resulting ServiceEndpointPolicy resource.", "schema": { "$ref": "#/definitions/ServiceEndpointPolicy" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Create service endpoint policy": { "$ref": "./examples/ServiceEndpointPolicyCreate.json" }, "Create service endpoint policy with definition": { "$ref": "./examples/ServiceEndpointPolicyCreateWithDefinition.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" } }, "patch": { "tags": [ "ServiceEndpointPolicies" ], "operationId": "ServiceEndpointPolicies_UpdateTags", "description": "Updates tags of a service endpoint policy.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "serviceEndpointPolicyName", "in": "path", "required": true, "type": "string", "description": "The name of the service endpoint policy." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "./network.json#/definitions/TagsObject" }, "description": "Parameters supplied to update service endpoint policy tags." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting ServiceEndpointPolicy resource.", "schema": { "$ref": "#/definitions/ServiceEndpointPolicy" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Update service endpoint policy tags": { "$ref": "./examples/ServiceEndpointPolicyUpdateTags.json" } } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ServiceEndpointPolicies": { "get": { "tags": [ "ServiceEndpointPolicies" ], "operationId": "ServiceEndpointPolicies_List", "description": "Gets all the service endpoint policies in a subscription.", "parameters": [ { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of ServiceEndpointPolicy resources.", "schema": { "$ref": "#/definitions/ServiceEndpointPolicyListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "List all service endpoint policy": { "$ref": "./examples/ServiceEndpointPolicyListAll.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies": { "get": { "tags": [ "ServiceEndpointPolicies" ], "operationId": "ServiceEndpointPolicies_ListByResourceGroup", "description": "Gets all service endpoint Policies in a resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of ServiceEndpointPolicy resources.", "schema": { "$ref": "#/definitions/ServiceEndpointPolicyListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "List resource group service endpoint policies": { "$ref": "./examples/ServiceEndpointPolicyList.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions/{serviceEndpointPolicyDefinitionName}": { "delete": { "tags": [ "ServiceEndpointPolicyDefinitions" ], "operationId": "ServiceEndpointPolicyDefinitions_Delete", "description": "Deletes the specified ServiceEndpoint policy definitions.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "serviceEndpointPolicyName", "in": "path", "required": true, "type": "string", "description": "The name of the Service Endpoint Policy." }, { "name": "serviceEndpointPolicyDefinitionName", "in": "path", "required": true, "type": "string", "description": "The name of the service endpoint policy definition." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "204": { "description": "Request successful. Resource does not exist." }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "200": { "description": "Delete successful." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Delete service endpoint policy definitions from service endpoint policy": { "$ref": "./examples/ServiceEndpointPolicyDefinitionDelete.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } }, "get": { "tags": [ "serviceEndpointPolicyDefinitions" ], "operationId": "ServiceEndpointPolicyDefinitions_Get", "description": "Get the specified service endpoint policy definitions from service endpoint policy.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "serviceEndpointPolicyName", "in": "path", "required": true, "type": "string", "description": "The name of the service endpoint policy name." }, { "name": "serviceEndpointPolicyDefinitionName", "in": "path", "required": true, "type": "string", "description": "The name of the service endpoint policy definition name." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting ServiceEndpointPolicyDefinition resource.", "schema": { "$ref": "#/definitions/ServiceEndpointPolicyDefinition" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Get service endpoint definition in service endpoint policy": { "$ref": "./examples/ServiceEndpointPolicyDefinitionGet.json" } } }, "put": { "tags": [ "serviceEndpointPolicyDefinitions" ], "operationId": "ServiceEndpointPolicyDefinitions_CreateOrUpdate", "description": "Creates or updates a service endpoint policy definition in the specified service endpoint policy.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "serviceEndpointPolicyName", "in": "path", "required": true, "type": "string", "description": "The name of the service endpoint policy." }, { "name": "serviceEndpointPolicyDefinitionName", "in": "path", "required": true, "type": "string", "description": "The name of the service endpoint policy definition name." }, { "name": "ServiceEndpointPolicyDefinitions", "in": "body", "required": true, "schema": { "$ref": "#/definitions/ServiceEndpointPolicyDefinition" }, "description": "Parameters supplied to the create or update service endpoint policy operation." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting ServiceEndpointPolicyDefinition resource.", "schema": { "$ref": "#/definitions/ServiceEndpointPolicyDefinition" } }, "201": { "description": "Create successful. The operation returns the resulting ServiceEndpointPolicyDefinition resource.", "schema": { "$ref": "#/definitions/ServiceEndpointPolicyDefinition" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Create service endpoint policy definition": { "$ref": "./examples/ServiceEndpointPolicyDefinitionCreate.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions": { "get": { "tags": [ "ServiceEndpointPolicyDefinitions" ], "operationId": "ServiceEndpointPolicyDefinitions_ListByResourceGroup", "description": "Gets all service endpoint policy definitions in a service end point policy.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "serviceEndpointPolicyName", "in": "path", "required": true, "type": "string", "description": "The name of the service endpoint policy name." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of ServiceEndpointPolicyDefinition resources.", "schema": { "$ref": "#/definitions/ServiceEndpointPolicyDefinitionListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "List service endpoint definitions in service end point policy": { "$ref": "./examples/ServiceEndpointPolicyDefinitionList.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } } }, "definitions": { "ServiceEndpointPolicyDefinitionPropertiesFormat": { "properties": { "description": { "type": "string", "description": "A description for this rule. Restricted to 140 chars." }, "service": { "type": "string", "description": "Service endpoint name." }, "serviceResources": { "type": "array", "items": { "type": "string" }, "description": "A list of service resources." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the service endpoint policy definition resource." } }, "description": "Service Endpoint policy definition resource." }, "ServiceEndpointPolicyDefinition": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ServiceEndpointPolicyDefinitionPropertiesFormat", "description": "Properties of the service endpoint policy definition." }, "name": { "type": "string", "description": "The name of the resource that is unique within a resource group. This name can be used to access the resource." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Service Endpoint policy definitions." }, "ServiceEndpointPolicyDefinitionListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/ServiceEndpointPolicyDefinition" }, "description": "The service endpoint policy definition in a service endpoint policy." }, "nextLink": { "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for ListServiceEndpointPolicyDefinition API service call. Retrieves all service endpoint policy definition that belongs to a service endpoint policy." }, "ServiceEndpointPolicyPropertiesFormat": { "properties": { "serviceEndpointPolicyDefinitions": { "type": "array", "items": { "$ref": "#/definitions/ServiceEndpointPolicyDefinition" }, "description": "A collection of service endpoint policy definitions of the service endpoint policy." }, "subnets": { "readOnly": true, "type": "array", "items": { "$ref": "./virtualNetwork.json#/definitions/Subnet" }, "description": "A collection of references to subnets." }, "resourceGuid": { "type": "string", "readOnly": true, "description": "The resource GUID property of the service endpoint policy resource." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the service endpoint policy resource." } }, "description": "Service Endpoint Policy resource." }, "ServiceEndpointPolicy": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ServiceEndpointPolicyPropertiesFormat", "description": "Properties of the service end point policy." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/Resource" } ], "description": "Service End point policy resource." }, "ServiceEndpointPolicyListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/ServiceEndpointPolicy" }, "description": "A list of ServiceEndpointPolicy resources." }, "nextLink": { "readOnly": true, "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for ListServiceEndpointPolicies API service call." } } } analysis-0.21.1/fixtures/azure/virtualNetwork.json000066400000000000000000002016431413705513100223560ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "NetworkManagementClient", "description": "The Microsoft Azure Network management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to manage your network resources. The API has entities that capture the relationship between an end user and the Microsoft Azure Networks service.", "version": "2020-04-01" }, "host": "management.azure.com", "schemes": [ "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "security": [ { "azure_auth": [ "user_impersonation" ] } ], "securityDefinitions": { "azure_auth": { "type": "oauth2", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "flow": "implicit", "description": "Azure Active Directory OAuth2 Flow.", "scopes": { "user_impersonation": "impersonate your user account" } } }, "paths": { "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}": { "delete": { "tags": [ "VirtualNetworks" ], "operationId": "VirtualNetworks_Delete", "description": "Deletes the specified virtual network.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "virtualNetworkName", "in": "path", "required": true, "type": "string", "description": "The name of the virtual network." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "202": { "description": "Accepted and the operation will complete asynchronously." }, "204": { "description": "Delete successful." }, "200": { "description": "Delete successful." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" }, "x-ms-examples": { "Delete virtual network": { "$ref": "./examples/VirtualNetworkDelete.json" } } }, "get": { "tags": [ "VirtualNetworks" ], "operationId": "VirtualNetworks_Get", "description": "Gets the specified virtual network by resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "virtualNetworkName", "in": "path", "required": true, "type": "string", "description": "The name of the virtual network." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" }, { "name": "$expand", "in": "query", "required": false, "type": "string", "description": "Expands referenced resources." } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting VirtualNetwork resource.", "schema": { "$ref": "#/definitions/VirtualNetwork" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Get virtual network": { "$ref": "./examples/VirtualNetworkGet.json" }, "Get virtual network with a delegated subnet": { "$ref": "./examples/VirtualNetworkGetWithSubnetDelegation.json" }, "Get virtual network with service association links": { "$ref": "./examples/VirtualNetworkGetWithServiceAssociationLink.json" } } }, "put": { "tags": [ "VirtualNetworks" ], "operationId": "VirtualNetworks_CreateOrUpdate", "description": "Creates or updates a virtual network in the specified resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "virtualNetworkName", "in": "path", "required": true, "type": "string", "description": "The name of the virtual network." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/VirtualNetwork" }, "description": "Parameters supplied to the create or update virtual network operation." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting VirtualNetwork resource.", "schema": { "$ref": "#/definitions/VirtualNetwork" } }, "201": { "description": "Create successful. The operation returns the resulting VirtualNetwork resource.", "schema": { "$ref": "#/definitions/VirtualNetwork" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" }, "x-ms-examples": { "Create virtual network": { "$ref": "./examples/VirtualNetworkCreate.json" }, "Create virtual network with subnet": { "$ref": "./examples/VirtualNetworkCreateSubnet.json" }, "Create virtual network with subnet containing address prefixes": { "$ref": "./examples/VirtualNetworkCreateSubnetWithAddressPrefixes.json" }, "Create virtual network with Bgp Communities": { "$ref": "./examples/VirtualNetworkCreateWithBgpCommunities.json" }, "Create virtual network with service endpoints": { "$ref": "./examples/VirtualNetworkCreateServiceEndpoints.json" }, "Create virtual network with service endpoints and service endpoint policy": { "$ref": "./examples/VirtualNetworkCreateServiceEndpointPolicy.json" }, "Create virtual network with delegated subnets": { "$ref": "./examples/VirtualNetworkCreateSubnetWithDelegation.json" } } }, "patch": { "tags": [ "VirtualNetworks" ], "operationId": "VirtualNetworks_UpdateTags", "description": "Updates a virtual network tags.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "virtualNetworkName", "in": "path", "required": true, "type": "string", "description": "The name of the virtual network." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "./network.json#/definitions/TagsObject" }, "description": "Parameters supplied to update virtual network tags." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting VirtualNetwork resource.", "schema": { "$ref": "#/definitions/VirtualNetwork" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Update virtual network tags": { "$ref": "./examples/VirtualNetworkUpdateTags.json" } } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworks": { "get": { "tags": [ "VirtualNetworks" ], "operationId": "VirtualNetworks_ListAll", "description": "Gets all virtual networks in a subscription.", "parameters": [ { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of VirtualNetwork resources.", "schema": { "$ref": "#/definitions/VirtualNetworkListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "List all virtual networks": { "$ref": "./examples/VirtualNetworkListAll.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks": { "get": { "tags": [ "VirtualNetworks" ], "operationId": "VirtualNetworks_List", "description": "Gets all virtual networks in a resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of VirtualNetwork resources.", "schema": { "$ref": "#/definitions/VirtualNetworkListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "List virtual networks in resource group": { "$ref": "./examples/VirtualNetworkList.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}": { "delete": { "tags": [ "Subnets" ], "operationId": "Subnets_Delete", "description": "Deletes the specified subnet.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "virtualNetworkName", "in": "path", "required": true, "type": "string", "description": "The name of the virtual network." }, { "name": "subnetName", "in": "path", "required": true, "type": "string", "description": "The name of the subnet." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Delete successful." }, "204": { "description": "Request successful. Resource does not exist." }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Delete subnet": { "$ref": "./examples/SubnetDelete.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } }, "get": { "tags": [ "Subnets" ], "operationId": "Subnets_Get", "description": "Gets the specified subnet by virtual network and resource group.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "virtualNetworkName", "in": "path", "required": true, "type": "string", "description": "The name of the virtual network." }, { "name": "subnetName", "in": "path", "required": true, "type": "string", "description": "The name of the subnet." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" }, { "name": "$expand", "in": "query", "required": false, "type": "string", "description": "Expands referenced resources." } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting Subnet resource.", "schema": { "$ref": "#/definitions/Subnet" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Get subnet": { "$ref": "./examples/SubnetGet.json" }, "Get subnet with a delegation": { "$ref": "./examples/SubnetGetWithDelegation.json" } } }, "put": { "tags": [ "Subnets" ], "operationId": "Subnets_CreateOrUpdate", "description": "Creates or updates a subnet in the specified virtual network.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "virtualNetworkName", "in": "path", "required": true, "type": "string", "description": "The name of the virtual network." }, { "name": "subnetName", "in": "path", "required": true, "type": "string", "description": "The name of the subnet." }, { "name": "subnetParameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/Subnet" }, "description": "Parameters supplied to the create or update subnet operation." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting Subnet resource.", "schema": { "$ref": "#/definitions/Subnet" } }, "201": { "description": "Create successful. The operation returns the resulting Subnet resource.", "schema": { "$ref": "#/definitions/Subnet" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" }, "x-ms-examples": { "Create subnet": { "$ref": "./examples/SubnetCreate.json" }, "Create subnet with service endpoints": { "$ref": "./examples/SubnetCreateServiceEndpoint.json" }, "Create subnet with a delegation": { "$ref": "./examples/SubnetCreateWithDelegation.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/PrepareNetworkPolicies": { "post": { "operationId": "Subnets_PrepareNetworkPolicies", "description": "Prepares a subnet by applying network intent policies.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "virtualNetworkName", "in": "path", "required": true, "type": "string", "description": "The name of the virtual network." }, { "name": "subnetName", "in": "path", "required": true, "type": "string", "description": "The name of the subnet." }, { "name": "prepareNetworkPoliciesRequestParameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/PrepareNetworkPoliciesRequest" }, "description": "Parameters supplied to prepare subnet by applying network intent policies." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Preparing subnet by applying network intent policies is successful." }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" }, "x-ms-examples": { "Prepare Network Policies": { "$ref": "./examples/SubnetPrepareNetworkPolicies.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/UnprepareNetworkPolicies": { "post": { "operationId": "Subnets_UnprepareNetworkPolicies", "description": "Unprepares a subnet by removing network intent policies.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "virtualNetworkName", "in": "path", "required": true, "type": "string", "description": "The name of the virtual network." }, { "name": "subnetName", "in": "path", "required": true, "type": "string", "description": "The name of the subnet." }, { "name": "unprepareNetworkPoliciesRequestParameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/UnprepareNetworkPoliciesRequest" }, "description": "Parameters supplied to unprepare subnet to remove network intent policies." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Unpreparing subnet by removing network intent policies is successful." }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" }, "x-ms-examples": { "Unprepare Network Policies": { "$ref": "./examples/SubnetUnprepareNetworkPolicies.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/ResourceNavigationLinks": { "get": { "operationId": "ResourceNavigationLinks_List", "description": "Gets a list of resource navigation links for a subnet.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "virtualNetworkName", "in": "path", "required": true, "type": "string", "description": "The name of the virtual network." }, { "name": "subnetName", "in": "path", "required": true, "type": "string", "description": "The name of the subnet." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of resource navigation links for the subnet.", "schema": { "$ref": "#/definitions/ResourceNavigationLinksListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Get Resource Navigation Links": { "$ref": "./examples/VirtualNetworkGetResourceNavigationLinks.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/ServiceAssociationLinks": { "get": { "operationId": "ServiceAssociationLinks_List", "description": "Gets a list of service association links for a subnet.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "virtualNetworkName", "in": "path", "required": true, "type": "string", "description": "The name of the virtual network." }, { "name": "subnetName", "in": "path", "required": true, "type": "string", "description": "The name of the subnet." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of service association links for the subnet.", "schema": { "$ref": "#/definitions/ServiceAssociationLinksListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Get Service Association Links": { "$ref": "./examples/VirtualNetworkGetServiceAssociationLinks.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets": { "get": { "tags": [ "Subnets" ], "operationId": "Subnets_List", "description": "Gets all subnets in a virtual network.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "virtualNetworkName", "in": "path", "required": true, "type": "string", "description": "The name of the virtual network." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of Subnet resources.", "schema": { "$ref": "#/definitions/SubnetListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-pageable": { "nextLinkName": "nextLink" }, "x-ms-examples": { "List subnets": { "$ref": "./examples/SubnetList.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}": { "delete": { "tags": [ "VirtualNetworkPeerings" ], "operationId": "VirtualNetworkPeerings_Delete", "description": "Deletes the specified virtual network peering.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "virtualNetworkName", "in": "path", "required": true, "type": "string", "description": "The name of the virtual network." }, { "name": "virtualNetworkPeeringName", "in": "path", "required": true, "type": "string", "description": "The name of the virtual network peering." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Delete successful." }, "204": { "description": "Delete successful." }, "202": { "description": "Accepted and the operation will complete asynchronously." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Delete peering": { "$ref": "./examples/VirtualNetworkPeeringDelete.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } }, "get": { "tags": [ "VirtualNetworkPeerings" ], "operationId": "VirtualNetworkPeerings_Get", "description": "Gets the specified virtual network peering.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "virtualNetworkName", "in": "path", "required": true, "type": "string", "description": "The name of the virtual network." }, { "name": "virtualNetworkPeeringName", "in": "path", "required": true, "type": "string", "description": "The name of the virtual network peering." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting VirtualNetworkPeering resource.", "schema": { "$ref": "#/definitions/VirtualNetworkPeering" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Get peering": { "$ref": "./examples/VirtualNetworkPeeringGet.json" } } }, "put": { "tags": [ "VirtualNetworkPeerings" ], "operationId": "VirtualNetworkPeerings_CreateOrUpdate", "description": "Creates or updates a peering in the specified virtual network.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "virtualNetworkName", "in": "path", "required": true, "type": "string", "description": "The name of the virtual network." }, { "name": "virtualNetworkPeeringName", "in": "path", "required": true, "type": "string", "description": "The name of the peering." }, { "name": "VirtualNetworkPeeringParameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/VirtualNetworkPeering" }, "description": "Parameters supplied to the create or update virtual network peering operation." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting VirtualNetworkPeering resource.", "schema": { "$ref": "#/definitions/VirtualNetworkPeering" } }, "201": { "description": "Create successful. The operation returns the resulting VirtualNetworkPeering resource.", "schema": { "$ref": "#/definitions/VirtualNetworkPeering" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Create peering": { "$ref": "./examples/VirtualNetworkPeeringCreate.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings": { "get": { "tags": [ "VirtualNetworkPeerings" ], "operationId": "VirtualNetworkPeerings_List", "description": "Gets all virtual network peerings in a virtual network.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "virtualNetworkName", "in": "path", "required": true, "type": "string", "description": "The name of the virtual network." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of VirtualNetworkPeering resources.", "schema": { "$ref": "#/definitions/VirtualNetworkPeeringListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-pageable": { "nextLinkName": "nextLink" }, "x-ms-examples": { "List peerings": { "$ref": "./examples/VirtualNetworkPeeringList.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/CheckIPAddressAvailability": { "get": { "operationId": "VirtualNetworks_CheckIPAddressAvailability", "description": "Checks whether a private IP address is available for use.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "virtualNetworkName", "in": "path", "required": true, "type": "string", "description": "The name of the virtual network." }, { "name": "ipAddress", "in": "query", "required": true, "type": "string", "description": "The private IP address to be verified." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Private IP address availability and list of other free addresses if the requested one is not available.", "schema": { "$ref": "#/definitions/IPAddressAvailabilityResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Check IP address availability": { "$ref": "./examples/VirtualNetworkCheckIPAddressAvailability.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/usages": { "get": { "operationId": "VirtualNetworks_ListUsage", "description": "Lists usage stats.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "virtualNetworkName", "in": "path", "required": true, "type": "string", "description": "The name of the virtual network." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Usage stats for vnet.", "schema": { "$ref": "#/definitions/VirtualNetworkListUsageResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "VnetGetUsage": { "$ref": "./examples/VirtualNetworkListUsage.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } } }, "definitions": { "ServiceAssociationLinkPropertiesFormat": { "properties": { "linkedResourceType": { "type": "string", "description": "Resource type of the linked resource." }, "link": { "type": "string", "description": "Link to the external resource." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the service association link resource." }, "allowDelete": { "type": "boolean", "description": "If true, the resource can be deleted." }, "locations": { "type": "array", "items": { "type": "string" }, "description": "A list of locations." } }, "description": "Properties of ServiceAssociationLink." }, "ServiceAssociationLink": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ServiceAssociationLinkPropertiesFormat", "description": "Resource navigation link properties format." }, "name": { "type": "string", "description": "Name of the resource that is unique within a resource group. This name can be used to access the resource." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Resource type." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "ServiceAssociationLink resource." }, "ResourceNavigationLinkFormat": { "properties": { "linkedResourceType": { "type": "string", "description": "Resource type of the linked resource." }, "link": { "type": "string", "description": "Link to the external resource." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the resource navigation link resource." } }, "description": "Properties of ResourceNavigationLink." }, "ResourceNavigationLink": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ResourceNavigationLinkFormat", "description": "Resource navigation link properties format." }, "name": { "type": "string", "description": "Name of the resource that is unique within a resource group. This name can be used to access the resource." }, "id": { "type": "string", "readOnly": true, "description": "Resource navigation link identifier." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." }, "type": { "readOnly": true, "type": "string", "description": "Resource type." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "ResourceNavigationLink resource." }, "ServiceDelegationPropertiesFormat": { "properties": { "serviceName": { "type": "string", "description": "The name of the service to whom the subnet should be delegated (e.g. Microsoft.Sql/servers)." }, "actions": { "readOnly": true, "type": "array", "items": { "type": "string" }, "description": "The actions permitted to the service upon delegation." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the service delegation resource." } }, "description": "Properties of a service delegation." }, "Delegation": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/ServiceDelegationPropertiesFormat", "description": "Properties of the subnet." }, "name": { "type": "string", "description": "The name of the resource that is unique within a subnet. This name can be used to access the resource." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Details the service to which the subnet is delegated." }, "SubnetPropertiesFormat": { "properties": { "addressPrefix": { "type": "string", "description": "The address prefix for the subnet." }, "addressPrefixes": { "type": "array", "items": { "type": "string" }, "description": "List of address prefixes for the subnet." }, "networkSecurityGroup": { "$ref": "./networkSecurityGroup.json#/definitions/NetworkSecurityGroup", "description": "The reference to the NetworkSecurityGroup resource." }, "routeTable": { "$ref": "./routeTable.json#/definitions/RouteTable", "description": "The reference to the RouteTable resource." }, "natGateway": { "$ref": "./network.json#/definitions/SubResource", "description": "Nat gateway associated with this subnet." }, "serviceEndpoints": { "type": "array", "items": { "$ref": "#/definitions/ServiceEndpointPropertiesFormat" }, "description": "An array of service endpoints." }, "serviceEndpointPolicies": { "type": "array", "items": { "$ref": "./serviceEndpointPolicy.json#/definitions/ServiceEndpointPolicy" }, "description": "An array of service endpoint policies." }, "privateEndpoints": { "readOnly": true, "type": "array", "items": { "$ref": "./privateEndpoint.json#/definitions/PrivateEndpoint" }, "description": "An array of references to private endpoints." }, "ipConfigurations": { "readOnly": true, "type": "array", "items": { "$ref": "./networkInterface.json#/definitions/IPConfiguration" }, "description": "An array of references to the network interface IP configurations using subnet." }, "ipConfigurationProfiles": { "readOnly": true, "type": "array", "items": { "$ref": "./networkProfile.json#/definitions/IPConfigurationProfile" }, "description": "Array of IP configuration profiles which reference this subnet." }, "ipAllocations": { "type": "array", "items": { "$ref": "./network.json#/definitions/SubResource" }, "description": "Array of IpAllocation which reference this subnet." }, "resourceNavigationLinks": { "readOnly": true, "type": "array", "items": { "$ref": "#/definitions/ResourceNavigationLink" }, "description": "An array of references to the external resources using subnet." }, "serviceAssociationLinks": { "readOnly": true, "type": "array", "items": { "$ref": "#/definitions/ServiceAssociationLink" }, "description": "An array of references to services injecting into this subnet." }, "delegations": { "type": "array", "items": { "$ref": "#/definitions/Delegation" }, "description": "An array of references to the delegations on the subnet." }, "purpose": { "type": "string", "readOnly": true, "description": "A read-only string identifying the intention of use for this subnet based on delegations and other user-defined properties." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the subnet resource." }, "privateEndpointNetworkPolicies": { "type": "string", "description": "Enable or Disable apply network policies on private end point in the subnet." }, "privateLinkServiceNetworkPolicies": { "type": "string", "description": "Enable or Disable apply network policies on private link service in the subnet." } }, "description": "Properties of the subnet." }, "ServiceEndpointPropertiesFormat": { "properties": { "service": { "type": "string", "description": "The type of the endpoint service." }, "locations": { "type": "array", "items": { "type": "string" }, "description": "A list of locations." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the service endpoint resource." } }, "description": "The service endpoint properties." }, "VirtualNetworkPeeringPropertiesFormat": { "properties": { "allowVirtualNetworkAccess": { "type": "boolean", "description": "Whether the VMs in the local virtual network space would be able to access the VMs in remote virtual network space." }, "allowForwardedTraffic": { "type": "boolean", "description": "Whether the forwarded traffic from the VMs in the local virtual network will be allowed/disallowed in remote virtual network." }, "allowGatewayTransit": { "type": "boolean", "description": "If gateway links can be used in remote virtual networking to link to this virtual network." }, "useRemoteGateways": { "type": "boolean", "description": "If remote gateways can be used on this virtual network. If the flag is set to true, and allowGatewayTransit on remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway." }, "remoteVirtualNetwork": { "$ref": "./network.json#/definitions/SubResource", "description": "The reference to the remote virtual network. The remote virtual network can be in the same or different region (preview). See here to register for the preview and learn more (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering)." }, "remoteAddressSpace": { "$ref": "#/definitions/AddressSpace", "description": "The reference to the remote virtual network address space." }, "peeringState": { "type": "string", "description": "The status of the virtual network peering.", "enum": [ "Initiated", "Connected", "Disconnected" ], "x-ms-enum": { "name": "VirtualNetworkPeeringState", "modelAsString": true } }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the virtual network peering resource." } }, "description": "Properties of the virtual network peering." }, "Subnet": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/SubnetPropertiesFormat", "description": "Properties of the subnet." }, "name": { "type": "string", "description": "The name of the resource that is unique within a resource group. This name can be used to access the resource." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Subnet in a virtual network resource." }, "VirtualNetworkPeering": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/VirtualNetworkPeeringPropertiesFormat", "description": "Properties of the virtual network peering." }, "name": { "type": "string", "description": "The name of the resource that is unique within a resource group. This name can be used to access the resource." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/SubResource" } ], "description": "Peerings in a virtual network resource." }, "SubnetListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/Subnet" }, "description": "The subnets in a virtual network." }, "nextLink": { "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for ListSubnets API service callRetrieves all subnet that belongs to a virtual network." }, "ResourceNavigationLinksListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/ResourceNavigationLink" }, "description": "The resource navigation links in a subnet." }, "nextLink": { "type": "string", "readOnly": true, "description": "The URL to get the next set of results." } }, "description": "Response for ResourceNavigationLinks_List operation." }, "ServiceAssociationLinksListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/ServiceAssociationLink" }, "description": "The service association links in a subnet." }, "nextLink": { "type": "string", "readOnly": true, "description": "The URL to get the next set of results." } }, "description": "Response for ServiceAssociationLinks_List operation." }, "VirtualNetworkPeeringListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/VirtualNetworkPeering" }, "description": "The peerings in a virtual network." }, "nextLink": { "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for ListSubnets API service call. Retrieves all subnets that belong to a virtual network." }, "VirtualNetworkPropertiesFormat": { "properties": { "addressSpace": { "$ref": "#/definitions/AddressSpace", "description": "The AddressSpace that contains an array of IP address ranges that can be used by subnets." }, "dhcpOptions": { "$ref": "#/definitions/DhcpOptions", "description": "The dhcpOptions that contains an array of DNS servers available to VMs deployed in the virtual network." }, "subnets": { "type": "array", "items": { "$ref": "#/definitions/Subnet" }, "description": "A list of subnets in a Virtual Network." }, "virtualNetworkPeerings": { "type": "array", "items": { "$ref": "#/definitions/VirtualNetworkPeering" }, "description": "A list of peerings in a Virtual Network." }, "resourceGuid": { "readOnly": true, "type": "string", "description": "The resourceGuid property of the Virtual Network resource." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the virtual network resource." }, "enableDdosProtection": { "type": "boolean", "default": false, "description": "Indicates if DDoS protection is enabled for all the protected resources in the virtual network. It requires a DDoS protection plan associated with the resource." }, "enableVmProtection": { "type": "boolean", "default": false, "description": "Indicates if VM protection is enabled for all the subnets in the virtual network." }, "ddosProtectionPlan": { "$ref": "./network.json#/definitions/SubResource", "default": null, "description": "The DDoS protection plan associated with the virtual network." }, "bgpCommunities": { "$ref": "#/definitions/VirtualNetworkBgpCommunities", "default": null, "description": "Bgp Communities sent over ExpressRoute with each route corresponding to a prefix in this VNET." }, "ipAllocations": { "type": "array", "items": { "$ref": "./network.json#/definitions/SubResource" }, "description": "Array of IpAllocation which reference this VNET." } }, "description": "Properties of the virtual network." }, "VirtualNetwork": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/VirtualNetworkPropertiesFormat", "description": "Properties of the virtual network." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/Resource" } ], "description": "Virtual Network resource." }, "VirtualNetworkListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/VirtualNetwork" }, "description": "A list of VirtualNetwork resources in a resource group." }, "nextLink": { "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for the ListVirtualNetworks API service call." }, "AddressSpace": { "properties": { "addressPrefixes": { "type": "array", "items": { "type": "string" }, "description": "A list of address blocks reserved for this virtual network in CIDR notation." } }, "description": "AddressSpace contains an array of IP address ranges that can be used by subnets of the virtual network." }, "DhcpOptions": { "properties": { "dnsServers": { "type": "array", "items": { "type": "string" }, "description": "The list of DNS servers IP addresses." } }, "description": "DhcpOptions contains an array of DNS servers available to VMs deployed in the virtual network. Standard DHCP option for a subnet overrides VNET DHCP options." }, "VirtualNetworkBgpCommunities": { "properties": { "virtualNetworkCommunity": { "type": "string", "description": "The BGP community associated with the virtual network." }, "regionalCommunity": { "type": "string", "readOnly": true, "description": "The BGP community associated with the region of the virtual network." } }, "required": [ "virtualNetworkCommunity" ], "description": "Bgp Communities sent over ExpressRoute with each route corresponding to a prefix in this VNET." }, "IPAddressAvailabilityResult": { "properties": { "available": { "type": "boolean", "description": "Private IP address availability." }, "availableIPAddresses": { "type": "array", "items": { "type": "string" }, "description": "Contains other available private IP addresses if the asked for address is taken." } }, "description": "Response for CheckIPAddressAvailability API service call." }, "VirtualNetworkListUsageResult": { "properties": { "value": { "type": "array", "readOnly": true, "items": { "$ref": "#/definitions/VirtualNetworkUsage" }, "description": "VirtualNetwork usage stats." }, "nextLink": { "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for the virtual networks GetUsage API service call." }, "VirtualNetworkUsage": { "properties": { "currentValue": { "type": "number", "format": "double", "readOnly": true, "description": "Indicates number of IPs used from the Subnet." }, "id": { "type": "string", "readOnly": true, "description": "Subnet identifier." }, "limit": { "type": "number", "format": "double", "readOnly": true, "description": "Indicates the size of the subnet." }, "name": { "$ref": "#/definitions/VirtualNetworkUsageName", "readOnly": true, "description": "The name containing common and localized value for usage." }, "unit": { "type": "string", "readOnly": true, "description": "Usage units. Returns 'Count'." } }, "description": "Usage details for subnet." }, "VirtualNetworkUsageName": { "properties": { "localizedValue": { "type": "string", "readOnly": true, "description": "Localized subnet size and usage string." }, "value": { "type": "string", "readOnly": true, "description": "Subnet size and usage string." } }, "description": "Usage strings container." }, "PrepareNetworkPoliciesRequest": { "properties": { "serviceName": { "type": "string", "description": "The name of the service for which subnet is being prepared for." }, "networkIntentPolicyConfigurations": { "type": "array", "items": { "$ref": "#/definitions/NetworkIntentPolicyConfiguration" }, "description": "A list of NetworkIntentPolicyConfiguration." } }, "description": "Details of PrepareNetworkPolicies for Subnet." }, "UnprepareNetworkPoliciesRequest": { "properties": { "serviceName": { "type": "string", "description": "The name of the service for which subnet is being unprepared for." } }, "description": "Details of UnprepareNetworkPolicies for Subnet." }, "NetworkIntentPolicyConfiguration": { "properties": { "networkIntentPolicyName": { "type": "string", "description": "The name of the Network Intent Policy for storing in target subscription." }, "sourceNetworkIntentPolicy": { "$ref": "#/definitions/NetworkIntentPolicy", "description": "Source network intent policy." } }, "description": "Details of NetworkIntentPolicyConfiguration for PrepareNetworkPoliciesRequest." }, "NetworkIntentPolicy": { "properties": { "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/Resource" } ], "description": "Network Intent Policy resource." } } } analysis-0.21.1/fixtures/azure/virtualNetworkTap.json000066400000000000000000000334271413705513100230260ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "NetworkManagementClient", "description": "The Microsoft Azure Network management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to manage your network resources. The API has entities that capture the relationship between an end user and the Microsoft Azure Networks service.", "version": "2020-04-01" }, "host": "management.azure.com", "schemes": [ "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "security": [ { "azure_auth": [ "user_impersonation" ] } ], "securityDefinitions": { "azure_auth": { "type": "oauth2", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "flow": "implicit", "description": "Azure Active Directory OAuth2 Flow.", "scopes": { "user_impersonation": "impersonate your user account" } } }, "paths": { "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}": { "delete": { "tags": [ "VirtualNetworkTap" ], "operationId": "VirtualNetworkTaps_Delete", "description": "Deletes the specified virtual network tap.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "tapName", "in": "path", "required": true, "type": "string", "description": "The name of the virtual network tap." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Delete successful." }, "202": { "description": "Accepted. Sets 'Deleting' provisioningState until the operation completes. Returns an operation URI that can be queried to find the current state of the operation." }, "204": { "description": "Request successful. Resource does not exist." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Delete Virtual Network Tap resource": { "$ref": "./examples/VirtualNetworkTapDelete.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } }, "get": { "tags": [ "VirtualNetworkTap" ], "operationId": "VirtualNetworkTaps_Get", "description": "Gets information about the specified virtual network tap.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "tapName", "in": "path", "required": true, "type": "string", "description": "The name of virtual network tap." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns the resulting VirtualNetworkTap resource.", "schema": { "$ref": "#/definitions/VirtualNetworkTap" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Get Virtual Network Tap": { "$ref": "./examples/VirtualNetworkTapGet.json" } } }, "put": { "tags": [ "VirtualNetworkTap" ], "operationId": "VirtualNetworkTaps_CreateOrUpdate", "description": "Creates or updates a Virtual Network Tap.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "tapName", "in": "path", "required": true, "type": "string", "description": "The name of the virtual network tap." }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/VirtualNetworkTap" }, "description": "Parameters supplied to the create or update virtual network tap operation." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting VirtualNetworkTap resource.", "schema": { "$ref": "#/definitions/VirtualNetworkTap" } }, "201": { "description": "Create successful. The operation returns the resulting VirtualNetworkTap resource.", "schema": { "$ref": "#/definitions/VirtualNetworkTap" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Create Virtual Network Tap": { "$ref": "./examples/VirtualNetworkTapCreate.json" } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" } }, "patch": { "tags": [ "VirtualNetworkTap" ], "operationId": "VirtualNetworkTaps_UpdateTags", "description": "Updates an VirtualNetworkTap tags.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "tapName", "in": "path", "required": true, "type": "string", "description": "The name of the tap." }, { "name": "tapParameters", "in": "body", "required": true, "schema": { "$ref": "./network.json#/definitions/TagsObject" }, "description": "Parameters supplied to update VirtualNetworkTap tags." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Update successful. The operation returns the resulting VirtualNetworkTap resource.", "schema": { "$ref": "#/definitions/VirtualNetworkTap" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "Update virtual network tap tags": { "$ref": "./examples/VirtualNetworkTapUpdateTags.json" } } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworkTaps": { "get": { "tags": [ "VirtualNetworkTaps" ], "operationId": "VirtualNetworkTaps_ListAll", "description": "Gets all the VirtualNetworkTaps in a subscription.", "parameters": [ { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of Virtual Network Tap resources.", "schema": { "$ref": "#/definitions/VirtualNetworkTapListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "List all virtual network taps": { "$ref": "./examples/VirtualNetworkTapListAll.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps": { "get": { "tags": [ "VirtualNetworkTaps" ], "operationId": "VirtualNetworkTaps_ListByResourceGroup", "description": "Gets all the VirtualNetworkTaps in a subscription.", "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "$ref": "./network.json#/parameters/ApiVersionParameter" }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Request successful. The operation returns a list of Virtual Network Tap resources.", "schema": { "$ref": "#/definitions/VirtualNetworkTapListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-examples": { "List virtual network taps in resource group": { "$ref": "./examples/VirtualNetworkTapList.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } } }, "definitions": { "VirtualNetworkTap": { "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/VirtualNetworkTapPropertiesFormat", "description": "Virtual Network Tap Properties." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/Resource" } ], "description": "Virtual Network Tap resource." }, "VirtualNetworkTapPropertiesFormat": { "description": "Virtual Network Tap properties.", "properties": { "networkInterfaceTapConfigurations": { "readOnly": true, "type": "array", "items": { "$ref": "./networkInterface.json#/definitions/NetworkInterfaceTapConfiguration", "description": "The reference to the Network Interface." }, "description": "Specifies the list of resource IDs for the network interface IP configuration that needs to be tapped." }, "resourceGuid": { "type": "string", "readOnly": true, "description": "The resource GUID property of the virtual network tap resource." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the virtual network tap resource." }, "destinationNetworkInterfaceIPConfiguration": { "$ref": "./networkInterface.json#/definitions/NetworkInterfaceIPConfiguration", "description": "The reference to the private IP Address of the collector nic that will receive the tap." }, "destinationLoadBalancerFrontEndIPConfiguration": { "$ref": "./loadBalancer.json#/definitions/FrontendIPConfiguration", "description": "The reference to the private IP address on the internal Load Balancer that will receive the tap." }, "destinationPort": { "type": "integer", "description": "The VXLAN destination port that will receive the tapped traffic." } } }, "VirtualNetworkTapListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/VirtualNetworkTap" }, "description": "A list of VirtualNetworkTaps in a resource group." }, "nextLink": { "type": "string", "description": "The URL to get the next set of results." } }, "description": "Response for ListVirtualNetworkTap API service call." } } } analysis-0.21.1/fixtures/bar-crud.yml000066400000000000000000000070501413705513100175130ustar00rootroot00000000000000--- swagger: '2.0' info: title: bar CRUD API version: 4.2.0 schemes: - http basePath: /api consumes: - application/json produces: - application/json paths: /common: get: operationId: commonGet summary: here to test path collisons responses: '200': description: OK schema: $ref: "#/definitions/bar" /bars: post: operationId: create summary: Create a new bar parameters: - name: info in: body schema: $ref: "#/definitions/bar" responses: '201': description: created schema: $ref: "#/definitions/barId" default: description: error schema: $ref: "#/definitions/error" /bars/{barid}: get: operationId: get summary: Get a bar by id parameters: - $ref: "#/parameters/barid" responses: '200': description: OK schema: $ref: "#/definitions/bar" '401': $ref: "#/responses/401" '404': $ref: "#/responses/404" default: description: error schema: $ref: "#/definitions/error" delete: operationId: delete summary: delete a bar by id parameters: - name: barid in: path required: true type: string responses: '200': description: OK '401': description: unauthorized schema: $ref: "#/definitions/error" '404': description: resource not found schema: $ref: "#/definitions/error" default: description: error schema: $ref: "#/definitions/error" post: operationId: update summary: update a bar by id parameters: - name: barid in: path required: true type: string - name: info in: body schema: $ref: "#/definitions/bar" responses: '200': description: OK '401': description: unauthorized schema: $ref: "#/definitions/error" '404': description: resource not found schema: $ref: "#/definitions/error" default: description: error schema: $ref: "#/definitions/error" definitions: common: type: object required: - id properties: id: type: string format: string minLength: 1 bar: type: object required: - name - description properties: id: type: string format: string readOnly: true name: type: string format: string minLength: 1 description: type: string format: string minLength: 1 barId: type: object required: - id properties: id: type: string format: string minLength: 1 error: type: object required: - message properties: code: type: string format: string message: type: string fields: type: string parameters: common: name: common in: query type: string barid: name: barid in: path required: true type: string responses: 401: description: bar unauthorized schema: $ref: "#/definitions/error" 404: description: bar resource not found schema: $ref: "#/definitions/error" analysis-0.21.1/fixtures/bugs/000077500000000000000000000000001413705513100162275ustar00rootroot00000000000000analysis-0.21.1/fixtures/bugs/1429/000077500000000000000000000000001413705513100166265ustar00rootroot00000000000000analysis-0.21.1/fixtures/bugs/1429/remote/000077500000000000000000000000001413705513100201215ustar00rootroot00000000000000analysis-0.21.1/fixtures/bugs/1429/remote/remote.yaml000066400000000000000000000002261413705513100223000ustar00rootroot00000000000000aRemotePlace: type: object properties: remoteProp: type: integer moreRemoteThanYouCanThink: $ref: './remote/remote.yaml#/farFarAway' analysis-0.21.1/fixtures/bugs/1429/remote/remote/000077500000000000000000000000001413705513100214145ustar00rootroot00000000000000analysis-0.21.1/fixtures/bugs/1429/remote/remote/remote.yaml000066400000000000000000000001211413705513100235650ustar00rootroot00000000000000farFarAway: type: object properties: farFarAwayProp: type: integer analysis-0.21.1/fixtures/bugs/1429/responses.yaml000066400000000000000000000041621413705513100215360ustar00rootroot00000000000000swagger: '2.0' info: title: Responses version: 0.1.0 definitions: Error: type: object description: | Contains all the properties any error response from the API will contain. Some properties are optional so might be empty most of the time required: - code - message properties: code: description: the error code, this is not necessarily the http status code type: integer format: int32 message: description: a human readable version of the error type: string helpUrl: description: an optional url for getting more help about this error type: string format: uri myArray: type: array items: $ref: '#/definitions/myItems' myItems: type: object properties: propItems1: type: integer propItems2: $ref: 'remote/remote.yaml#/aRemotePlace' otherPlace: Error: type: object properties: message: type: string parameters: BadRequest: name: badRequest in: body schema: $ref: '#/definitions/Error' GoodRequest: name: goodRequest in: body schema: $ref: '#/otherPlace/Error' PlainRequest: name: plainRequest in: body schema: type: integer StrangeRequest: name: stangeRequest in: body schema: $ref: 'responses.yaml#/otherPlace/Error' RemoteRequest: name: remoteRequest in: body schema: $ref: './remote/remote.yaml#/moreRemoteThanYouCanThink' responses: BadRequest: description: Bad request schema: $ref: '#/definitions/Error' GoodRequest: description: good request schema: $ref: '#/otherPlace/Error' PlainRequest: description: plain request schema: type: integer StrangeRequest: description: strange request schema: $ref: 'responses.yaml#/otherPlace/Error' RemoteRequest: description: remote request schema: $ref: './remote/remote.yaml#/moreRemoteThanYouCanThink' paths: /: get: summary: GET operationId: getAll responses: 200: description: Ok analysis-0.21.1/fixtures/bugs/1429/swagger.yaml000066400000000000000000000021151413705513100211500ustar00rootroot00000000000000swagger: '2.0' info: title: Object version: 0.1.0 paths: /: get: summary: GET operationId: getAll parameters: - $ref: 'responses.yaml#/parameters/BadRequest' - $ref: 'responses.yaml#/parameters/GoodRequest' - $ref: 'responses.yaml#/parameters/PlainRequest' - $ref: 'responses.yaml#/parameters/StrangeRequest' - $ref: 'responses.yaml#/parameters/RemoteRequest' - name: nestedBody in: body schema: $ref: '#/definitions/nestedRefDefinition' responses: 200: description: Ok 400: $ref: 'responses.yaml#/responses/BadRequest' 403: $ref: 'responses.yaml#/responses/GoodRequest' 404: $ref: 'responses.yaml#/responses/PlainRequest' 304: $ref: 'responses.yaml#/responses/StrangeRequest' 204: $ref: 'responses.yaml#/responses/RemoteRequest' definitions: badDefinition: $ref: 'responses.yaml#/definitions/Error' nestedRefDefinition: $ref: 'responses.yaml#/definitions/myArray' analysis-0.21.1/fixtures/bugs/1602/000077500000000000000000000000001413705513100166175ustar00rootroot00000000000000analysis-0.21.1/fixtures/bugs/1602/fixture-1602-1.yaml000066400000000000000000000036121413705513100217170ustar00rootroot00000000000000--- swagger: "2.0" schemes: - "http" - "https" basePath: "/v1.24" info: title: "derived from Pouch Engine API" version: "1.24" description: A variation on issue go-swagger/go-swagger#1609 paths: /_ping: get: parameters: - $ref: '#/parameters/bodyWithRef' responses: 200: description: "no error" schema: type: "string" example: "OK" 301: description: direct ref schema: $ref: "#/definitions/Error" 401: $ref: "#/responses/401ErrorResponse" 404: $ref: "#/responses/404ErrorResponse" 500: $ref: "#/responses/500ErrorResponse" definitions: Error: type: "object" properties: message: type: string parameters: bodyWithRef: name: bodyWithRefParam in: body schema: $ref: "#/definitions/Error" nobodyWithRef: name: bodyWithRefParam in: query type: integer #required: true anotherBodyWithRef: name: anotherBodyWithRefParam in: body schema: $ref: "#/definitions/Error" funnyParam: name: funnyParam in: body schema: $ref: "#/responses/500ErrorResponse/schema" responses: 401ErrorResponse: description: An unexpected 401 error occurred. schema: $ref: "#/definitions/Error" 404ErrorResponse: description: An unexpected 404 error occurred. schema: $ref: "#/definitions/Error" 500ErrorResponse: description: An unexpected server error occurred. schema: $ref: "#/definitions/Error" funnyResponse: description: An unexpected server error occurred. schema: $ref: "#/responses/401ErrorResponse/schema" foulResponse: description: An unexpected server error occurred. schema: $ref: "#/responses/noSchemaResponse" noSchemaResponse: description: An unexpected server error occurred. analysis-0.21.1/fixtures/bugs/1602/fixture-1602-2.yaml000066400000000000000000000037361413705513100217270ustar00rootroot00000000000000--- swagger: "2.0" schemes: - "http" - "https" basePath: "/v1.24" info: title: "derived from Pouch Engine API" version: "1.24" description: A variation on issue go-swagger/go-swagger#1609 paths: /_pong: get: parameters: - $ref: '#/parameters/anotherBodyWithRef' responses: 200: description: "no error" schema: type: "string" example: "OK" 401: $ref: "#/responses/401ErrorResponse" 404: description: direct ref schema: $ref: "#/definitions/Error" 500: $ref: "#/responses/500ErrorResponse" 501: description: faulty ref with wrong object type schema: $ref: "#/responses/500ErrorResponse" definitions: Error: type: "object" properties: message: type: string parameters: bodyWithRef: name: bodyWithRefParam in: body schema: $ref: "#/definitions/Error" nobodyWithRef: name: bodyWithRefParam in: query type: integer #required: true anotherBodyWithRef: name: anotherBodyWithRefParam in: body schema: $ref: "#/definitions/Error" funnyParam: name: funnyParam in: body schema: $ref: "#/responses/500ErrorResponse/schema" responses: 401ErrorResponse: description: An unexpected 401 error occurred. schema: $ref: "#/definitions/Error" 404ErrorResponse: description: An unexpected 404 error occurred. schema: $ref: "#/definitions/Error" 500ErrorResponse: description: An unexpected server error occurred. schema: $ref: "#/definitions/Error" funnyResponse: description: An unexpected server error occurred. schema: $ref: "#/responses/401ErrorResponse/schema" foulResponse: description: An unexpected server error occurred. schema: $ref: "#/responses/noSchemaResponse" noSchemaResponse: description: An unexpected server error occurred. analysis-0.21.1/fixtures/bugs/1602/fixture-1602-3.yaml000066400000000000000000000035271413705513100217260ustar00rootroot00000000000000--- swagger: "2.0" schemes: - "http" - "https" basePath: "/v1.24" info: title: "derived from Pouch Engine API" version: "1.24" description: A variation on issue go-swagger/go-swagger#1609 paths: /_pang: get: parameters: - $ref: '#/parameters/funnyParam' responses: 200: description: "no error" schema: type: "string" example: "OK" 401: $ref: "#/responses/401ErrorResponse" 404: $ref: "#/responses/404ErrorResponse" 500: $ref: "#/responses/500ErrorResponse" 501: $ref: "#/responses/funnyResponse" definitions: Error: type: "object" properties: message: type: string parameters: bodyWithRef: name: bodyWithRefParam in: body schema: $ref: "#/definitions/Error" nobodyWithRef: name: bodyWithRefParam in: query type: integer #required: true anotherBodyWithRef: name: anotherBodyWithRefParam in: body schema: $ref: "#/definitions/Error" funnyParam: name: funnyParam in: body schema: $ref: "#/responses/500ErrorResponse/schema" responses: 401ErrorResponse: description: An unexpected 401 error occurred. schema: $ref: "#/definitions/Error" 404ErrorResponse: description: An unexpected 404 error occurred. schema: $ref: "#/definitions/Error" 500ErrorResponse: description: An unexpected server error occurred. schema: $ref: "#/definitions/Error" funnyResponse: description: An unexpected server error occurred. schema: $ref: "#/responses/401ErrorResponse/schema" foulResponse: description: An unexpected server error occurred. schema: $ref: "#/responses/noSchemaResponse" noSchemaResponse: description: An unexpected server error occurred. analysis-0.21.1/fixtures/bugs/1602/fixture-1602-4.yaml000066400000000000000000000035551413705513100217300ustar00rootroot00000000000000--- swagger: "2.0" schemes: - "http" - "https" basePath: "/v1.24" info: title: "derived from Pouch Engine API" version: "1.24" description: A variation on issue go-swagger/go-swagger#1609 paths: /_peng: get: parameters: - name: foulBodyRef in: body schema: # <-- foul $ref $ref: '#/parameters/bodyWithRef' responses: 200: description: "no error" schema: type: "string" example: "OK" 401: $ref: "#/responses/401ErrorResponse" 404: $ref: "#/responses/404ErrorResponse" 500: $ref: "#/responses/500ErrorResponse" definitions: Error: type: "object" properties: message: type: string parameters: bodyWithRef: name: bodyWithRefParam in: body schema: $ref: "#/definitions/Error" nobodyWithRef: name: bodyWithRefParam in: query type: integer #required: true anotherBodyWithRef: name: anotherBodyWithRefParam in: body schema: $ref: "#/definitions/Error" funnyParam: name: funnyParam in: body schema: $ref: "#/responses/500ErrorResponse/schema" responses: 401ErrorResponse: description: An unexpected 401 error occurred. schema: $ref: "#/definitions/Error" 404ErrorResponse: description: An unexpected 404 error occurred. schema: $ref: "#/definitions/Error" 500ErrorResponse: description: An unexpected server error occurred. schema: $ref: "#/definitions/Error" funnyResponse: description: An unexpected server error occurred. schema: $ref: "#/responses/401ErrorResponse/schema" foulResponse: description: An unexpected server error occurred. schema: $ref: "#/responses/noSchemaResponse" noSchemaResponse: description: An unexpected server error occurred. analysis-0.21.1/fixtures/bugs/1602/fixture-1602-5.yaml000066400000000000000000000036521413705513100217270ustar00rootroot00000000000000--- swagger: "2.0" schemes: - "http" - "https" basePath: "/v1.24" info: title: "derived from Pouch Engine API" version: "1.24" description: A variation on issue go-swagger/go-swagger#1609 paths: /_pung: get: parameters: - name: foulerBodyRef in: body schema: # <-- foul $ref $ref: '#/parameters/nobodyWithRef' responses: 200: description: "no error" schema: type: "string" example: "OK" 401: $ref: "#/responses/401ErrorResponse" 404: $ref: "#/responses/404ErrorResponse" 500: $ref: "#/responses/500ErrorResponse" 501: $ref: "#/responses/foulResponse" definitions: Error: type: "object" properties: message: type: string parameters: bodyWithRef: name: bodyWithRefParam in: body schema: $ref: "#/definitions/Error" nobodyWithRef: name: bodyWithRefParam in: query type: integer #required: true anotherBodyWithRef: name: anotherBodyWithRefParam in: body schema: $ref: "#/definitions/Error" funnyParam: name: funnyParam in: body schema: $ref: "#/responses/500ErrorResponse/schema" responses: 401ErrorResponse: description: An unexpected 401 error occurred. schema: $ref: "#/definitions/Error" 404ErrorResponse: description: An unexpected 404 error occurred. schema: $ref: "#/definitions/Error" 500ErrorResponse: description: An unexpected server error occurred. schema: $ref: "#/definitions/Error" funnyResponse: description: An unexpected server error occurred. schema: $ref: "#/responses/401ErrorResponse/schema" foulResponse: description: An unexpected server error occurred. schema: $ref: "#/responses/noSchemaResponse" noSchemaResponse: description: An unexpected server error occurred. analysis-0.21.1/fixtures/bugs/1602/fixture-1602-6.yaml000066400000000000000000000014461413705513100217270ustar00rootroot00000000000000--- swagger: "2.0" schemes: - "http" - "https" basePath: "/v1.24" info: title: "derived from Pouch Engine API" version: "1.24" description: A variation on issue go-swagger/go-swagger#1609 paths: /_ping: get: responses: 401: description: an error schema: $ref: "#/responses/401ValidSchema" 404: description: another error schema: $ref: "#/parameters/bodyValidSchema" 500: $ref: "#/responses/401ValidSchema" definitions: Error: type: "object" properties: message: type: string parameters: bodyValidSchema: description: a valid schema (but invalid parameter) type: string responses: 401ValidSchema: description: An unexpected 401 error occurred. analysis-0.21.1/fixtures/bugs/1602/fixture-1602-full.yaml000066400000000000000000003423531413705513100225310ustar00rootroot00000000000000--- swagger: "2.0" schemes: - "http" - "https" produces: - "application/json" - "text/plain" consumes: - "application/json" - "text/plain" basePath: "/v1.24" info: title: "Pouch Engine API" version: "1.24" description: | API is an HTTP API served by Pouch Engine. produces: - "application/json" paths: /_ping: get: summary: "" description: "" responses: 200: description: "no error" schema: type: "string" example: "OK" 500: $ref: "#/responses/500ErrorResponse" /version: get: summary: "Get Pouchd version" description: "" responses: 200: schema: $ref: '#/definitions/SystemVersion' description: "no error" 500: $ref: "#/responses/500ErrorResponse" /info: get: summary: "Get System information" description: "" responses: 200: schema: $ref: '#/definitions/SystemInfo' description: "no error" 500: $ref: "#/responses/500ErrorResponse" /auth: post: summary: "Check auth configuration" description: "Validate credentials for a registry and, if available, get an identity token for accessing the registry without password." consumes: - "application/json" produces: - "application/json" responses: 200: description: "An identity token was generated successfully." schema: $ref: "#/definitions/AuthResponse" 401: description: "Login unauthorized" schema: $ref: "#/responses/401ErrorResponse" 500: description: "Server error" schema: $ref: "#/responses/500ErrorResponse" parameters: - name: "authConfig" in: "body" description: "Authentication to check" schema: $ref: "#/definitions/AuthConfig" /daemon/update: post: summary: "Update daemon's labels and image proxy" consumes: - "application/json" produces: - "application/json" responses: 200: description: "no error" 400: description: "bad parameter" schema: $ref: '#/definitions/Error' 500: $ref: "#/responses/500ErrorResponse" parameters: - name: "DaemonUpdateConfig" in: body description: "Config used to update daemon, only labels and image proxy are allowed." schema: $ref: "#/definitions/DaemonUpdateConfig" /images/create: post: summary: "Create an image by pulling from a registry or importing from an existing source file" consumes: - "text/plain" - "application/octet-stream" produces: - "application/json" responses: 200: description: "no error" 404: schema: $ref: '#/definitions/Error' description: "image not found" 500: $ref: "#/responses/500ErrorResponse" parameters: - name: "fromImage" in: "query" description: "Name of the image to pull. The name may include a tag or digest. This parameter may only be used when pulling an image. The pull is cancelled if the HTTP connection is closed." type: "string" - name: "fromSrc" in: "query" description: "Source to import. The value may be a URL from which the image can be retrieved or `-` to read the image from the request body. This parameter may only be used when importing an image." type: "string" - name: "repo" in: "query" description: "Repository name given to an image when it is imported. The repo may include a tag. This parameter may only be used when importing an image." type: "string" - name: "tag" in: "query" description: "Tag or digest. If empty when pulling an image, this causes all tags for the given image to be pulled." type: "string" - name: "inputImage" in: "body" description: "Image content if the value `-` has been specified in fromSrc query parameter" schema: type: "string" required: false - name: "X-Registry-Auth" in: "header" description: "A base64-encoded auth configuration. [See the authentication section for details.](#section/Authentication)" type: "string" /images/load: post: summary: "Import images" description: | Load a set of images by oci.v1 format tar stream consumes: - application/x-tar responses: 200: description: "no error" 500: description: "server error" schema: $ref: "#/responses/500ErrorResponse" parameters: - name: "imageTarStream" in: "body" description: "tar stream containing images" schema: type: "string" format: "binary" - name: "name" in: "query" description: "set the image name for the tar stream, default unknown/unknown" type: "string" /images/{imageid}/json: get: summary: "Inspect a image" description: "Return the information about image" operationId: "ImageInspect" produces: - "application/json" responses: 200: description: "no error" schema: $ref: "#/definitions/ImageInfo" examples: application/json: CreatedAt: "2017-12-19 15:32:09" Digest: "sha256:e216a057b1cb1efc11f8a268f37ef62083e70b1b38323ba252e25ac88904a7e8" ID: "e216a057b1cb" Name: "ubuntu:12.04" Size: 103579269 Tag: "12.04" 404: description: "no such image" schema: $ref: "#/definitions/Error" examples: application/json: message: "No such image: e216a057b1cb" 500: $ref: "#/responses/500ErrorResponse" parameters: - $ref: "#/parameters/imageid" /images/json: get: summary: "List Images" description: "Return a list of stored images." operationId: "ImageList" produces: - "application/json" responses: 200: description: "Summary image data for the images matching the query" schema: type: "array" items: $ref: "#/definitions/ImageInfo" examples: application/json: - Id: "sha256:e216a057b1cb1efc11f8a268f37ef62083e70b1b38323ba252e25ac88904a7e8" ParentId: "" RepoTags: - "ubuntu:12.04" - "ubuntu:precise" RepoDigests: - "ubuntu@sha256:992069aee4016783df6345315302fa59681aae51a8eeb2f889dea59290f21787" Created: 1474925151 Size: 103579269 VirtualSize: 103579269 SharedSize: 0 Labels: {} Containers: 2 - Id: "sha256:3e314f95dcace0f5e4fd37b10862fe8398e3c60ed36600bc0ca5fda78b087175" ParentId: "" RepoTags: - "ubuntu:12.10" - "ubuntu:quantal" RepoDigests: - "ubuntu@sha256:002fba3e3255af10be97ea26e476692a7ebed0bb074a9ab960b2e7a1526b15d7" - "ubuntu@sha256:68ea0200f0b90df725d99d823905b04cf844f6039ef60c60bf3e019915017bd3" Created: 1403128455 Size: 172064416 VirtualSize: 172064416 SharedSize: 0 Labels: {} Containers: 5 500: $ref: "#/responses/500ErrorResponse" parameters: - name: "all" in: "query" description: "Show all images. Only images from a final layer (no children) are shown by default." type: "boolean" - name: "filters" in: "query" description: | A JSON encoded value of the filters (a `map[string][]string`) to process on the images list. Available filters: - `before`=(`[:]`, `` or ``) - `dangling=true` - `label=key` or `label="key=value"` of an image label - `reference`=(`[:]`) - `since`=(`[:]`, `` or ``) type: "string" - name: "digests" in: "query" description: "Show digest information as a `RepoDigests` field on each image." type: "boolean" /images/search: get: summary: "Search images" produces: - "application/json" responses: 200: description: "No error" schema: type: "array" items: $ref: "#/definitions/SearchResultItem" 500: $ref: "#/responses/500ErrorResponse" /images/{imageid}/tag: post: summary: "Tag an image" description: "Add tag reference to the existing image" parameters: - $ref: "#/parameters/imageid" - name: "repo" in: "query" description: "The repository to tag in. For example, `someuser/someimage`." type: "string" - name: "tag" in: "query" description: "The name of the new tag." type: "string" responses: 201: description: "No error" 400: description: "Bad parameter" schema: $ref: "#/definitions/Error" 404: description: "no such image" schema: $ref: "#/definitions/Error" 500: $ref: "#/responses/500ErrorResponse" /images/{imageid}: delete: summary: "Remove an image" description: "Remove an image by reference." parameters: - $ref: "#/parameters/imageid" - name: "force" in: "query" description: "Remove the image even if it is being used" type: "boolean" default: false responses: 204: description: "No error" 404: description: "no such image" schema: $ref: "#/definitions/Error" examples: application/json: message: "No such image: c2ada9df5af8" 500: $ref: "#/responses/500ErrorResponse" /containers/create: post: summary: "Create a container" consumes: - "application/json" produces: - "application/json" parameters: - name: "name" in: "query" description: "Assign the specified name to the container. Must match `/?[a-zA-Z0-9_-]+`." type: "string" pattern: "/?[a-zA-Z0-9_-]+" - name: "body" in: "body" description: "Container to create" schema: $ref: "#/definitions/ContainerCreateConfig" required: true responses: 201: description: "Container created successfully" schema: $ref: "#/definitions/ContainerCreateResp" examples: application/json: Id: "e90e34656806" Warnings: [] 400: description: "bad parameter" schema: $ref: "#/definitions/Error" 404: description: "no such image" schema: $ref: "#/definitions/Error" examples: application/json: message: "image: xxx:latest: not found" 409: description: "conflict" schema: $ref: "#/definitions/Error" 500: $ref: "#/responses/500ErrorResponse" tags: ["Container"] /containers/{id}/json: get: summary: "Inspect a container" description: "Return low-level information about a container." operationId: "ContainerInspect" produces: - "application/json" responses: 200: description: "no error" schema: $ref: "#/definitions/ContainerJSON" 404: $ref: "#/responses/404ErrorResponse" 500: $ref: "#/responses/500ErrorResponse" parameters: - $ref: "#/parameters/id" - name: "size" in: "query" type: "boolean" description: "Return the size of container as fields `SizeRw` and `SizeRootFs`" tags: ["Container"] /containers/json: get: summary: "List containers" operationId: "ContainerList" produces: ["application/json"] responses: 200: description: "Summary containers that matches the query" schema: type: "array" items: $ref: "#/definitions/Container" 500: $ref: "#/responses/500ErrorResponse" parameters: - name: "all" in: "query" description: "Return all containers. By default, only running containers are shown" type: "boolean" default: false /containers/{id}/rename: post: summary: "Rename a container" operationId: "ContainerRename" parameters: - $ref: "#/parameters/id" - name: "name" in: "query" required: true description: "New name for the container" type: "string" responses: 204: description: "no error" 404: $ref: "#/responses/404ErrorResponse" 409: description: "name already in use" schema: $ref: "#/definitions/Error" 500: $ref: "#/responses/500ErrorResponse" tags: ["Container"] /containers/{id}/restart: post: summary: "Restart a container" operationId: "ContainerRestart" parameters: - $ref: "#/parameters/id" - name: "name" in: "query" required: true description: "New name for the container" type: "string" - name: "t" in: "query" description: "Number of seconds to wait before killing the container" type: "integer" responses: 204: description: "no error" 404: $ref: "#/responses/404ErrorResponse" 500: $ref: "#/responses/500ErrorResponse" tags: ["Container"] /containers/{id}/start: post: summary: "Start a container" operationId: "ContainerStart" parameters: - $ref: "#/parameters/id" - name: "detachKeys" in: "query" description: "Override the key sequence for detaching a container. Format is a single character `[a-Z]` or `ctrl-` where `` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`." type: "string" responses: 204: description: "no error" 404: $ref: "#/responses/404ErrorResponse" 500: $ref: "#/responses/500ErrorResponse" tags: ["Container"] /containers/{id}/stop: post: summary: "Stop a container" operationId: "ContainerStop" parameters: - $ref: "#/parameters/id" - name: "t" in: "query" description: "Number of seconds to wait before killing the container" type: "integer" responses: 204: description: "no error" 404: $ref: "#/responses/404ErrorResponse" 500: $ref: "#/responses/500ErrorResponse" tags: ["Container"] /containers/{id}/pause: post: summary: "Pause a container" operationId: "ContainerPause" parameters: - $ref: "#/parameters/id" responses: 204: description: "no error" 404: $ref: "#/responses/404ErrorResponse" 500: $ref: "#/responses/500ErrorResponse" tags: ["Container"] /containers/{id}/unpause: post: summary: "Unpause a container" operationId: "ContainerUnpause" parameters: - $ref: "#/parameters/id" responses: 204: description: "no error" 404: $ref: "#/responses/404ErrorResponse" 500: $ref: "#/responses/500ErrorResponse" tags: ["Container"] /containers/{id}/top: post: summary: "Display the running processes of a container" operationId: "ContainerTop" parameters: - $ref: "#/parameters/id" - name: "ps_args" in: "query" description: "top arguments" type: "string" responses: 200: description: "no error" schema: $ref: "#/definitions/ContainerProcessList" 404: $ref: "#/responses/404ErrorResponse" 500: $ref: "#/responses/500ErrorResponse" tags: ["Container"] /containers/{id}/wait: post: summary: "Block until a container stops, then returns the exit code." operationId: "ContainerWait" parameters: - $ref: "#/parameters/id" responses: 200: description: "The container has exited." schema: type: "object" required: [StatusCode] properties: StatusCode: description: "Exit code of the container" type: "integer" x-nullable: false Error: description: "The error message of waiting container" type: "string" 404: $ref: "#/responses/404ErrorResponse" 500: $ref: "#/responses/500ErrorResponse" tags: ["Container"] /containers/{id}: delete: summary: "Remove one container" operationId: "ContainerRemove" parameters: - $ref: "#/parameters/id" - name: "force" in: "query" description: "If the container is running, force query is used to kill it and remove it forcefully." type: "boolean" responses: 204: description: "no error" 404: $ref: "#/responses/404ErrorResponse" 500: $ref: "#/responses/500ErrorResponse" tags: ["Container"] /containers/{id}/exec: post: summary: "Create an exec instance" description: "Run a command inside a running container." operationId: "ContainerExec" consumes: - "application/json" produces: - "application/json" responses: 201: description: "no error" schema: $ref: "#/definitions/ExecCreateResp" 404: $ref: "#/responses/404ErrorResponse" 409: description: "container is paused" schema: $ref: "#/definitions/Error" 500: $ref: "#/responses/500ErrorResponse" parameters: - $ref: "#/parameters/id" - name: "body" in: "body" schema: $ref: "#/definitions/ExecCreateConfig" required: true tags: ["Exec"] /containers/{id}/logs: get: summary: "Get container logs" description: | Get `stdout` and `stderr` logs from a container. Note: This endpoint works only for containers with the `json-file` or `journald` logging driver. operationId: "ContainerLogs" responses: 101: description: "logs returned as a stream" schema: type: "string" format: "binary" 200: description: "logs returned as a string in response body" schema: type: "string" 400: description: "bad parameter" schema: $ref: "#/definitions/Error" 404: $ref: "#/responses/404ErrorResponse" 500: $ref: "#/responses/500ErrorResponse" parameters: - name: "id" in: "path" required: true description: "ID or name of the container" type: "string" - name: "follow" in: "query" description: | Return the logs as a stream. type: "boolean" default: false - name: "stdout" in: "query" description: "Return logs from `stdout`" type: "boolean" default: false - name: "stderr" in: "query" description: "Return logs from `stderr`" type: "boolean" default: false - name: "since" in: "query" description: "Only return logs since this time, as a UNIX timestamp" type: "integer" default: 0 - name: "until" in: "query" description: "Only return logs before this time, as a UNIX timestamp" type: "integer" default: 0 - name: "timestamps" in: "query" description: "Add timestamps to every log line" type: "boolean" default: false - name: "tail" in: "query" description: "Only return this number of log lines from the end of the logs. Specify as an integer or `all` to output all log lines." type: "string" default: "all" tags: ["Container"] /containers/{id}/resize: post: summary: "changes the size of the tty for a container" operationId: "ContainerResize" parameters: - $ref: "#/parameters/id" - name: "height" in: "query" description: "height of the tty" type: "string" - name: "width" in: "query" description: "width of the tty" type: "string" responses: 200: description: "no error" 400: description: "bad parameter" schema: $ref: "#/definitions/Error" tags: ["Container"] /exec/{id}/start: post: summary: "Start an exec instance" description: "Starts a previously set up exec instance. If detach is true, this endpoint returns immediately after starting the command. Otherwise, it sets up an interactive session with the command." operationId: "ExecStart" consumes: - "application/json" produces: - "application/vnd.raw-stream" responses: 200: description: "No error" 404: description: "No such exec instance" schema: $ref: "#/definitions/Error" 409: description: "Container is stopped or paused" schema: $ref: "#/definitions/Error" parameters: - name: "execStartConfig" in: "body" schema: $ref: "#/definitions/ExecStartConfig" - name: "id" in: "path" description: "Exec instance ID" required: true type: "string" tags: ["Exec"] /exec/{id}/json: get: summary: "Inspect an exec instance" description: "Return low-level information about an exec instance." operationId: "ExecInspect" produces: - "application/json" responses: 200: description: "No error" schema: $ref: "#/definitions/ContainerExecInspect" 404: description: "No such exec instance" schema: $ref: "#/responses/404ErrorResponse" 500: description: "Server error" schema: $ref: "#/responses/500ErrorResponse" parameters: - name: "id" in: "path" description: "Exec instance ID" required: true type: "string" tags: ["Exec"] /containers/{id}/attach: post: summary: "Attach to a container" description: | Attach to a container to read its output or send it input. You can attach to the same container multiple times and you can reattach to containers that have been detached. Either the `stream` or `logs` parameter must be `true` for this endpoint to do anything. ### Hijacking This endpoint hijacks the HTTP connection to transport `stdin`, `stdout`, and `stderr` on the same socket. This is the response from the daemon for an attach request: ``` HTTP/1.1 200 OK Content-Type: application/vnd.raw-stream [STREAM] ``` After the headers and two new lines, the TCP connection can now be used for raw, bidirectional communication between the client and server. To hint potential proxies about connection hijacking, the Pouch client can also optionally send connection upgrade headers. For example, the client sends this request to upgrade the connection: ``` POST /containers/16253994b7c4/attach?stream=1&stdout=1 HTTP/1.1 Upgrade: tcp Connection: Upgrade ``` The Pouch daemon will respond with a `101 UPGRADED` response, and will similarly follow with the raw stream: ``` HTTP/1.1 101 UPGRADED Content-Type: application/vnd.raw-stream Connection: Upgrade Upgrade: tcp [STREAM] ``` ### Stream format When the TTY setting is disabled in [`POST /containers/create`](#operation/ContainerCreate), the stream over the hijacked connected is multiplexed to separate out `stdout` and `stderr`. The stream consists of a series of frames, each containing a header and a payload. The header contains the information which the stream writes (`stdout` or `stderr`). It also contains the size of the associated frame encoded in the last four bytes (`uint32`). It is encoded on the first eight bytes like this: ```go header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4} ``` `STREAM_TYPE` can be: - 0: `stdin` (is written on `stdout`) - 1: `stdout` - 2: `stderr` `SIZE1, SIZE2, SIZE3, SIZE4` are the four bytes of the `uint32` size encoded as big endian. Following the header is the payload, which is the specified number of bytes of `STREAM_TYPE`. The simplest way to implement this protocol is the following: 1. Read 8 bytes. 2. Choose `stdout` or `stderr` depending on the first byte. 3. Extract the frame size from the last four bytes. 4. Read the extracted size and output it on the correct output. 5. Goto 1. ### Stream format when using a TTY When the TTY setting is enabled in [`POST /containers/create`](#operation/ContainerCreate), the stream is not multiplexed. The data exchanged over the hijacked connection is simply the raw data from the process PTY and client's `stdin`. operationId: "ContainerAttach" produces: - "application/vnd.raw-stream" responses: 101: description: "no error, hints proxy about hijacking" 200: description: "no error, no upgrade header found" 400: description: "bad parameter" schema: $ref: "#/definitions/Error" 404: description: "no such container" schema: $ref: "#/definitions/Error" examples: application/json: message: "No such container: c2ada9df5af8" 500: description: "server error" schema: $ref: "#/definitions/Error" parameters: - name: "id" in: "path" required: true description: "ID or name of the container" type: "string" - name: "detachKeys" in: "query" description: "Override the key sequence for detaching a container.Format is a single character `[a-Z]` or `ctrl-` where `` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`." type: "string" - name: "logs" in: "query" description: | Replay previous logs from the container. This is useful for attaching to a container that has started and you want to output everything since the container started. If `stream` is also enabled, once all the previous output has been returned, it will seamlessly transition into streaming current output. type: "boolean" default: false - name: "stream" in: "query" description: "Stream attached streams from the time the request was made onwards" type: "boolean" default: false - name: "stdin" in: "query" description: "Attach to `stdin`" type: "boolean" default: false - name: "stdout" in: "query" description: "Attach to `stdout`" type: "boolean" default: false - name: "stderr" in: "query" description: "Attach to `stderr`" type: "boolean" default: false tags: ["Container"] /containers/{id}/update: post: summary: "Update the configurations of a container" operationId: "ContainerUpdate" parameters: - $ref: "#/parameters/id" - name: "updateConfig" in: "body" schema: $ref: "#/definitions/UpdateConfig" responses: 200: description: "no error" 400: description: "bad parameter" schema: $ref: "#/definitions/Error" 404: $ref: "#/responses/404ErrorResponse" 500: $ref: "#/responses/500ErrorResponse" tags: ["Container"] /containers/{id}/upgrade: post: summary: "Upgrade a container with new image and args" operationId: "ContainerUpgrade" parameters: - $ref: "#/parameters/id" - name: "upgradeConfig" in: "body" schema: $ref: "#/definitions/ContainerUpgradeConfig" responses: 200: description: "no error" 400: description: "bad parameter" schema: $ref: "#/definitions/Error" 404: $ref: "#/responses/404ErrorResponse" 500: $ref: "#/responses/500ErrorResponse" tags: ["Container"] /volumes: get: summary: "List volumes" operationId: "VolumeList" produces: ["application/json"] responses: 200: description: "Summary volume data that matches the query" schema: $ref: "#/definitions/VolumeListResp" examples: application/json: Volumes: - CreatedAt: "2017-07-19T12:00:26Z" Name: "tardis" Driver: "local" Mountpoint: "/var/lib/pouch/volumes/tardis" Labels: com.example.some-label: "some-value" com.example.some-other-label: "some-other-value" Scope: "local" Options: device: "tmpfs" o: "opt.size=100m,uid=1000" type: "tmpfs" Warnings: [] 500: $ref: "#/responses/500ErrorResponse" parameters: - name: "filters" in: "query" description: | JSON encoded value of the filters (a `map[string][]string`) to process on the volumes list. Available filters: - `dangling=` When set to `true` (or `1`), returns all volumes that are not in use by a container. When set to `false` (or `0`), only volumes that are in use by one or more containers are returned. - `driver=` Matches volumes based on their driver. - `label=` or `label=:` Matches volumes based on the presence of a `label` alone or a `label` and a value. - `name=` Matches all or part of a volume name. type: "string" format: "json" tags: ["Volume"] /volumes/create: post: summary: "Create a volume" operationId: "VolumeCreate" consumes: ["application/json"] produces: ["application/json"] responses: 201: description: "The volume was created successfully" schema: $ref: "#/definitions/VolumeInfo" 500: $ref: "#/responses/500ErrorResponse" parameters: - name: "body" in: "body" required: true description: "Volume configuration" schema: $ref: "#/definitions/VolumeCreateConfig" tags: ["Volume"] /volumes/{id}: get: summary: "Inspect a volume" operationId: "VolumeInspect" produces: ["application/json"] responses: 200: description: "No error" schema: $ref: "#/definitions/VolumeInfo" 404: $ref: "#/responses/404ErrorResponse" 500: $ref: "#/responses/500ErrorResponse" parameters: - $ref: "#/parameters/id" tags: ["Volume"] delete: summary: "Delete a volume" operationId: "VolumeDelete" responses: 204: description: "No error" 404: $ref: "#/responses/404ErrorResponse" 500: $ref: "#/responses/500ErrorResponse" parameters: - $ref: "#/parameters/id" tags: ["Volume"] /networks/create: post: summary: "Create a network" operationId: "NetworkCreate" consumes: ["application/json"] produces: ["application/json"] responses: 201: description: "The network was created successfully" schema: $ref: "#/definitions/NetworkCreateResp" 400: description: "bad parameter" schema: $ref: "#/definitions/Error" 409: description: "name already in use" schema: $ref: "#/definitions/Error" 500: $ref: "#/responses/500ErrorResponse" parameters: - name: "NetworkCreateConfig" in: "body" required: true description: "Network configuration" schema: $ref: "#/definitions/NetworkCreateConfig" tags: ["Network"] /networks/{id}: get: summary: "Inspect a network" operationId: "NetworkInspect" produces: - "application/json" responses: 200: description: "No error" schema: $ref: "#/definitions/NetworkInspectResp" 404: $ref: "#/responses/404ErrorResponse" 500: $ref: "#/responses/500ErrorResponse" parameters: - $ref: "#/parameters/id" tags: ["Network"] delete: summary: "Remove a network" operationId: "NetworkDelete" responses: 204: description: "No error" 403: description: "operation not supported for pre-defined networks" schema: $ref: "#/definitions/Error" 404: $ref: "#/responses/404ErrorResponse" 500: $ref: "#/responses/500ErrorResponse" parameters: - $ref: "#/parameters/id" tags: ["Network"] /networks: get: summary: "List networks" operationId: "NetworkList" produces: ["application/json"] responses: 200: description: "Summary networks that matches the query" schema: $ref: "#/definitions/NetworkResource" 500: $ref: "#/responses/500ErrorResponse" tags: ["Network"] /networks/{id}/connect: post: summary: "Connect a container to a network" operationId: "NetworkConnect" consumes: - "application/json" responses: 200: description: "No error" 400: description: "bad parameter" schema: $ref: "#/definitions/Error" 404: description: "Network or container not found" schema: $ref: "#/responses/404ErrorResponse" 500: description: "Server error" schema: $ref: "#/responses/500ErrorResponse" parameters: - name: "id" in: "path" description: "Network ID or name" required: true type: "string" - name: "container" in: "body" required: true schema: $ref: "#/definitions/NetworkConnect" tags: ["Network"] /networks/{id}/disconnect: post: summary: "Disconnect a container from a network" operationId: "NetworkDisconnect" consumes: - "application/json" responses: 200: description: "No error" 400: description: "bad parameter" schema: $ref: "#/definitions/Error" 404: description: "Network or container not found" schema: $ref: "#/responses/404ErrorResponse" 500: description: "Server error" schema: $ref: "#/responses/500ErrorResponse" parameters: - name: "id" in: "path" description: "Network ID or name" required: true type: "string" - name: "NetworkDisconnect" in: "body" required: true description: "Network disconnect parameters" schema: $ref: "#/definitions/NetworkDisconnect" tags: ["Network"] definitions: Error: type: "object" properties: message: type: string SystemVersion: type: "object" properties: Version: type: "string" description: "version of Pouch Daemon" example: "0.1.2" ApiVersion: type: "string" description: "Api Version held by daemon" example: "" GitCommit: type: "string" description: "Commit ID held by the latest commit operation" example: "" GoVersion: type: "string" description: "version of Go runtime" example: "1.8.3" Os: type: "string" description: "Operating system type of underlying system" example: "linux" Arch: type: "string" description: "Arch type of underlying hardware" example: "amd64" KernelVersion: type: "string" description: "Operating system kernel version" example: "3.13.0-106-generic" BuildTime: type: "string" description: "The time when this binary of daemon is built" example: "2017-08-29T17:41:57.729792388+00:00" SystemInfo: type: "object" properties: ID: description: | Unique identifier of the daemon.


> **Note**: The format of the ID itself is not part of the API, and > should not be considered stable. type: "string" example: "7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS" Containers: description: "Total number of containers on the host." type: "integer" example: 14 ContainersRunning: description: | Number of containers with status `"running"`. type: "integer" example: 3 ContainersPaused: description: | Number of containers with status `"paused"`. type: "integer" example: 1 ContainersStopped: description: | Number of containers with status `"stopped"`. type: "integer" example: 10 Images: description: | Total number of images on the host. Both _tagged_ and _untagged_ (dangling) images are counted. type: "integer" example: 508 Driver: description: "Name of the storage driver in use." type: "string" example: "overlay2" DriverStatus: description: | Information specific to the storage driver, provided as "label" / "value" pairs. This information is provided by the storage driver, and formatted in a way consistent with the output of `pouch info` on the command line.


> **Note**: The information returned in this field, including the > formatting of values and labels, should not be considered stable, > and may change without notice. type: "array" items: type: "array" items: type: "string" example: - ["Backing Filesystem", "extfs"] - ["Supports d_type", "true"] - ["Native Overlay Diff", "true"] PouchRootDir: description: | Root directory of persistent Pouch state. Defaults to `/var/lib/pouch` on Linux. type: "string" example: "/var/lib/pouch" Debug: description: "Indicates if the daemon is running in debug-mode / with debug-level logging enabled." type: "boolean" example: true LoggingDriver: description: | The logging driver to use as a default for new containers. type: "string" VolumeDrivers: description: | The list of volume drivers which the pouchd supports type: "array" items: type: "string" example: ["local", "tmpfs"] CgroupDriver: description: | The driver to use for managing cgroups. type: "string" x-nullable: false enum: ["cgroupfs", "systemd"] default: "cgroupfs" example: "cgroupfs" KernelVersion: description: | Kernel version of the host. On Linux, this information obtained from `uname`. type: "string" OperatingSystem: description: | Name of the host's operating system, for example: "Ubuntu 16.04.2 LTS". type: "string" example: "Alpine Linux v3.5" OSType: description: | Generic type of the operating system of the host, as returned by the Go runtime (`GOOS`). Currently returned value is "linux". A full list of possible values can be found in the [Go documentation](https://golang.org/doc/install/source#environment). type: "string" example: "linux" Architecture: description: | Hardware architecture of the host, as returned by the Go runtime (`GOARCH`). A full list of possible values can be found in the [Go documentation](https://golang.org/doc/install/source#environment). type: "string" example: "x86_64" NCPU: description: | The number of logical CPUs usable by the daemon. The number of available CPUs is checked by querying the operating system when the daemon starts. Changes to operating system CPU allocation after the daemon is started are not reflected. type: "integer" example: 4 MemTotal: description: | Total amount of physical memory available on the host, in kilobytes (kB). type: "integer" format: "int64" example: 2095882240 IndexServerAddress: description: | Address / URL of the index server that is used for image search, and as a default for user authentication. type: "string" DefaultRegistry: description: | default registry can be defined by user. type: "string" RegistryConfig: $ref: "#/definitions/RegistryServiceConfig" HttpProxy: description: | HTTP-proxy configured for the daemon. This value is obtained from the [`HTTP_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) environment variable. Containers do not automatically inherit this configuration. type: "string" example: "http://user:pass@proxy.corp.example.com:8080" HttpsProxy: description: | HTTPS-proxy configured for the daemon. This value is obtained from the [`HTTPS_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) environment variable. Containers do not automatically inherit this configuration. type: "string" example: "https://user:pass@proxy.corp.example.com:4443" Name: description: "Hostname of the host." type: "string" example: "node5.corp.example.com" Labels: description: | User-defined labels (key/value metadata) as set on the daemon. type: "array" items: type: "string" example: ["storage=ssd", "production"] ExperimentalBuild: description: | Indicates if experimental features are enabled on the daemon. type: "boolean" example: true ServerVersion: description: | Version string of the daemon. type: "string" example: "17.06.0-ce" Runtimes: description: | List of [OCI compliant](https://github.com/opencontainers/runtime-spec) runtimes configured on the daemon. Keys hold the "name" used to reference the runtime. The Pouch daemon relies on an OCI compliant runtime (invoked via the `containerd` daemon) as its interface to the Linux kernel namespaces, cgroups, and SELinux. The default runtime is `runc`, and automatically configured. Additional runtimes can be configured by the user and will be listed here. type: "object" additionalProperties: $ref: "#/definitions/Runtime" default: runc: path: "pouch-runc" example: runc: path: "pouch-runc" runc-master: path: "/go/bin/runc" custom: path: "/usr/local/bin/my-oci-runtime" runtimeArgs: ["--debug", "--systemd-cgroup=false"] DefaultRuntime: description: | Name of the default OCI runtime that is used when starting containers. The default can be overridden per-container at create time. type: "string" x-nullable: false default: "runc" example: "runc" LiveRestoreEnabled: description: | Indicates if live restore is enabled. If enabled, containers are kept running when the daemon is shutdown or upon daemon start if running containers are detected. type: "boolean" x-nullable: false default: false example: false LxcfsEnabled: description: | Indicates if lxcfs is enabled. type: "boolean" x-nullable: false default: false example: false ContainerdCommit: $ref: "#/definitions/Commit" RuncCommit: $ref: "#/definitions/Commit" SecurityOptions: description: | List of security features that are enabled on the daemon, such as apparmor, seccomp, SELinux, and user-namespaces (userns). Additional configuration options for each security feature may be present, and are included as a comma-separated list of key/value pairs. type: "array" items: type: "string" example: - "name=apparmor" - "name=seccomp,profile=default" - "name=selinux" - "name=userns" ListenAddresses: description: "List of addresses the pouchd listens on" type: "array" items: type: "string" example: - ["unix:///var/run/pouchd.sock", "tcp://0.0.0.0:4243"] DaemonUpdateConfig: type: "object" properties: Labels: description: "Labels indentified the attributes of daemon" type: "array" items: type: "string" example: ["storage=ssd", "zone=hangzhou"] ImageProxy: description: "Image proxy used to pull image." type: "string" RegistryServiceConfig: description: | RegistryServiceConfig stores daemon registry services configuration. type: "object" x-nullable: true properties: AllowNondistributableArtifactsCIDRs: description: | List of IP ranges to which nondistributable artifacts can be pushed, using the CIDR syntax [RFC 4632](https://tools.ietf.org/html/4632). Some images contain artifacts whose distribution is restricted by license. When these images are pushed to a registry, restricted artifacts are not included. This configuration override this behavior, and enables the daemon to push nondistributable artifacts to all registries whose resolved IP address is within the subnet described by the CIDR syntax. This option is useful when pushing images containing nondistributable artifacts to a registry on an air-gapped network so hosts on that network can pull the images without connecting to another server. > **Warning**: Nondistributable artifacts typically have restrictions > on how and where they can be distributed and shared. Only use this > feature to push artifacts to private registries and ensure that you > are in compliance with any terms that cover redistributing > nondistributable artifacts. x-omitempty: true type: "array" items: type: "string" example: ["::1/128", "127.0.0.0/8"] AllowNondistributableArtifactsHostnames: description: | List of registry hostnames to which nondistributable artifacts can be pushed, using the format `[:]` or `[:]`. Some images (for example, Windows base images) contain artifacts whose distribution is restricted by license. When these images are pushed to a registry, restricted artifacts are not included. This configuration override this behavior for the specified registries. This option is useful when pushing images containing nondistributable artifacts to a registry on an air-gapped network so hosts on that network can pull the images without connecting to another server. > **Warning**: Nondistributable artifacts typically have restrictions > on how and where they can be distributed and shared. Only use this > feature to push artifacts to private registries and ensure that you > are in compliance with any terms that cover redistributing > nondistributable artifacts. x-omitempty: true type: "array" items: type: "string" example: ["registry.internal.corp.example.com:3000", "[2001:db8:a0b:12f0::1]:443"] InsecureRegistryCIDRs: description: | List of IP ranges of insecure registries, using the CIDR syntax ([RFC 4632](https://tools.ietf.org/html/4632)). Insecure registries accept un-encrypted (HTTP) and/or untrusted (HTTPS with certificates from unknown CAs) communication. By default, local registries (`127.0.0.0/8`) are configured as insecure. All other registries are secure. Communicating with an insecure registry is not possible if the daemon assumes that registry is secure. This configuration override this behavior, insecure communication with registries whose resolved IP address is within the subnet described by the CIDR syntax. Registries can also be marked insecure by hostname. Those registries are listed under `IndexConfigs` and have their `Secure` field set to `false`. > **Warning**: Using this option can be useful when running a local > registry, but introduces security vulnerabilities. This option > should therefore ONLY be used for testing purposes. For increased > security, users should add their CA to their system's list of trusted > CAs instead of enabling this option. x-omitempty: true type: "array" items: type: "string" example: ["::1/128", "127.0.0.0/8"] IndexConfigs: x-omitempty: true type: "object" additionalProperties: $ref: "#/definitions/IndexInfo" example: "127.0.0.1:5000": "Name": "127.0.0.1:5000" "Mirrors": [] "Secure": false "Official": false "[2001:db8:a0b:12f0::1]:80": "Name": "[2001:db8:a0b:12f0::1]:80" "Mirrors": [] "Secure": false "Official": false "registry.internal.corp.example.com:3000": Name: "registry.internal.corp.example.com:3000" Mirrors: [] Secure: false Official: false Mirrors: description: "List of registry URLs that act as a mirror for the official registry." x-omitempty: true type: "array" items: type: "string" example: - "https://hub-mirror.corp.example.com:5000/" - "https://[2001:db8:a0b:12f0::1]/" IndexInfo: description: IndexInfo contains information about a registry. type: "object" x-nullable: true properties: Name: description: | Name of the registry. type: "string" Mirrors: description: | List of mirrors, expressed as URIs. type: "array" items: type: "string" example: - "https://hub-mirror.corp.example.com:5000/" Secure: description: | Indicates if the the registry is part of the list of insecure registries. If `false`, the registry is insecure. Insecure registries accept un-encrypted (HTTP) and/or untrusted (HTTPS with certificates from unknown CAs) communication. > **Warning**: Insecure registries can be useful when running a local > registry. However, because its use creates security vulnerabilities > it should ONLY be enabled for testing purposes. For increased > security, users should add their CA to their system's list of > trusted CAs instead of enabling this option. type: "boolean" example: true Official: description: | Indicates whether this is an official registry. type: "boolean" example: true Runtime: description: | Runtime describes an [OCI compliant](https://github.com/opencontainers/runtime-spec) runtime. The runtime is invoked by the daemon via the `containerd` daemon. OCI runtimes act as an interface to the Linux kernel namespaces, cgroups, and SELinux. type: "object" properties: path: description: | Name and, optional, path, of the OCI executable binary. If the path is omitted, the daemon searches the host's `$PATH` for the binary and uses the first result. type: "string" example: "/usr/local/bin/my-oci-runtime" runtimeArgs: description: | List of command-line arguments to pass to the runtime when invoked. type: "array" x-nullable: true items: type: "string" example: ["--debug", "--systemd-cgroup=false"] Commit: description: | Commit holds the Git-commit (SHA1) that a binary was built from, as reported in the version-string of external tools, such as `containerd`, or `runC`. type: "object" properties: ID: description: "Actual commit ID of external tool." type: "string" example: "cfb82a876ecc11b5ca0977d1733adbe58599088a" Expected: description: | Commit ID of external tool expected by pouchd as set at build time. type: "string" example: "2d41c047c83e09a6d61d464906feb2a2f3c52aa4" AuthConfig: type: "object" properties: Username: type: "string" Password: type: "string" Auth: type: "string" ServerAddress: type: "string" IdentityToken: type: "string" description: "IdentityToken is used to authenticate the user and get an access token for the registry" RegistryToken: type: "string" description: "RegistryToken is a bearer token to be sent to a registry" AuthResponse: description: "The response returned by login to a registry" type: "object" required: [Status] properties: Status: description: "The status of the authentication" type: "string" x-nullable: false IdentityToken: description: "An opaque token used to authenticate a user after a successful login" type: "string" x-nullable: false ContainerCreateConfig: description: | ContainerCreateConfig is used for API "POST /containers/create". It wraps all kinds of config used in container creation. It can be used to encode client params in client and unmarshal request body in daemon side. allOf: - $ref: "#/definitions/ContainerConfig" - type: "object" properties: HostConfig: $ref: "#/definitions/HostConfig" NetworkingConfig: $ref: "#/definitions/NetworkingConfig" ContainerConfig: type: "object" description: "Configuration for a container that is portable between hosts" required: - Image properties: Hostname: description: "The hostname to use for the container, as a valid RFC 1123 hostname." type: "string" format: hostname minLength: 1 Domainname: description: "The domain name to use for the container." type: "string" User: description: "The user that commands are run as inside the container." type: "string" AttachStdin: description: "Whether to attach to `stdin`." type: "boolean" x-nullable: false AttachStdout: description: "Whether to attach to `stdout`." type: "boolean" x-nullable: false default: true AttachStderr: description: "Whether to attach to `stderr`." type: "boolean" x-nullable: false default: true DisableNetworkFiles: description: "Whether to generate the network files(/etc/hostname, /etc/hosts and /etc/resolv.conf) for container." type: "boolean" x-nullable: false default: false ExposedPorts: description: "An object mapping ports to an empty object in the form:`{/: {}}`" type: "object" additionalProperties: type: "object" enum: - {} default: {} Tty: description: "Attach standard streams to a TTY, including `stdin` if it is not closed." type: "boolean" x-nullable: false OpenStdin: description: "Open `stdin`" type: "boolean" x-nullable: false StdinOnce: description: "Close `stdin` after one attached client disconnects" type: "boolean" x-nullable: false Env: description: | A list of environment variables to set inside the container in the form `["VAR=value", ...]`. A variable without `=` is removed from the environment, rather than to have an empty value. type: "array" items: type: "string" Cmd: description: "Command to run specified an array of strings." type: "array" items: type: "string" ArgsEscaped: description: "Command is already escaped (Windows only)" type: "boolean" x-nullable: false Image: description: "The name of the image to use when creating the container" type: "string" x-nullable: false Volumes: description: "An object mapping mount point paths inside the container to empty objects." type: "object" additionalProperties: type: "object" enum: - {} default: {} WorkingDir: description: "The working directory for commands to run in." type: "string" Entrypoint: description: | The entry point for the container as a string or an array of strings. If the array consists of exactly one empty string (`[""]`) then the entry point is reset to system default. type: "array" items: type: "string" NetworkDisabled: description: "Disable networking for the container." type: "boolean" MacAddress: description: "MAC address of the container." type: "string" OnBuild: description: "`ONBUILD` metadata that were defined." type: "array" items: type: "string" Labels: description: "User-defined key/value metadata." type: "object" additionalProperties: type: "string" StopSignal: description: "Signal to stop a container as a string or unsigned integer." type: "string" default: "SIGTERM" x-nullable: false StopTimeout: description: "Timeout to stop a container in seconds." type: "integer" default: 10 Shell: description: "Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell." type: "array" items: type: "string" Rich: type: "boolean" description: "Whether to start container in rich container mode. (default false)" x-nullable: false RichMode: type: "string" description: "Choose one rich container mode.(default dumb-init)" enum: - "dumb-init" - "sbin-init" - "systemd" InitScript: type: "string" description: "Initial script executed in container. The script will be executed before entrypoint or command" DiskQuota: type: "object" description: "Set disk quota for container" x-nullable: true additionalProperties: type: "string" SpecAnnotation: description: "annotations send to runtime spec." type: "object" additionalProperties: type: "string" QuotaID: type: "string" description: "set disk quota by specified quota id, if id < 0, it means pouchd alloc a unique quota id" ContainerCreateResp: description: "response returned by daemon when container create successfully" type: "object" required: [Id, Warnings] properties: Id: description: "The ID of the created container" type: "string" x-nullable: false Name: description: "The name of the created container" type: "string" Warnings: description: "Warnings encountered when creating the container" type: "array" x-nullable: false items: type: "string" HostConfig: description: "Container configuration that depends on the host we are running on" type: "object" allOf: - properties: # Applicable to all platforms Binds: type: "array" description: | A list of volume bindings for this container. Each volume binding is a string in one of these forms: - `host-src:container-dest` to bind-mount a host path into the container. Both `host-src`, and `container-dest` must be an _absolute_ path. - `host-src:container-dest:ro` to make the bind mount read-only inside the container. Both `host-src`, and `container-dest` must be an _absolute_ path. - `volume-name:container-dest` to bind-mount a volume managed by a volume driver into the container. `container-dest` must be an _absolute_ path. - `volume-name:container-dest:ro` to mount the volume read-only inside the container. `container-dest` must be an _absolute_ path. items: type: "string" ContainerIDFile: type: "string" description: "Path to a file where the container ID is written" LogConfig: description: "The logging configuration for this container" type: "object" $ref: "#/definitions/LogConfig" RestartPolicy: type: "object" description: "Restart policy to be used to manage the container" $ref: "#/definitions/RestartPolicy" NetworkMode: type: "string" description: "Network mode to use for this container. Supported standard values are: `bridge`, `host`, `none`, and `container:`. Any other value is taken as a custom network's name to which this container should connect to." PortBindings: type: "object" description: "A map of exposed container ports and the host port they should map to." $ref: "#/definitions/PortMap" AutoRemove: type: "boolean" description: "Automatically remove the container when the container's process exits. This has no effect if `RestartPolicy` is set." VolumeDriver: type: "string" description: "Driver that this container uses to mount volumes." VolumesFrom: type: "array" description: "A list of volumes to inherit from another container, specified in the form `[:]`." items: type: "string" CapAdd: type: "array" description: "A list of kernel capabilities to add to the container." items: type: "string" CapDrop: type: "array" description: "A list of kernel capabilities to drop from the container." items: type: "string" Dns: type: "array" description: "A list of DNS servers for the container to use." items: type: "string" DnsOptions: type: "array" description: "A list of DNS options." items: type: "string" DnsSearch: type: "array" description: "A list of DNS search domains." items: type: "string" ExtraHosts: type: "array" description: | A list of hostnames/IP mappings to add to the container's `/etc/hosts` file. Specified in the form `["hostname:IP"]`. items: type: "string" GroupAdd: type: "array" description: "A list of additional groups that the container process will run as." items: type: "string" IpcMode: type: "string" description: | IPC sharing mode for the container. Possible values are: - `"none"`: own private IPC namespace, with /dev/shm not mounted - `"private"`: own private IPC namespace - `"shareable"`: own private IPC namespace, with a possibility to share it with other containers - `"container:"`: join another (shareable) container's IPC namespace - `"host"`: use the host system's IPC namespace If not specified, daemon default is used, which can either be `"private"` or `"shareable"`, depending on daemon version and configuration. Cgroup: type: "string" description: "Cgroup to use for the container." Links: type: "array" description: "A list of links for the container in the form `container_name:alias`." items: type: "string" OomScoreAdj: type: "integer" description: | An integer value containing the score given to the container in order to tune OOM killer preferences. The range is in [-1000, 1000]. type: "integer" format: "int" x-nullable: false minimum: -1000 maximum: 1000 PidMode: type: "string" description: | Set the PID (Process) Namespace mode for the container. It can be either: - `"container:"`: joins another container's PID namespace - `"host"`: use the host's PID namespace inside the container Privileged: type: "boolean" description: "Gives the container full access to the host." PublishAllPorts: type: "boolean" description: "Allocates a random host port for all of a container's exposed ports." ReadonlyRootfs: type: "boolean" description: "Mount the container's root filesystem as read only." SecurityOpt: type: "array" description: "A list of string values to customize labels for MLS systems, such as SELinux." items: type: "string" StorageOpt: type: "object" description: | Storage driver options for this container, in the form `{"size": "120G"}`. additionalProperties: type: "string" Tmpfs: type: "object" description: | A map of container directories which should be replaced by tmpfs mounts, and their corresponding mount options. For example: `{ "/run": "rw,noexec,nosuid,size=65536k" }`. additionalProperties: type: "string" UTSMode: type: "string" description: "UTS namespace to use for the container." UsernsMode: type: "string" description: "Sets the usernamespace mode for the container when usernamespace remapping option is enabled." ShmSize: type: "integer" description: "Size of `/dev/shm` in bytes. If omitted, the system uses 64MB." minimum: 0 Sysctls: type: "object" description: | A list of kernel parameters (sysctls) to set in the container. For example: `{"net.ipv4.ip_forward": "1"}` additionalProperties: type: "string" Runtime: type: "string" description: "Runtime to use with this container." # Applicable to Windows ConsoleSize: type: "array" description: "Initial console size, as an `[height, width]` array. (Windows only)" minItems: 2 maxItems: 2 items: type: "integer" minimum: 0 Isolation: type: "string" description: "Isolation technology of the container. (Windows only)" enum: - "default" - "process" - "hyperv" EnableLxcfs: description: "Whether to enable lxcfs." type: "boolean" x-nullable: false Rich: type: "boolean" description: "Whether to start container in rich container mode. (default false)" x-nullable: false RichMode: type: "string" description: "Choose one rich container mode.(default dumb-init)" enum: - "dumb-init" - "sbin-init" - "systemd" InitScript: type: "string" description: "Initial script executed in container. The script will be executed before entrypoint or command" - $ref: "#/definitions/Resources" UpdateConfig: description: "UpdateConfig holds the mutable attributes of a Container. Those attributes can be updated at runtime." allOf: - $ref: "#/definitions/Resources" - properties: RestartPolicy: $ref: "#/definitions/RestartPolicy" Env: description: | A list of environment variables to set inside the container in the form `["VAR=value", ...]`. A variable without `=` is removed from the environment, rather than to have an empty value. type: "array" items: type: "string" Label: description: "List of labels set to container." type: "array" items: type: "string" DiskQuota: type: "object" description: "update disk quota for container" x-nullable: true additionalProperties: type: "string" ContainerUpgradeConfig: description: | ContainerUpgradeConfig is used for API "POST /containers/upgrade". It wraps all kinds of config used in container upgrade. It can be used to encode client params in client and unmarshal request body in daemon side. allOf: - $ref: "#/definitions/ContainerConfig" - type: "object" properties: HostConfig: $ref: "#/definitions/HostConfig" LogConfig: description: "The logging configuration for this container" type: "object" properties: Type: type: "string" x-go-name: "LogDriver" enum: - "json-file" - "syslog" - "journald" - "gelf" - "fluentd" - "awslogs" - "splunk" - "etwlogs" - "none" Config: type: "object" x-go-name: "LogOpts" additionalProperties: type: "string" Resources: description: "A container's resources (cgroups config, ulimits, etc)" type: "object" required: [CPUShares, Memory, CgroupParent, BlkioWeight, CPUPeriod, CPUQuota, CpuRealtimePeriod, CpuRealtimeRuntime, CpusetCpus, CpusetMems, DeviceCgroupRules, KernelMemory, MemoryReservation, MemorySwap, MemorySwappiness, NanoCPUs, OomKillDisable, PidsLimit, CpuCount, CpuPercent, IOMaximumIOps, IOMaximumBandwidth, IntelRdtL3Cbm, ScheLatSwitch, MemoryWmarkRatio, MemoryExtra, MemoryForceEmptyCtl] properties: # Applicable to UNIX platforms CgroupParent: description: "Path to `cgroups` under which the container's `cgroup` is created. If the path is not absolute, the path is considered to be relative to the `cgroups` path of the init process. Cgroups are created if they do not already exist." type: "string" x-nullable: false BlkioWeight: description: "Block IO weight (relative weight), need CFQ IO Scheduler enable." type: "integer" format: "uint16" x-nullable: false minimum: 0 maximum: 1000 BlkioWeightDevice: description: | Block IO weight (relative device weight) in the form `[{"Path": "device_path", "Weight": weight}]`. type: "array" items: $ref: "#/definitions/WeightDevice" BlkioDeviceReadBps: description: | Limit read rate (bytes per second) from a device, in the form `[{"Path": "device_path", "Rate": rate}]`. type: "array" items: $ref: "#/definitions/ThrottleDevice" BlkioDeviceWriteBps: description: | Limit write rate (bytes per second) to a device, in the form `[{"Path": "device_path", "Rate": rate}]`. type: "array" items: $ref: "#/definitions/ThrottleDevice" BlkioDeviceReadIOps: description: | Limit read rate (IO per second) from a device, in the form `[{"Path": "device_path", "Rate": rate}]`. type: "array" items: $ref: "#/definitions/ThrottleDevice" BlkioDeviceWriteIOps: description: | Limit write rate (IO per second) to a device, in the form `[{"Path": "device_path", "Rate": rate}]`. type: "array" items: $ref: "#/definitions/ThrottleDevice" CPUShares: description: "An integer value representing this container's relative CPU weight versus other containers." type: "integer" x-nullable: false CPUPeriod: description: | CPU CFS (Completely Fair Scheduler) period. The length of a CPU period in microseconds. type: "integer" format: "int64" minimum: 1000 maximum: 1000000 x-nullable: false CPUQuota: description: | CPU CFS (Completely Fair Scheduler) quota. Microseconds of CPU time that the container can get in a CPU period." type: "integer" format: "int64" minimum: 1000 x-nullable: false CpuRealtimePeriod: description: "The length of a CPU real-time period in microseconds. Set to 0 to allocate no time allocated to real-time tasks." type: "integer" format: "int64" x-nullable: false CpuRealtimeRuntime: description: "The length of a CPU real-time runtime in microseconds. Set to 0 to allocate no time allocated to real-time tasks." type: "integer" format: "int64" x-nullable: false CpusetCpus: description: "CPUs in which to allow execution (e.g., `0-3`, `0,1`)" type: "string" example: "0-3" x-nullable: false CpusetMems: description: "Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems." type: "string" x-nullable: false Devices: description: "A list of devices to add to the container." type: "array" items: $ref: "#/definitions/DeviceMapping" DeviceCgroupRules: description: "a list of cgroup rules to apply to the container" type: "array" items: type: "string" example: "c 13:* rwm" KernelMemory: description: "Kernel memory limit in bytes." type: "integer" format: "int64" x-nullable: false Memory: description: "Memory limit in bytes." type: "integer" default: 0 x-nullable: false MemoryReservation: description: "Memory soft limit in bytes." type: "integer" format: "int64" x-nullable: false MemorySwap: description: "Total memory limit (memory + swap). Set as `-1` to enable unlimited swap." type: "integer" format: "int64" x-nullable: false MemorySwappiness: description: "Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100." type: "integer" format: "int64" minimum: 0 maximum: 100 NanoCPUs: description: "CPU quota in units of 10-9 CPUs." type: "integer" format: "int64" x-nullable: false OomKillDisable: description: "Disable OOM Killer for the container." type: "boolean" x-nullable: true PidsLimit: description: | Tune a container's pids limit. Set -1 for unlimited. Only on Linux 4.4 does this parameter support. type: "integer" format: "int64" x-nullable: false Ulimits: description: | A list of resource limits to set in the container. For example: `{"Name": "nofile", "Soft": 1024, "Hard": 2048}`" type: "array" items: $ref: "#/definitions/Ulimit" # Applicable to Windows CpuCount: description: | The number of usable CPUs (Windows only). On Windows Server containers, the processor resource controls are mutually exclusive. The order of precedence is `CPUCount` first, then `CPUShares`, and `CPUPercent` last. type: "integer" format: "int64" x-nullable: false CpuPercent: description: | The usable percentage of the available CPUs (Windows only). On Windows Server containers, the processor resource controls are mutually exclusive. The order of precedence is `CPUCount` first, then `CPUShares`, and `CPUPercent` last. type: "integer" format: "int64" x-nullable: false IOMaximumIOps: description: "Maximum IOps for the container system drive (Windows only)" type: "integer" format: "uint64" x-nullable: false IOMaximumBandwidth: description: "Maximum IO in bytes per second for the container system drive (Windows only)" type: "integer" format: "uint64" x-nullable: false IntelRdtL3Cbm: description: "IntelRdtL3Cbm specifies settings for Intel RDT/CAT group that the container is placed into to limit the resources (e.g., L3 cache) the container has available." type: "string" x-nullable: false # applicable to AliKenerl 4.9 ScheLatSwitch: description: "ScheLatSwitch enables scheduler latency count in cpuacct" type: "integer" format: "int64" x-nullable: false minimum: 0 maximum: 1 x-nullable: false MemoryWmarkRatio: description: | MemoryWmarkRatio is an integer value representing this container's memory low water mark percentage. The value of memory low water mark is memory.limit_in_bytes * MemoryWmarkRatio. The range is in [0, 100]. type: "integer" format: "int64" x-nullable: true minimum: 0 maximum: 100 MemoryExtra: description: | MemoryExtra is an integer value representing this container's memory high water mark percentage. The range is in [0, 100]. type: "integer" format: "int64" x-nullable: true minimum: 0 maximum: 100 MemoryForceEmptyCtl: description: "MemoryForceEmptyCtl represents whether to reclaim the page cache when deleting cgroup." type: "integer" format: "int64" x-nullable: false minimum: 0 maximum: 1 ThrottleDevice: type: "object" properties: Path: description: "Device path" type: "string" Rate: description: "Rate" type: "integer" format: "uint64" x-nullable: false minimum: 0 WeightDevice: type: "object" description: "Weight for BlockIO Device" properties: Path: description: "Weight Device" type: "string" Weight: type: "integer" format: "uint16" x-nullable: false minimum: 0 DeviceMapping: type: "object" description: "A device mapping between the host and container" properties: PathOnHost: description: "path on host of the device mapping" type: "string" PathInContainer: description: "path in container of the device mapping" type: "string" CgroupPermissions: description: "cgroup permissions of the device" type: "string" example: PathOnHost: "/dev/deviceName" PathInContainer: "/dev/deviceName" CgroupPermissions: "mrw" Ulimit: type: "object" description: "A list of resource limits" properties: Name: description: "Name of ulimit" type: "string" Soft: description: "Soft limit" type: "integer" Hard: description: "Hard limit" type: "integer" Container: description: | an array of Container contains response of Engine API: GET "/containers/json" type: "object" properties: Id: description: "Container ID" type: "string" Names: type: "array" items: type: "string" example: - "container_1" - "container_2" Image: type: "string" ImageID: type: "string" Command: type: "string" Created: description: "Created time of container in daemon." type: "integer" format: "int64" SizeRw: type: "integer" format: "int64" SizeRootFs: type: "integer" format: "int64" Labels: type: "object" additionalProperties: type: "string" State: type: "string" Status: type: "string" HostConfig: description: | In Moby's API, HostConfig field in Container struct has following type struct { NetworkMode string `json:",omitempty"` } In Pouch, we need to pick runtime field in HostConfig from daemon side to judge runtime type, So Pouch changes this type to be the complete HostConfig. Incompatibility exists, ATTENTION. $ref: "#/definitions/HostConfig" x-nullable: false Mounts: type: "array" description: "Set of mount point in a container." items: $ref: "#/definitions/MountPoint" NetworkSettings: type: "object" properties: Networks: additionalProperties: $ref: "#/definitions/EndpointSettings" x-nullable: true NetworkingConfig: description: "Configuration for a network used to create a container." type: "object" properties: EndpointsConfig: additionalProperties: $ref: "#/definitions/EndpointSettings" x-nullable: true EndpointSettings: description: "Configuration for a network endpoint." type: "object" properties: # Configurations IPAMConfig: $ref: "#/definitions/EndpointIPAMConfig" x-nullable: true Links: type: "array" items: type: "string" example: - "container_1" - "container_2" Aliases: type: "array" items: type: "string" example: - "server_x" - "server_y" # Operational data NetworkID: description: | Unique ID of the network. type: "string" example: "08754567f1f40222263eab4102e1c733ae697e8e354aa9cd6e18d7402835292a" EndpointID: description: | Unique ID for the service endpoint in a Sandbox. type: "string" example: "b88f5b905aabf2893f3cbc4ee42d1ea7980bbc0a92e2c8922b1e1795298afb0b" Gateway: description: | Gateway address for this network. type: "string" example: "172.17.0.1" IPAddress: description: | IPv4 address. type: "string" example: "172.17.0.4" IPPrefixLen: description: | Mask length of the IPv4 address. type: "integer" example: 16 IPv6Gateway: description: | IPv6 gateway address. type: "string" example: "2001:db8:2::100" GlobalIPv6Address: description: | Global IPv6 address. type: "string" example: "2001:db8::5689" GlobalIPv6PrefixLen: description: | Mask length of the global IPv6 address. type: "integer" format: "int64" example: 64 MacAddress: description: | MAC address for the endpoint on this network. type: "string" example: "02:42:ac:11:00:04" DriverOpts: description: | DriverOpts is a mapping of driver options and values. These options are passed directly to the driver and are driver specific. type: "object" x-nullable: true additionalProperties: type: "string" example: com.example.some-label: "some-value" com.example.some-other-label: "some-other-value" EndpointIPAMConfig: description: "IPAM configurations for the endpoint" type: "object" properties: IPv4Address: description: "ipv4 address" type: "string" IPv6Address: description: "ipv6 address" type: "string" LinkLocalIPs: description: "link to the list of local ip" type: "array" x-nullable: false items: type: "string" NetworkDisconnect: description: "Parameters of network disconnect" type: "object" properties: Container: type: "string" description: "The ID or name of the container to disconnect from the network." Force: type: "boolean" description: "Force the container to disconnect from the network." ImageInfo: description: "An object containing all details of an image at API side" type: "object" properties: Id: description: "ID of an image." type: "string" x-nullable: false RepoTags: description: "repository with tag." type: "array" items: type: "string" RepoDigests: description: "repository with digest." type: "array" items: type: "string" CreatedAt: description: "time of image creation." type: "string" x-nullable: false Size: description: "size of image's taking disk space." type: "integer" x-nullable: false Config: $ref: "#/definitions/ContainerConfig" Architecture: description: "the CPU architecture." type: "string" x-nullable: false Os: description: "the name of the operating system." type: "string" x-nullable: false RootFS: description: "the rootfs key references the layer content addresses used by the image." type: "object" required: [Type] properties: Type: description: "type of the rootfs" type: "string" x-nullable: false Layers: description: "an array of layer content hashes" type: "array" items: type: "string" BaseLayer: description: "the base layer content hash." type: "string" SearchResultItem: type: "object" description: "search result item in search results." properties: description: type: "string" description: "description just shows the description of this image" is_official: type: "boolean" description: "is_official shows if this image is marked official." is_automated: type: "boolean" description: "is_automated means whether this image is automated." name: type: "string" description: "name represents the name of this image" star_count: type: "integer" description: "star_count refers to the star count of this image." VolumeInfo: type: "object" description: "Volume represents the configuration of a volume for the container." properties: Name: description: "Name is the name of the volume." type: "string" Driver: description: "Driver is the Driver name used to create the volume." type: "string" Mountpoint: description: "Mountpoint is the location on disk of the volume." type: "string" CreatedAt: type: "string" format: "dateTime" description: "Date/Time the volume was created." Status: description: "Status provides low-level status information about the volume." type: "object" additionalProperties: type: "object" enum: - {} default: {} Labels: description: "Labels is metadata specific to the volume." type: "object" additionalProperties: type: "string" Scope: description: | Scope describes the level at which the volume exists (e.g. `global` for cluster-wide or `local` for machine level) type: "string" VolumeCreateConfig: description: "config used to create a volume" type: "object" properties: Name: description: "The new volume's name. If not specified, Pouch generates a name." type: "string" x-nullable: false Driver: description: "Name of the volume driver to use." type: "string" default: "local" x-nullable: false DriverOpts: description: "A mapping of driver options and values. These options are passed directly to the driver and are driver specific." type: "object" additionalProperties: type: "string" Labels: description: "User-defined key/value metadata." type: "object" additionalProperties: type: "string" example: Name: "tardis" Labels: com.example.some-label: "some-value" com.example.some-other-label: "some-other-value" Driver: "custom" VolumeListResp: type: "object" required: [Volumes, Warnings] properties: Volumes: type: "array" x-nullable: false description: "List of volumes" items: $ref: "#/definitions/VolumeInfo" Warnings: type: "array" x-nullable: false description: "Warnings that occurred when fetching the list of volumes" items: type: "string" ExecCreateConfig: type: "object" description: is a small subset of the Config struct that holds the configuration. properties: User: type: "string" description: "User that will run the command" x-nullable: false Privileged: type: "boolean" description: "Is the container in privileged mode" Tty: type: "boolean" description: "Attach standard streams to a tty" AttachStdin: type: "boolean" description: "Attach the standard input, makes possible user interaction" AttachStderr: type: "boolean" description: "Attach the standard error" AttachStdout: type: "boolean" description: "Attach the standard output" Detach: type: "boolean" description: "Execute in detach mode" DetachKeys: type: "string" description: "Escape keys for detach" Cmd: type: "array" description: "Execution commands and args" minItems: 1 items: type: "string" ContainerProcessList: description: OK Response to ContainerTop operation type: "object" properties: Titles: description: "The ps column titles" type: "array" items: type: "string" Processes: description: "Each process running in the container, where each is process is an array of values corresponding to the titles" type: "array" items: type: "array" items: type: "string" ExecCreateResp: type: "object" description: contains response of Remote API POST "/containers/{name:.*}/exec". properties: Id: type: "string" description: ID is the exec ID ExecStartConfig: type: "object" description: ExecStartConfig is a temp struct used by execStart. properties: Detach: description: ExecStart will first check if it's detached type: "boolean" Tty: description: Check if there's a tty type: "boolean" example: Detach: false Tty: false ContainerExecInspect: type: "object" description: holds information about a running process started. required: [ID, Running, ExitCode, ProcessConfig, OpenStdin, OpenStderr, OpenStdout, CanRemove, ContainerID, DetachKeys] properties: ID: x-nullable: false type: "string" description: "The ID of this exec" Running: x-nullable: false type: "boolean" ExitCode: x-nullable: false type: "integer" description: "The last exit code of this container" ProcessConfig: x-nullable: false $ref: "#/definitions/ProcessConfig" OpenStdin: x-nullable: false type: "boolean" OpenStderr: x-nullable: false type: "boolean" OpenStdout: x-nullable: false type: "boolean" CanRemove: x-nullable: false type: "boolean" ContainerID: x-nullable: false type: "string" description: "The ID of this container" DetachKeys: x-nullable: false type: "string" ProcessConfig: type: "object" description: ExecProcessConfig holds information about the exec process. required: [privileged, user, tty, entrypoint, arguments] properties: privileged: x-nullable: false type: "boolean" user: x-nullable: false type: "string" tty: x-nullable: false type: "boolean" entrypoint: x-nullable: false type: "string" arguments: x-nullable: false type: "array" items: type: "string" ContainerJSON: description: | ContainerJSON contains response of Engine API: GET "/containers/{id}/json" type: "object" properties: Id: description: "The ID of the container" type: "string" Created: description: "The time the container was created" type: "string" Path: description: "The path to the command being run" type: "string" Args: description: "The arguments to the command being run" type: "array" items: type: "string" State: description: "The state of the container." $ref: "#/definitions/ContainerState" Image: description: "The container's image" type: "string" ResolvConfPath: type: "string" HostnamePath: type: "string" HostsPath: type: "string" LogPath: type: "string" Name: type: "string" RestartCount: type: "integer" Driver: type: "string" MountLabel: type: "string" ProcessLabel: type: "string" AppArmorProfile: type: "string" ExecIDs: description: "exec ids of container" type: "array" items: type: "string" HostConfig: $ref: "#/definitions/HostConfig" SizeRw: description: "The size of files that have been created or changed by this container." type: "integer" format: "int64" x-nullable: true SizeRootFs: description: "The total size of all the files in this container." type: "integer" format: "int64" x-nullable: true Config: $ref: "#/definitions/ContainerConfig" Snapshotter: $ref: "#/definitions/SnapshotterData" GraphDriver: $ref: "#/definitions/GraphDriverData" Mounts: type: "array" description: "Set of mount point in a container." items: $ref: "#/definitions/MountPoint" NetworkSettings: description: "NetworkSettings exposes the network settings in the API." $ref: "#/definitions/NetworkSettings" ContainerState: type: "object" required: [StartedAt, FinishedAt] properties: Status: $ref: "#/definitions/Status" Running: description: | Whether this container is running. Note that a running container can be _paused_. The `Running` and `Paused` booleans are not mutually exclusive: When pausing a container (on Linux), the cgroups freezer is used to suspend all processes in the container. Freezing the process requires the process to be running. As a result, paused containers are both `Running` _and_ `Paused`. Use the `Status` field instead to determine if a container's state is "running". type: "boolean" Paused: description: "Whether this container is paused." type: "boolean" Restarting: description: "Whether this container is restarting." type: "boolean" OOMKilled: description: "Whether this container has been killed because it ran out of memory." type: "boolean" Dead: description: "Whether this container is dead." type: "boolean" Pid: description: "The process ID of this container" type: "integer" ExitCode: description: "The last exit code of this container" type: "integer" Error: description: "The error message of this container" type: "string" StartedAt: description: "The time when this container was last started." type: "string" x-nullable: false FinishedAt: description: "The time when this container last exited." type: "string" x-nullable: false ContainerLogsOptions: type: "object" properties: ShowStdout: description: "Return logs from `stdout`" type: "boolean" ShowStderr: description: "Return logs from `stderr`" type: "boolean" Since: description: "Only return logs after this time, as a UNIX timestamp" type: "string" Until: description: "Only reture logs before this time, as a UNIX timestamp" type: "string" Timestamps: description: "Add timestamps to every log line" type: "boolean" Follow: description: "Return logs as a stream" type: "boolean" Tail: description: "Only reture this number of log lines from the end of the logs. Specify as an integer or `all` to output all log lines." type: "string" Details: description: "Show extra details provided to logs" type: "boolean" description: The parameters to filter the log. Status: description: The status of the container. For example, "running" or "exited". type: "string" enum: ["created", "running", "stopped", "paused", "restarting", "removing", "exited", "dead"] SnapshotterData: description: "Information about a container's snapshotter." type: "object" required: [Name, Data] properties: Name: type: "string" x-nullable: false Data: type: "object" x-nullable: false additionalProperties: type: "string" GraphDriverData: description: "Information about a container's graph driver." type: "object" required: [Name, Data] properties: Name: type: "string" x-nullable: false Data: type: "object" x-nullable: false additionalProperties: type: "string" MountPoint: type: "object" description: "A mount point inside a container" x-nullable: false properties: Type: type: "string" ID: type: "string" Name: type: "string" Source: type: "string" Destination: type: "string" Driver: type: "string" Mode: type: "string" RW: type: "boolean" CopyData: type: "boolean" Named: type: "boolean" Replace: type: "string" Propagation: type: "string" NetworkSettings: description: "NetworkSettings exposes the network settings in the API." type: "object" properties: Bridge: description: Name of the network'a bridge (for example, `pouch-br`). type: "string" example: "pouch-br" SandboxID: description: SandboxID uniquely represents a container's network stack. type: "string" example: "9d12daf2c33f5959c8bf90aa513e4f65b561738661003029ec84830cd503a0c3" HairpinMode: description: "Indicates if hairpin NAT should be enabled on the virtual interface" type: "boolean" example: false LinkLocalIPv6Address: description: "IPv6 unicast address using the link-local prefix" type: "string" example: "fe80::42:acff:fe11:1" LinkLocalIPv6PrefixLen: description: Prefix length of the IPv6 unicast address. type: "integer" example: "64" Ports: $ref: "#/definitions/PortMap" SandboxKey: description: SandboxKey identifies the sandbox type: "string" example: "/var/run/pouch/netns/8ab54b426c38" # TODO is SecondaryIPAddresses actually used? SecondaryIPAddresses: description: "" type: "array" items: $ref: "#/definitions/IPAddress" x-nullable: true # TODO is SecondaryIPv6Addresses actually used? SecondaryIPv6Addresses: description: "" type: "array" items: $ref: "#/definitions/IPAddress" x-nullable: true Networks: description: "Information about all networks that the container is connected to" type: "object" additionalProperties: $ref: "#/definitions/EndpointSettings" x-nullable: true IPAddress: description: Address represents an IPv4 or IPv6 IP address. type: "object" properties: Addr: description: IP address. type: "string" PrefixLen: description: Mask length of the IP address. type: "integer" PortMap: description: | PortMap describes the mapping of container ports to host ports, using the container's port-number and protocol as key in the format `/`, for example, `80/udp`. If a container's port is mapped for both `tcp` and `udp`, two separate entries are added to the mapping table. type: "object" additionalProperties: type: "array" items: $ref: "#/definitions/PortBinding" example: "443/tcp": - HostIp: "127.0.0.1" HostPort: "4443" "80/tcp": - HostIp: "0.0.0.0" HostPort: "80" - HostIp: "0.0.0.0" HostPort: "8080" "80/udp": - HostIp: "0.0.0.0" HostPort: "80" "2377/tcp": null PortBinding: description: "PortBinding represents a binding between a host IP address and a host port" type: "object" x-nullable: true properties: HostIp: description: "Host IP address that the container's port is mapped to." type: "string" example: "127.0.0.1" HostPort: description: "Host port number that the container's port is mapped to." type: "string" example: "4443" RestartPolicy: description: "Define container's restart policy" type: "object" properties: Name: type: "string" MaximumRetryCount: type: "integer" NetworkConnect: type: "object" description: "contains the request for the remote API: POST /networks/{id:.*}/connect" properties: Container: type: "string" description: "The ID or name of the container to connect to the network." EndpointConfig: $ref: "#/definitions/EndpointSettings" NetworkCreateConfig: type: "object" description: "contains the request for the remote API: POST /networks/create" allOf: - properties: Name: description: "Name is the name of the network." type: "string" - $ref: "#/definitions/NetworkCreate" NetworkCreateResp: type: "object" description: "contains the response for the remote API: POST /networks/create" properties: Id: description: "ID is the id of the network." type: "string" Warning: description: "Warning means the message of create network result." type: "string" NetworkCreate: type: "object" description: "is the expected body of the \"create network\" http request message" properties: CheckDuplicate: type: "boolean" description: "CheckDuplicate is used to check the network is duplicate or not." Driver: type: "string" description: "Driver means the network's driver." EnableIPv6: type: "boolean" IPAM: type: "object" $ref: "#/definitions/IPAM" Internal: type: "boolean" description: "Internal checks the network is internal network or not." Options: type: "object" additionalProperties: type: "string" Labels: type: "object" additionalProperties: type: "string" NetworkInspectResp: type: "object" description: "is the expected body of the 'GET networks/{id}'' http request message" properties: Name: type: "string" description: "Name is the requested name of the network" Id: type: "string" description: "ID uniquely identifies a network on a single machine" Scope: type: "string" description: "Scope describes the level at which the network exists." Driver: type: "string" description: "Driver means the network's driver." EnableIPv6: type: "boolean" description: "EnableIPv6 represents whether to enable IPv6." IPAM: type: "object" description: "IPAM is the network's IP Address Management." $ref: "#/definitions/IPAM" Internal: type: "boolean" description: "Internal checks the network is internal network or not." Options: type: "object" description: "Options holds the network specific options to use for when creating the network." additionalProperties: type: "string" Labels: type: "object" description: "Labels holds metadata specific to the network being created." additionalProperties: type: "string" NetworkResource: type: "object" description: "NetworkResource is the body of the \"get network\" http response message" properties: Name: description: "Name is the requested name of the network" type: "string" Id: description: "ID uniquely identifies a network on a single machine" type: "string" Scope: description: "Scope describes the level at which the network exists (e.g. `global` for cluster-wide or `local` for machine level)" type: "string" Driver: description: "Driver is the Driver name used to create the network (e.g. `bridge`, `overlay`)" type: "string" EnableIPv6: description: "EnableIPv6 represents whether to enable IPv6" type: "boolean" IPAM: description: "" type: "object" $ref: "#/definitions/IPAM" Internal: description: "Internal represents if the network is used internal only" type: "boolean" Containers: description: "Containers contains endpoints belonging to the network" type: "object" IndexConfigs: type: "object" additionalProperties: $ref: "#/definitions/EndpointResource" Options: description: "Options holds the network specific options to use for when creating the network" type: "object" x-nullable: true additionalProperties: type: "string" example: com.example.some-options: "some-option" com.example.some-other-options: "some-other-option" Labels: description: "Labels holds metadata specific to the network being created" type: "object" x-nullable: true additionalProperties: type: "string" example: com.example.some-label: "some-label" com.example.some-other-label: "some-other-label" EndpointResource: type: "object" description: "NetworkResource is the body of the \"get network\" http response message" properties: Name: description: "Name is the requested name of the network" type: "string" EndpointID: description: "EndpointID represents the endpoint's id" type: "string" MacAddress: description: "MacAddress represents the enpoint's mac address" type: "string" IPv4Address: description: "IPv4Address represents the enpoint's ipv4 address" type: "string" IPv6Address: description: "IPv4Address represents the enpoint's ipv6 address" type: "string" IPAM: type: "object" description: "represents IP Address Management" properties: Driver: type: "string" Options: type: "object" additionalProperties: type: "string" Config: type: "array" items: $ref: '#/definitions/IPAMConfig' IPAMConfig: description: "represents IPAM configurations" type: "object" x-nullable: false properties: Subnet: description: "subnet address for network" type: "string" IPRange: description: "sub ip range in sub-network" type: "string" Gateway: description: "gateway for sub-network" type: "string" AuxAddress: description: "aux address in sub-network" type: "object" additionalProperties: type: "string" ResizeOptions: description: "options of resizing container tty size" type: "object" properties: Height: type: "integer" Width: type: "integer" ContainerRemoveOptions: description: "options of remove container" type: "object" properties: Force: type: "boolean" Volumes: type: "boolean" Link: type: "boolean" ContainerListOptions: description: | options of list container, filters (a `map[string][]string`) to process on the container list. Available filters: - `id=container-id` - `name=container-name` - `status=running` - `label=key` or `label=key=value` - `network=container-network` - `volume=volume-id` type: "object" properties: All: type: "boolean" Since: type: "string" Before: type: "string" Limit: type: "integer" Filter: type: "object" additionalProperties: type: "array" items: type: "string" parameters: id: name: id in: path required: true description: ID or name of the container type: string imageid: name: imageid in: path required: true description: Image name or id type: string responses: 401ErrorResponse: description: An unexpected 401 error occurred. schema: $ref: "#/definitions/Error" 404ErrorResponse: description: An unexpected 404 error occurred. schema: $ref: "#/definitions/Error" 500ErrorResponse: description: An unexpected server error occurred. schema: $ref: "#/definitions/Error" analysis-0.21.1/fixtures/bugs/1602/other-invalid-pointers.yaml000066400000000000000000000034471413705513100241210ustar00rootroot00000000000000--- swagger: "2.0" schemes: - "http" - "https" basePath: "/v1.24" info: title: Edge cases with JSON pointers version: "1.24" description: | Explore edge cases with invalid pointers paths: /invalid: get: responses: 401: $ref: "#/responses/401ErrorResponse" 404: $ref: "#/responses/404ErrorResponse" 500: $ref: "#/responses/500ErrorResponse" definitions: invalidRefInObject: type: object properties: prop1: type: integer prop2: $ref: "#/definitions/noWhere" invalidRefInMap: type: object additionalProperties: $ref: "#/definitions/noWhere" invalidRefInArray: type: array items: $ref: "#/definitions/noWhere" indirectToInvalidRef: $ref: "#/definitions/invalidRefInArray" invalidRefInTuple: type: array items: - type: integer - $ref: "#/definitions/noWhere" parameters: bodyWithRef: name: bodyWithRefParam in: body required: true schema: $ref: "#/definitions/Error" anotherBodyWithRef: name: anotherBodyWithRefParam in: body required: true schema: $ref: "#/definitions/Error" funnyParam: name: funnyParam in: body required: true schema: $ref: "#/responses/500ErrorResponse/schema" responses: 401ErrorResponse: description: An unexpected 401 error occurred. schema: $ref: "#/definitions/Error" 404ErrorResponse: description: An unexpected 404 error occurred. schema: $ref: "#/definitions/Error" 500ErrorResponse: description: An unexpected server error occurred. schema: $ref: "#/definitions/Error" funnyResponse: description: An unexpected server error occurred. schema: $ref: "#/responses/401ErrorResponse/schema" analysis-0.21.1/fixtures/bugs/1614/000077500000000000000000000000001413705513100166225ustar00rootroot00000000000000analysis-0.21.1/fixtures/bugs/1614/gitea.yaml000066400000000000000000004712161413705513100206120ustar00rootroot00000000000000--- consumes: - "application/json" - "text/plain" produces: - "application/json" - "text/html" schemes: - "http" - "https" swagger: "2.0" info: description: "This documentation describes the Gitea API." title: "Gitea API." license: name: "MIT" url: "http://opensource.org/licenses/MIT" version: "1.1.1" basePath: "/api/v1" paths: /admin/users: post: consumes: - "application/json" produces: - "application/json" tags: - "admin" summary: "Create a user" operationId: "adminCreateUser" parameters: - name: "body" in: "body" schema: $ref: "#/definitions/CreateUserOption" responses: 201: $ref: "#/responses/User" 403: $ref: "#/responses/forbidden" 422: $ref: "#/responses/validationError" /admin/users/{username}: delete: produces: - "application/json" tags: - "admin" summary: "Delete a user" operationId: "adminDeleteUser" parameters: - type: "string" description: "username of user to delete" name: "username" in: "path" required: true responses: 204: $ref: "#/responses/empty" 403: $ref: "#/responses/forbidden" 422: $ref: "#/responses/validationError" patch: consumes: - "application/json" produces: - "application/json" tags: - "admin" summary: "Edit an existing user" operationId: "adminEditUser" parameters: - type: "string" description: "username of user to edit" name: "username" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/EditUserOption" responses: 200: $ref: "#/responses/User" 403: $ref: "#/responses/forbidden" 422: $ref: "#/responses/validationError" /admin/users/{username}/keys: post: consumes: - "application/json" produces: - "application/json" tags: - "admin" summary: "Add a public key on behalf of a user" operationId: "adminCreatePublicKey" parameters: - type: "string" description: "username of the user" name: "username" in: "path" required: true responses: 201: $ref: "#/responses/PublicKey" 403: $ref: "#/responses/forbidden" 422: $ref: "#/responses/validationError" /admin/users/{username}/keys/{id}: delete: produces: - "application/json" tags: - "admin" summary: "Delete a user's public key" operationId: "adminDeleteUserPublicKey" parameters: - type: "string" description: "username of user" name: "username" in: "path" required: true - type: "integer" description: "id of the key to delete" name: "id" in: "path" required: true responses: 204: $ref: "#/responses/empty" 403: $ref: "#/responses/forbidden" 404: $ref: "#/responses/notFound" /admin/users/{username}/orgs: post: consumes: - "application/json" produces: - "application/json" tags: - "admin" summary: "Create an organization" operationId: "adminCreateOrg" parameters: - type: "string" description: "username of the user that will own the created organization" name: "username" in: "path" required: true responses: 201: $ref: "#/responses/Organization" 403: $ref: "#/responses/forbidden" 422: $ref: "#/responses/validationError" /admin/users/{username}/repos: post: consumes: - "application/json" produces: - "application/json" tags: - "admin" summary: "Create a repository on behalf a user" operationId: "adminCreateRepo" parameters: - type: "string" description: "username of the user. This user will own the created repository" name: "username" in: "path" required: true responses: 201: $ref: "#/responses/Repository" 403: $ref: "#/responses/forbidden" 422: $ref: "#/responses/validationError" /markdown: post: consumes: - "application/json" produces: - "text/html" tags: - "miscellaneous" summary: "Render a markdown document as HTML" operationId: "renderMarkdown" parameters: - name: "body" in: "body" schema: $ref: "#/definitions/MarkdownOption" responses: 200: $ref: "#/responses/MarkdownRender" 422: $ref: "#/responses/validationError" /markdown/raw: post: consumes: - "text/plain" produces: - "text/html" tags: - "miscellaneous" summary: "Render raw markdown as HTML" operationId: "renderMarkdownRaw" parameters: - description: "Request body to render" name: "body" in: "body" required: true schema: type: "string" responses: 200: $ref: "#/responses/MarkdownRender" 422: $ref: "#/responses/validationError" /org/{org}/repos: post: consumes: - "application/json" produces: - "application/json" tags: - "organization" summary: "Create a repository in an organization" operationId: "createOrgRepo" parameters: - type: "string" description: "name of organization" name: "org" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/CreateRepoOption" responses: 201: $ref: "#/responses/Repository" 403: $ref: "#/responses/forbidden" 422: $ref: "#/responses/validationError" /orgs/{org}: get: produces: - "application/json" tags: - "organization" summary: "Get an organization" operationId: "orgGet" parameters: - type: "string" description: "name of the organization to get" name: "org" in: "path" required: true responses: 200: $ref: "#/responses/Organization" patch: consumes: - "application/json" produces: - "application/json" tags: - "organization" summary: "Edit an organization" operationId: "orgEdit" parameters: - type: "string" description: "name of the organization to edit" name: "org" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/EditOrgOption" responses: 200: $ref: "#/responses/Organization" /orgs/{org}/hooks: get: produces: - "application/json" tags: - "organization" summary: "List an organization's webhooks" operationId: "orgListHooks" parameters: - type: "string" description: "name of the organization" name: "org" in: "path" required: true responses: 200: $ref: "#/responses/HookList" /orgs/{org}/hooks/: post: consumes: - "application/json" produces: - "application/json" tags: - "organization" summary: "Create a hook" operationId: "orgCreateHook" parameters: - type: "string" description: "name of the organization" name: "org" in: "path" required: true responses: 201: $ref: "#/responses/Hook" /orgs/{org}/hooks/{id}: get: produces: - "application/json" tags: - "organization" summary: "Get a hook" operationId: "orgGetHook" parameters: - type: "string" description: "name of the organization" name: "org" in: "path" required: true - type: "integer" description: "id of the hook to get" name: "id" in: "path" required: true responses: 200: $ref: "#/responses/Hook" delete: produces: - "application/json" tags: - "organization" summary: "Delete a hook" operationId: "orgDeleteHook" parameters: - type: "string" description: "name of the organization" name: "org" in: "path" required: true - type: "integer" description: "id of the hook to delete" name: "id" in: "path" required: true responses: 204: $ref: "#/responses/empty" patch: consumes: - "application/json" produces: - "application/json" tags: - "organization" summary: "Update a hook" operationId: "orgEditHook" parameters: - type: "string" description: "name of the organization" name: "org" in: "path" required: true - type: "integer" description: "id of the hook to update" name: "id" in: "path" required: true responses: 200: $ref: "#/responses/Hook" /orgs/{org}/members: get: produces: - "application/json" tags: - "organization" summary: "List an organization's members" operationId: "orgListMembers" parameters: - type: "string" description: "name of the organization" name: "org" in: "path" required: true responses: 200: $ref: "#/responses/UserList" /orgs/{org}/members/{username}: get: tags: - "organization" summary: "Check if a user is a member of an organization" operationId: "orgIsMember" parameters: - type: "string" description: "name of the organization" name: "org" in: "path" required: true - type: "string" description: "username of the user" name: "username" in: "path" required: true responses: 204: description: "user is a member" schema: $ref: "#/responses/empty" 404: description: "user is not a member" schema: $ref: "#/responses/empty" delete: produces: - "application/json" tags: - "organization" summary: "Remove a member from an organization" operationId: "orgDeleteMember" parameters: - type: "string" description: "name of the organization" name: "org" in: "path" required: true - type: "string" description: "username of the user" name: "username" in: "path" required: true responses: 204: description: "member removed" schema: $ref: "#/responses/empty" /orgs/{org}/public_members: get: produces: - "application/json" tags: - "organization" summary: "List an organization's public members" operationId: "orgListPublicMembers" parameters: - type: "string" description: "name of the organization" name: "org" in: "path" required: true responses: 200: $ref: "#/responses/UserList" /orgs/{org}/public_members/{username}: get: tags: - "organization" summary: "Check if a user is a public member of an organization" operationId: "orgIsPublicMember" parameters: - type: "string" description: "name of the organization" name: "org" in: "path" required: true - type: "string" description: "username of the user" name: "username" in: "path" required: true responses: 204: description: "user is a public member" schema: $ref: "#/responses/empty" 404: description: "user is not a public member" schema: $ref: "#/responses/empty" put: produces: - "application/json" tags: - "organization" summary: "Publicize a user's membership" operationId: "orgPublicizeMember" parameters: - type: "string" description: "name of the organization" name: "org" in: "path" required: true - type: "string" description: "username of the user" name: "username" in: "path" required: true responses: 204: description: "membership publicized" schema: $ref: "#/responses/empty" delete: produces: - "application/json" tags: - "organization" summary: "Conceal a user's membership" operationId: "orgConcealMember" parameters: - type: "string" description: "name of the organization" name: "org" in: "path" required: true - type: "string" description: "username of the user" name: "username" in: "path" required: true responses: 204: $ref: "#/responses/empty" /orgs/{org}/repos: get: produces: - "application/json" tags: - "organization" summary: "List an organization's repos" operationId: "orgListRepos" parameters: - type: "string" description: "name of the organization" name: "org" in: "path" required: true responses: 200: $ref: "#/responses/RepositoryList" /orgs/{org}/teams: get: produces: - "application/json" tags: - "organization" summary: "List an organization's teams" operationId: "orgListTeams" parameters: - type: "string" description: "name of the organization" name: "org" in: "path" required: true responses: 200: $ref: "#/responses/TeamList" post: consumes: - "application/json" produces: - "application/json" tags: - "organization" summary: "Create a team" operationId: "orgCreateTeam" parameters: - type: "string" description: "name of the organization" name: "org" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/CreateTeamOption" responses: 201: $ref: "#/responses/Team" /repos/migrate: post: consumes: - "application/json" produces: - "application/json" tags: - "repository" summary: "Migrate a remote git repository" operationId: "repoMigrate" parameters: - name: "body" in: "body" schema: $ref: "#/definitions/MigrateRepoForm" responses: 201: $ref: "#/responses/Repository" /repos/search: get: produces: - "application/json" tags: - "repository" summary: "Search for repositories" operationId: "repoSearch" parameters: - type: "string" description: "keyword" name: "q" in: "query" - type: "integer" description: "search only for repos that the user with the given id owns or contributes to" name: "uid" in: "query" - type: "integer" description: "page number of results to return (1-based)" name: "page" in: "query" - type: "integer" description: "page size of results, maximum page size is 50" name: "limit" in: "query" - type: "string" description: "type of repository to search for. Supported values are \"fork\", \"source\", \"mirror\" and \"collaborative\"" name: "mode" in: "query" - type: "boolean" description: "if `uid` is given, search only for repos that the user owns" name: "exclusive" in: "query" responses: 200: $ref: "#/responses/SearchResults" 422: $ref: "#/responses/validationError" /repos/{owner}/{repo}: get: produces: - "application/json" tags: - "repository" summary: "Get a repository" operationId: "repoGet" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true responses: 200: $ref: "#/responses/Repository" delete: produces: - "application/json" tags: - "repository" summary: "Delete a repository" operationId: "repoDelete" parameters: - type: "string" description: "owner of the repo to delete" name: "owner" in: "path" required: true - type: "string" description: "name of the repo to delete" name: "repo" in: "path" required: true responses: 204: $ref: "#/responses/empty" 403: $ref: "#/responses/forbidden" /repos/{owner}/{repo}/archive/{archive}: get: produces: - "application/json" tags: - "repository" summary: "Get an archive of a repository" operationId: "repoGetArchive" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "string" description: "archive to download, consisting of a git reference and archive" name: "archive" in: "path" required: true responses: 200: description: "success" /repos/{owner}/{repo}/branches: get: produces: - "application/json" tags: - "repository" summary: "List a repository's branches" operationId: "repoListBranches" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true responses: 200: $ref: "#/responses/BranchList" /repos/{owner}/{repo}/branches/{branch}: get: produces: - "application/json" tags: - "repository" summary: "List a repository's branches" operationId: "repoGetBranch" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "string" description: "branch to get" name: "branch" in: "path" required: true responses: 200: $ref: "#/responses/Branch" /repos/{owner}/{repo}/collaborators: get: produces: - "application/json" tags: - "repository" summary: "List a repository's collaborators" operationId: "repoListCollaborators" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true responses: 200: $ref: "#/responses/UserList" /repos/{owner}/{repo}/collaborators/{collaborator}: get: produces: - "application/json" tags: - "repository" summary: "Check if a user is a collaborator of a repository" operationId: "repoCheckCollaborator" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "string" description: "username of the collaborator" name: "collaborator" in: "path" required: true responses: 204: $ref: "#/responses/empty" 404: $ref: "#/responses/empty" put: produces: - "application/json" tags: - "repository" summary: "Add a collaborator to a repository" operationId: "repoAddCollaborator" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "string" description: "username of the collaborator to add" name: "collaborator" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/AddCollaboratorOption" responses: 204: $ref: "#/responses/empty" delete: produces: - "application/json" tags: - "repository" summary: "Delete a collaborator from a repository" operationId: "repoDeleteCollaborator" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "string" description: "username of the collaborator to delete" name: "collaborator" in: "path" required: true responses: 204: $ref: "#/responses/empty" /repos/{owner}/{repo}/commits/{ref}/statuses: get: produces: - "application/json" tags: - "repository" summary: "Get a commit's combined status, by branch/tag/commit reference" operationId: "repoGetCombinedStatusByRef" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "string" description: "name of branch/tag/commit" name: "ref" in: "path" required: true responses: 200: $ref: "#/responses/Status" /repos/{owner}/{repo}/editorconfig/{filepath}: get: produces: - "application/json" tags: - "repository" summary: "Get the EditorConfig definitions of a file in a repository" operationId: "repoGetEditorConfig" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "string" description: "filepath of file to get" name: "filepath" in: "path" required: true responses: 200: description: "success" /repos/{owner}/{repo}/forks: get: produces: - "application/json" tags: - "repository" summary: "List a repository's forks" operationId: "listForks" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true responses: 200: $ref: "#/responses/RepositoryList" post: produces: - "application/json" tags: - "repository" summary: "Fork a repository" operationId: "createFork" parameters: - type: "string" description: "owner of the repo to fork" name: "owner" in: "path" required: true - type: "string" description: "name of the repo to fork" name: "repo" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/CreateForkOption" responses: 202: $ref: "#/responses/Repository" /repos/{owner}/{repo}/hooks: get: produces: - "application/json" tags: - "repository" summary: "List the hooks in a repository" operationId: "repoListHooks" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true responses: 200: $ref: "#/responses/HookList" post: consumes: - "application/json" produces: - "application/json" tags: - "repository" summary: "Create a hook" operationId: "repoCreateHook" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/CreateHookOption" responses: 201: $ref: "#/responses/Hook" /repos/{owner}/{repo}/hooks/{id}: get: produces: - "application/json" tags: - "repository" summary: "Get a hook" operationId: "repoGetHook" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "id of the hook to get" name: "id" in: "path" required: true responses: 200: $ref: "#/responses/Hook" delete: produces: - "application/json" tags: - "repository" summary: "Delete a hook in a repository" operationId: "repoDeleteHook" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "id of the hook to delete" name: "id" in: "path" required: true responses: 204: $ref: "#/responses/empty" 404: $ref: "#/responses/notFound" patch: produces: - "application/json" tags: - "repository" summary: "Edit a hook in a repository" operationId: "repoEditHook" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "index of the hook" name: "id" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/EditHookOption" responses: 200: $ref: "#/responses/Hook" /repos/{owner}/{repo}/hooks/{id}/tests: post: produces: - "application/json" tags: - "repository" summary: "Test a push webhook" operationId: "repoTestHook" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "id of the hook to test" name: "id" in: "path" required: true responses: 204: $ref: "#/responses/empty" /repos/{owner}/{repo}/issues: get: produces: - "application/json" tags: - "issue" summary: "List a repository's issues" operationId: "issueListIssues" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "string" description: "whether issue is open or closed" name: "state" in: "query" - type: "integer" description: "page number of requested issues" name: "page" in: "query" - type: "string" description: "search string" name: "q" in: "query" responses: 200: $ref: "#/responses/IssueList" post: consumes: - "application/json" produces: - "application/json" tags: - "issue" summary: "Create an issue" operationId: "issueCreateIssue" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/CreateIssueOption" responses: 201: $ref: "#/responses/Issue" /repos/{owner}/{repo}/issues/comments: get: produces: - "application/json" tags: - "issue" summary: "List all comments in a repository" operationId: "issueGetRepoComments" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "string" description: "if provided, only comments updated since the provided time are returned." name: "since" in: "query" responses: 200: $ref: "#/responses/CommentList" /repos/{owner}/{repo}/issues/comments/{id}: delete: tags: - "issue" summary: "Delete a comment" operationId: "issueDeleteComment" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "id of comment to delete" name: "id" in: "path" required: true responses: 204: $ref: "#/responses/empty" patch: consumes: - "application/json" produces: - "application/json" tags: - "issue" summary: "Edit a comment" operationId: "issueEditComment" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "id of the comment to edit" name: "id" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/EditIssueCommentOption" responses: 200: $ref: "#/responses/Comment" /repos/{owner}/{repo}/issues/{id}/times: get: produces: - "application/json" tags: - "issue" summary: "List an issue's tracked times" operationId: "issueTrackedTimes" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "index of the issue" name: "id" in: "path" required: true responses: 200: $ref: "#/responses/TrackedTimeList" post: consumes: - "application/json" produces: - "application/json" tags: - "issue" summary: "Add a tracked time to a issue" operationId: "issueAddTime" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "index of the issue to add tracked time to" name: "id" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/AddTimeOption" responses: 200: $ref: "#/responses/TrackedTime" 400: $ref: "#/responses/error" 403: $ref: "#/responses/error" /repos/{owner}/{repo}/issues/{index}: get: produces: - "application/json" tags: - "issue" summary: "Get an issue" operationId: "issueGetIssue" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "index of the issue to get" name: "index" in: "path" required: true responses: 200: $ref: "#/responses/Issue" patch: consumes: - "application/json" produces: - "application/json" tags: - "issue" summary: "Edit an issue" operationId: "issueEditIssue" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "index of the issue to edit" name: "index" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/EditIssueOption" responses: 201: $ref: "#/responses/Issue" /repos/{owner}/{repo}/issues/{index}/comments: get: produces: - "application/json" tags: - "issue" summary: "List all comments on an issue" operationId: "issueGetComments" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "index of the issue" name: "index" in: "path" required: true - type: "string" description: "if provided, only comments updated since the specified time are returned." name: "since" in: "query" responses: 200: $ref: "#/responses/CommentList" post: consumes: - "application/json" produces: - "application/json" tags: - "issue" summary: "Add a comment to an issue" operationId: "issueCreateComment" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "index of the issue" name: "index" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/CreateIssueCommentOption" responses: 201: $ref: "#/responses/Comment" /repos/{owner}/{repo}/issues/{index}/comments/{id}: delete: tags: - "issue" summary: "Delete a comment" operationId: "issueDeleteCommentDeprecated" deprecated: true parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "this parameter is ignored" name: "index" in: "path" required: true - type: "integer" description: "id of comment to delete" name: "id" in: "path" required: true responses: 204: $ref: "#/responses/empty" patch: consumes: - "application/json" produces: - "application/json" tags: - "issue" summary: "Edit a comment" operationId: "issueEditCommentDeprecated" deprecated: true parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "this parameter is ignored" name: "index" in: "path" required: true - type: "integer" description: "id of the comment to edit" name: "id" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/EditIssueCommentOption" responses: 200: $ref: "#/responses/Comment" /repos/{owner}/{repo}/issues/{index}/deadline: post: consumes: - "application/json" produces: - "application/json" tags: - "issue" summary: "Set an issue deadline. If set to null, the deadline is deleted." operationId: "issueEditIssueDeadline" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "index of the issue to create or update a deadline on" name: "index" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/EditDeadlineOption" responses: 201: $ref: "#/responses/IssueDeadline" 403: description: "Not repo writer" schema: $ref: "#/responses/forbidden" 404: description: "Issue not found" schema: $ref: "#/responses/empty" /repos/{owner}/{repo}/issues/{index}/labels: get: produces: - "application/json" tags: - "issue" summary: "Get an issue's labels" operationId: "issueGetLabels" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "index of the issue" name: "index" in: "path" required: true responses: 200: $ref: "#/responses/LabelList" 404: $ref: "#/responses/notFound" put: consumes: - "application/json" produces: - "application/json" tags: - "issue" summary: "Replace an issue's labels" operationId: "issueReplaceLabels" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "index of the issue" name: "index" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/IssueLabelsOption" responses: 200: $ref: "#/responses/LabelList" post: consumes: - "application/json" produces: - "application/json" tags: - "issue" summary: "Add a label to an issue" operationId: "issueAddLabel" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "index of the issue" name: "index" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/IssueLabelsOption" responses: 200: $ref: "#/responses/LabelList" delete: produces: - "application/json" tags: - "issue" summary: "Remove all labels from an issue" operationId: "issueClearLabels" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "index of the issue" name: "index" in: "path" required: true responses: 204: $ref: "#/responses/empty" /repos/{owner}/{repo}/issues/{index}/labels/{id}: delete: produces: - "application/json" tags: - "issue" summary: "Remove a label from an issue" operationId: "issueRemoveLabel" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "index of the issue" name: "index" in: "path" required: true - type: "integer" description: "id of the label to remove" name: "id" in: "path" required: true responses: 204: $ref: "#/responses/empty" /repos/{owner}/{repo}/keys: get: produces: - "application/json" tags: - "repository" summary: "List a repository's keys" operationId: "repoListKeys" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true responses: 200: $ref: "#/responses/DeployKeyList" post: consumes: - "application/json" produces: - "application/json" tags: - "repository" summary: "Add a key to a repository" operationId: "repoCreateKey" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/CreateKeyOption" responses: 201: $ref: "#/responses/DeployKey" /repos/{owner}/{repo}/keys/{id}: get: produces: - "application/json" tags: - "repository" summary: "Get a repository's key by id" operationId: "repoGetKey" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "id of the key to get" name: "id" in: "path" required: true responses: 200: $ref: "#/responses/DeployKey" delete: tags: - "repository" summary: "Delete a key from a repository" operationId: "repoDeleteKey" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "id of the key to delete" name: "id" in: "path" required: true responses: 204: $ref: "#/responses/empty" /repos/{owner}/{repo}/labels: get: produces: - "application/json" tags: - "issue" summary: "Get all of a repository's labels" operationId: "issueListLabels" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true responses: 200: $ref: "#/responses/LabelList" post: consumes: - "application/json" produces: - "application/json" tags: - "issue" summary: "Create a label" operationId: "issueCreateLabel" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/CreateLabelOption" responses: 201: $ref: "#/responses/Label" /repos/{owner}/{repo}/labels/{id}: get: produces: - "application/json" tags: - "issue" summary: "Get a single label" operationId: "issueGetLabel" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "id of the label to get" name: "id" in: "path" required: true responses: 200: $ref: "#/responses/Label" delete: tags: - "issue" summary: "Delete a label" operationId: "issueDeleteLabel" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "id of the label to delete" name: "id" in: "path" required: true responses: 204: $ref: "#/responses/empty" patch: consumes: - "application/json" produces: - "application/json" tags: - "issue" summary: "Update a label" operationId: "issueEditLabel" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "id of the label to edit" name: "id" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/EditLabelOption" responses: 200: $ref: "#/responses/Label" /repos/{owner}/{repo}/milestones: get: produces: - "application/json" tags: - "issue" summary: "Get all of a repository's milestones" operationId: "issueGetMilestonesList" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true responses: 200: $ref: "#/responses/MilestoneList" post: consumes: - "application/json" produces: - "application/json" tags: - "issue" summary: "Create a milestone" operationId: "issueCreateMilestone" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/CreateMilestoneOption" responses: 201: $ref: "#/responses/Milestone" /repos/{owner}/{repo}/milestones/{id}: get: produces: - "application/json" tags: - "issue" summary: "Get a milestone" operationId: "issueGetMilestone" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "id of the milestone" name: "id" in: "path" required: true responses: 200: $ref: "#/responses/Milestone" delete: tags: - "issue" summary: "Delete a milestone" operationId: "issueDeleteMilestone" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "id of the milestone to delete" name: "id" in: "path" required: true responses: 204: $ref: "#/responses/empty" patch: consumes: - "application/json" produces: - "application/json" tags: - "issue" summary: "Update a milestone" operationId: "issueEditMilestone" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "id of the milestone" name: "id" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/EditMilestoneOption" responses: 200: $ref: "#/responses/Milestone" /repos/{owner}/{repo}/mirror-sync: post: produces: - "application/json" tags: - "repository" summary: "Sync a mirrored repository" operationId: "repoMirrorSync" parameters: - type: "string" description: "owner of the repo to sync" name: "owner" in: "path" required: true - type: "string" description: "name of the repo to sync" name: "repo" in: "path" required: true responses: 200: $ref: "#/responses/empty" /repos/{owner}/{repo}/pulls: get: produces: - "application/json" tags: - "repository" summary: "List a repo's pull requests" operationId: "repoListPullRequests" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true responses: 200: $ref: "#/responses/PullRequestList" post: consumes: - "application/json" produces: - "application/json" tags: - "repository" summary: "Create a pull request" operationId: "repoCreatePullRequest" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/CreatePullRequestOption" responses: 201: $ref: "#/responses/PullRequest" /repos/{owner}/{repo}/pulls/{index}: get: produces: - "application/json" tags: - "repository" summary: "Get a pull request" operationId: "repoGetPullRequest" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "index of the pull request to get" name: "index" in: "path" required: true responses: 200: $ref: "#/responses/PullRequest" patch: consumes: - "application/json" produces: - "application/json" tags: - "repository" summary: "Update a pull request" operationId: "repoEditPullRequest" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "index of the pull request to edit" name: "index" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/EditPullRequestOption" responses: 201: $ref: "#/responses/PullRequest" /repos/{owner}/{repo}/pulls/{index}/merge: get: produces: - "application/json" tags: - "repository" summary: "Check if a pull request has been merged" operationId: "repoPullRequestIsMerged" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "index of the pull request" name: "index" in: "path" required: true responses: 204: description: "pull request has been merged" schema: $ref: "#/responses/empty" 404: description: "pull request has not been merged" schema: $ref: "#/responses/empty" post: produces: - "application/json" tags: - "repository" summary: "Merge a pull request" operationId: "repoMergePullRequest" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "index of the pull request to merge" name: "index" in: "path" required: true responses: 200: $ref: "#/responses/empty" 405: $ref: "#/responses/empty" /repos/{owner}/{repo}/raw/{filepath}: get: produces: - "application/json" tags: - "repository" summary: "Get a file from a repository" operationId: "repoGetRawFile" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "string" description: "filepath of the file to get" name: "filepath" in: "path" required: true responses: 200: description: "success" /repos/{owner}/{repo}/releases: get: produces: - "application/json" tags: - "repository" summary: "List a repo's releases" operationId: "repoListReleases" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true responses: 200: $ref: "#/responses/ReleaseList" post: consumes: - "application/json" produces: - "application/json" tags: - "repository" summary: "Create a release" operationId: "repoCreateRelease" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/CreateReleaseOption" responses: 201: $ref: "#/responses/Release" /repos/{owner}/{repo}/releases/{id}: get: produces: - "application/json" tags: - "repository" summary: "Get a release" operationId: "repoGetRelease" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "id of the release to get" name: "id" in: "path" required: true responses: 200: $ref: "#/responses/Release" delete: tags: - "repository" summary: "Delete a release" operationId: "repoDeleteRelease" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "id of the release to delete" name: "id" in: "path" required: true responses: 204: $ref: "#/responses/empty" patch: consumes: - "application/json" produces: - "application/json" tags: - "repository" summary: "Update a release" operationId: "repoEditRelease" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "id of the release to edit" name: "id" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/EditReleaseOption" responses: 200: $ref: "#/responses/Release" /repos/{owner}/{repo}/releases/{id}/assets: get: produces: - "application/json" tags: - "repository" summary: "List release's attachments" operationId: "repoListReleaseAttachments" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "id of the release" name: "id" in: "path" required: true responses: 200: $ref: "#/responses/AttachmentList" post: consumes: - "multipart/form-data" produces: - "application/json" tags: - "repository" summary: "Create a release attachment" operationId: "repoCreateReleaseAttachment" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "id of the release" name: "id" in: "path" required: true - type: "string" description: "name of the attachment" name: "name" in: "query" - type: "file" description: "attachment to upload" name: "attachment" in: "formData" required: true responses: 201: $ref: "#/responses/Attachment" /repos/{owner}/{repo}/releases/{id}/assets/{attachment_id}: get: produces: - "application/json" tags: - "repository" summary: "Get a release attachment" operationId: "repoGetReleaseAttachment" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "id of the release" name: "id" in: "path" required: true - type: "integer" description: "id of the attachment to get" name: "attachment_id" in: "path" required: true responses: 200: $ref: "#/responses/Attachment" delete: produces: - "application/json" tags: - "repository" summary: "Delete a release attachment" operationId: "repoDeleteReleaseAttachment" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "id of the release" name: "id" in: "path" required: true - type: "integer" description: "id of the attachment to delete" name: "attachment_id" in: "path" required: true responses: 204: $ref: "#/responses/empty" patch: consumes: - "application/json" produces: - "application/json" tags: - "repository" summary: "Edit a release attachment" operationId: "repoEditReleaseAttachment" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "integer" description: "id of the release" name: "id" in: "path" required: true - type: "integer" description: "id of the attachment to edit" name: "attachment_id" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/EditAttachmentOptions" responses: 201: $ref: "#/responses/Attachment" /repos/{owner}/{repo}/stargazers: get: produces: - "application/json" tags: - "repository" summary: "List a repo's stargazers" operationId: "repoListStargazers" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true responses: 200: $ref: "#/responses/UserList" /repos/{owner}/{repo}/statuses/{sha}: get: produces: - "application/json" tags: - "repository" summary: "Get a commit's statuses" operationId: "repoListStatuses" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "string" description: "sha of the commit" name: "sha" in: "path" required: true responses: 200: $ref: "#/responses/StatusList" post: produces: - "application/json" tags: - "repository" summary: "Create a commit status" operationId: "repoCreateStatus" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "string" description: "sha of the commit" name: "sha" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/CreateStatusOption" responses: 200: $ref: "#/responses/StatusList" /repos/{owner}/{repo}/subscribers: get: produces: - "application/json" tags: - "repository" summary: "List a repo's watchers" operationId: "repoListSubscribers" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true responses: 200: $ref: "#/responses/UserList" /repos/{owner}/{repo}/subscription: get: tags: - "repository" summary: "Check if the current user is watching a repo" operationId: "userCurrentCheckSubscription" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true responses: 200: $ref: "#/responses/WatchInfo" put: tags: - "repository" summary: "Watch a repo" operationId: "userCurrentPutSubscription" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true responses: 200: $ref: "#/responses/WatchInfo" delete: tags: - "repository" summary: "Unwatch a repo" operationId: "userCurrentDeleteSubscription" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true responses: 204: $ref: "#/responses/empty" /repos/{owner}/{repo}/times: get: produces: - "application/json" tags: - "repository" summary: "List a repo's tracked times" operationId: "repoTrackedTimes" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true responses: 200: $ref: "#/responses/TrackedTimeList" /repos/{owner}/{repo}/times/{user}: get: produces: - "application/json" tags: - "user" summary: "List a user's tracked times in a repo" operationId: "userTrackedTimes" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true - type: "string" description: "username of user" name: "user" in: "path" required: true responses: 200: $ref: "#/responses/TrackedTimeList" /repositories/{id}: get: produces: - "application/json" tags: - "repository" summary: "Get a repository by id" operationId: "repoGetByID" parameters: - type: "integer" description: "id of the repo to get" name: "id" in: "path" required: true responses: 200: $ref: "#/responses/Repository" /teams/{id}: get: produces: - "application/json" tags: - "organization" summary: "Get a team" operationId: "orgGetTeam" parameters: - type: "integer" description: "id of the team to get" name: "id" in: "path" required: true responses: 200: $ref: "#/responses/Team" delete: tags: - "organization" summary: "Delete a team" operationId: "orgDeleteTeam" parameters: - type: "integer" description: "id of the team to delete" name: "id" in: "path" required: true responses: 204: description: "team deleted" schema: $ref: "#/responses/empty" patch: consumes: - "application/json" produces: - "application/json" tags: - "organization" summary: "Edit a team" operationId: "orgEditTeam" parameters: - type: "integer" description: "id of the team to edit" name: "id" in: "path" required: true - name: "body" in: "body" schema: $ref: "#/definitions/EditTeamOption" responses: 200: $ref: "#/responses/Team" /teams/{id}/members: get: produces: - "application/json" tags: - "organization" summary: "List a team's members" operationId: "orgListTeamMembers" parameters: - type: "integer" description: "id of the team" name: "id" in: "path" required: true responses: 200: $ref: "#/responses/UserList" /teams/{id}/members/{username}: put: produces: - "application/json" tags: - "organization" summary: "Add a team member" operationId: "orgAddTeamMember" parameters: - type: "integer" description: "id of the team" name: "id" in: "path" required: true - type: "string" description: "username of the user to add" name: "username" in: "path" required: true responses: 204: $ref: "#/responses/empty" delete: produces: - "application/json" tags: - "organization" summary: "Remove a team member" operationId: "orgRemoveTeamMember" parameters: - type: "integer" description: "id of the team" name: "id" in: "path" required: true - type: "string" description: "username of the user to remove" name: "username" in: "path" required: true responses: 204: $ref: "#/responses/empty" /teams/{id}/repos: get: produces: - "application/json" tags: - "organization" summary: "List a team's repos" operationId: "orgListTeamRepos" parameters: - type: "integer" description: "id of the team" name: "id" in: "path" required: true responses: 200: $ref: "#/responses/RepositoryList" /teams/{id}/repos/{org}/{repo}: put: produces: - "application/json" tags: - "organization" summary: "Add a repository to a team" operationId: "orgAddTeamRepository" parameters: - type: "integer" description: "id of the team" name: "id" in: "path" required: true - type: "string" description: "organization that owns the repo to add" name: "org" in: "path" required: true - type: "string" description: "name of the repo to add" name: "repo" in: "path" required: true responses: 204: $ref: "#/responses/empty" delete: description: "This does not delete the repository, it only removes the repository from the team." produces: - "application/json" tags: - "organization" summary: "Remove a repository from a team" operationId: "orgRemoveTeamRepository" parameters: - type: "integer" description: "id of the team" name: "id" in: "path" required: true - type: "string" description: "organization that owns the repo to remove" name: "org" in: "path" required: true - type: "string" description: "name of the repo to remove" name: "repo" in: "path" required: true responses: 204: $ref: "#/responses/empty" /topics/search: get: produces: - "application/json" tags: - "repository" summary: "search topics via keyword" operationId: "topicSearch" parameters: - type: "string" description: "keywords to search" name: "q" in: "query" required: true responses: 200: $ref: "#/responses/Repository" /user: get: produces: - "application/json" tags: - "user" summary: "Get the authenticated user" operationId: "userGetCurrent" responses: 200: $ref: "#/responses/User" /user/emails: get: produces: - "application/json" tags: - "user" summary: "List the authenticated user's email addresses" operationId: "userListEmails" responses: 200: $ref: "#/responses/EmailList" post: produces: - "application/json" tags: - "user" summary: "Add email addresses" operationId: "userAddEmail" parameters: - name: "body" in: "body" schema: $ref: "#/definitions/CreateEmailOption" responses: 201: $ref: "#/responses/EmailList" delete: produces: - "application/json" tags: - "user" summary: "Delete email addresses" operationId: "userDeleteEmail" parameters: - name: "body" in: "body" schema: $ref: "#/definitions/DeleteEmailOption" responses: 204: $ref: "#/responses/empty" /user/followers: get: produces: - "application/json" tags: - "user" summary: "List the authenticated user's followers" operationId: "userCurrentListFollowers" responses: 200: $ref: "#/responses/UserList" /user/following: get: produces: - "application/json" tags: - "user" summary: "List the users that the authenticated user is following" operationId: "userCurrentListFollowing" responses: 200: $ref: "#/responses/UserList" /user/following/{username}: get: tags: - "user" summary: "Check whether a user is followed by the authenticated user" operationId: "userCurrentCheckFollowing" parameters: - type: "string" description: "username of followed user" name: "username" in: "path" required: true responses: 204: $ref: "#/responses/empty" 404: $ref: "#/responses/notFound" put: tags: - "user" summary: "Follow a user" operationId: "userCurrentPutFollow" parameters: - type: "string" description: "username of user to follow" name: "username" in: "path" required: true responses: 204: $ref: "#/responses/empty" delete: tags: - "user" summary: "Unfollow a user" operationId: "userCurrentDeleteFollow" parameters: - type: "string" description: "username of user to unfollow" name: "username" in: "path" required: true responses: 204: $ref: "#/responses/empty" /user/gpg_keys: get: produces: - "application/json" tags: - "user" summary: "List the authenticated user's GPG keys" operationId: "userCurrentListGPGKeys" responses: 200: $ref: "#/responses/GPGKeyList" post: consumes: - "application/json" produces: - "application/json" tags: - "user" summary: "Create a GPG key" operationId: "userCurrentPostGPGKey" parameters: - name: "Form" in: "body" schema: $ref: "#/definitions/CreateGPGKeyOption" responses: 201: $ref: "#/responses/GPGKey" 422: $ref: "#/responses/validationError" /user/gpg_keys/{id}: get: produces: - "application/json" tags: - "user" summary: "Get a GPG key" operationId: "userCurrentGetGPGKey" parameters: - type: "integer" description: "id of key to get" name: "id" in: "path" required: true responses: 200: $ref: "#/responses/GPGKey" 404: $ref: "#/responses/notFound" delete: produces: - "application/json" tags: - "user" summary: "Remove a GPG key" operationId: "userCurrentDeleteGPGKey" parameters: - type: "integer" description: "id of key to delete" name: "id" in: "path" required: true responses: 204: $ref: "#/responses/empty" 403: $ref: "#/responses/forbidden" /user/keys: get: produces: - "application/json" tags: - "user" summary: "List the authenticated user's public keys" operationId: "userCurrentListKeys" responses: 200: $ref: "#/responses/PublicKeyList" post: consumes: - "application/json" produces: - "application/json" tags: - "user" summary: "Create a public key" operationId: "userCurrentPostKey" parameters: - name: "body" in: "body" schema: $ref: "#/definitions/CreateKeyOption" responses: 201: $ref: "#/responses/PublicKey" 422: $ref: "#/responses/validationError" /user/keys/{id}: get: produces: - "application/json" tags: - "user" summary: "Get a public key" operationId: "userCurrentGetKey" parameters: - type: "integer" description: "id of key to get" name: "id" in: "path" required: true responses: 200: $ref: "#/responses/PublicKey" 404: $ref: "#/responses/notFound" delete: produces: - "application/json" tags: - "user" summary: "Delete a public key" operationId: "userCurrentDeleteKey" parameters: - type: "integer" description: "id of key to delete" name: "id" in: "path" required: true responses: 204: $ref: "#/responses/empty" 403: $ref: "#/responses/forbidden" 404: $ref: "#/responses/notFound" /user/orgs: get: produces: - "application/json" tags: - "organization" summary: "List the current user's organizations" operationId: "orgListCurrentUserOrgs" responses: 200: $ref: "#/responses/OrganizationList" /user/repos: get: produces: - "application/json" tags: - "user" summary: "List the repos that the authenticated user owns or has access to" operationId: "userCurrentListRepos" responses: 200: $ref: "#/responses/RepositoryList" post: consumes: - "application/json" produces: - "application/json" tags: - "repository" - "user" summary: "Create a repository" operationId: "createCurrentUserRepo" parameters: - name: "body" in: "body" schema: $ref: "#/definitions/CreateRepoOption" responses: 201: $ref: "#/responses/Repository" /user/starred: get: produces: - "application/json" tags: - "user" summary: "The repos that the authenticated user has starred" operationId: "userCurrentListStarred" responses: 200: $ref: "#/responses/RepositoryList" /user/starred/{owner}/{repo}: get: tags: - "user" summary: "Whether the authenticated is starring the repo" operationId: "userCurrentCheckStarring" parameters: - type: "string" description: "owner of the repo" name: "owner" in: "path" required: true - type: "string" description: "name of the repo" name: "repo" in: "path" required: true responses: 204: $ref: "#/responses/empty" 404: $ref: "#/responses/notFound" put: tags: - "user" summary: "Star the given repo" operationId: "userCurrentPutStar" parameters: - type: "string" description: "owner of the repo to star" name: "owner" in: "path" required: true - type: "string" description: "name of the repo to star" name: "repo" in: "path" required: true responses: 204: $ref: "#/responses/empty" delete: tags: - "user" summary: "Unstar the given repo" operationId: "userCurrentDeleteStar" parameters: - type: "string" description: "owner of the repo to unstar" name: "owner" in: "path" required: true - type: "string" description: "name of the repo to unstar" name: "repo" in: "path" required: true responses: 204: $ref: "#/responses/empty" /user/subscriptions: get: produces: - "application/json" tags: - "user" summary: "List repositories watched by the authenticated user" operationId: "userCurrentListSubscriptions" responses: 200: $ref: "#/responses/RepositoryList" /user/times: get: produces: - "application/json" tags: - "user" summary: "List the current user's tracked times" operationId: "userCurrentTrackedTimes" responses: 200: $ref: "#/responses/TrackedTimeList" /user/{username}/orgs: get: produces: - "application/json" tags: - "organization" summary: "List a user's organizations" operationId: "orgListUserOrgs" parameters: - type: "string" description: "username of user" name: "username" in: "path" required: true responses: 200: $ref: "#/responses/OrganizationList" /users/search: get: produces: - "application/json" tags: - "user" summary: "Search for users" operationId: "userSearch" parameters: - type: "string" description: "keyword" name: "q" in: "query" - type: "integer" description: "maximum number of users to return" name: "limit" in: "query" responses: 200: $ref: "#/responses/UserList" /users/{follower}/following/{followee}: get: tags: - "user" summary: "Check if one user is following another user" operationId: "userCheckFollowing" parameters: - type: "string" description: "username of following user" name: "follower" in: "path" required: true - type: "string" description: "username of followed user" name: "followee" in: "path" required: true responses: 204: $ref: "#/responses/empty" 404: $ref: "#/responses/notFound" /users/{username}: get: produces: - "application/json" tags: - "user" summary: "Get a user" operationId: "userGet" parameters: - type: "string" description: "username of user to get" name: "username" in: "path" required: true responses: 200: $ref: "#/responses/User" 404: $ref: "#/responses/notFound" /users/{username}/followers: get: produces: - "application/json" tags: - "user" summary: "List the given user's followers" operationId: "userListFollowers" parameters: - type: "string" description: "username of user" name: "username" in: "path" required: true responses: 200: $ref: "#/responses/UserList" /users/{username}/following: get: produces: - "application/json" tags: - "user" summary: "List the users that the given user is following" operationId: "userListFollowing" parameters: - type: "string" description: "username of user" name: "username" in: "path" required: true responses: 200: $ref: "#/responses/UserList" /users/{username}/gpg_keys: get: produces: - "application/json" tags: - "user" summary: "List the given user's GPG keys" operationId: "userListGPGKeys" parameters: - type: "string" description: "username of user" name: "username" in: "path" required: true responses: 200: $ref: "#/responses/GPGKeyList" /users/{username}/keys: get: produces: - "application/json" tags: - "user" summary: "List the given user's public keys" operationId: "userListKeys" parameters: - type: "string" description: "username of user" name: "username" in: "path" required: true responses: 200: $ref: "#/responses/PublicKeyList" /users/{username}/repos: get: produces: - "application/json" tags: - "user" summary: "List the repos owned by the given user" operationId: "userListRepos" parameters: - type: "string" description: "username of user" name: "username" in: "path" required: true responses: 200: $ref: "#/responses/RepositoryList" /users/{username}/starred: get: produces: - "application/json" tags: - "user" summary: "The repos that the given user has starred" operationId: "userListStarred" parameters: - type: "string" description: "username of user" name: "username" in: "path" required: true responses: 200: $ref: "#/responses/RepositoryList" /users/{username}/subscriptions: get: produces: - "application/json" tags: - "user" summary: "List the repositories watched by a user" operationId: "userListSubscriptions" parameters: - type: "string" description: "username of the user" name: "username" in: "path" required: true responses: 200: $ref: "#/responses/RepositoryList" /users/{username}/tokens: get: produces: - "application/json" tags: - "user" summary: "List the authenticated user's access tokens" operationId: "userGetTokens" parameters: - type: "string" description: "username of user" name: "username" in: "path" required: true responses: 200: $ref: "#/responses/AccessTokenList" post: consumes: - "application/json" produces: - "application/json" tags: - "user" summary: "Create an access token" operationId: "userCreateToken" parameters: - type: "string" x-go-name: "Name" description: "username of user" name: "username" in: "path" required: true responses: 200: $ref: "#/responses/AccessToken" /users/{username}/tokens/{token}: delete: produces: - "application/json" tags: - "user" summary: "delete an access token" operationId: "userDeleteAccessToken" parameters: - type: "string" description: "username of user" name: "username" in: "path" required: true - type: "integer" description: "token to be deleted" name: "token" in: "path" required: true responses: 204: $ref: "#/responses/empty" /version: get: produces: - "application/json" tags: - "miscellaneous" summary: "Returns the version of the Gitea application" operationId: "getVersion" responses: 200: $ref: "#/responses/ServerVersion" definitions: AddCollaboratorOption: description: "AddCollaboratorOption options when adding a user as a collaborator of a repository" type: "object" properties: permission: type: "string" x-go-name: "Permission" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" AddTimeOption: description: "AddTimeOption options for adding time to an issue" type: "object" required: - "time" properties: time: description: "time in seconds" type: "integer" format: "int64" x-go-name: "Time" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" Attachment: description: "Attachment a generic attachment" type: "object" properties: browser_download_url: type: "string" x-go-name: "DownloadURL" created_at: type: "string" format: "date-time" x-go-name: "Created" download_count: type: "integer" format: "int64" x-go-name: "DownloadCount" id: type: "integer" format: "int64" x-go-name: "ID" name: type: "string" x-go-name: "Name" size: type: "integer" format: "int64" x-go-name: "Size" uuid: type: "string" x-go-name: "UUID" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" Branch: description: "Branch represents a repository branch" type: "object" properties: commit: $ref: "#/definitions/PayloadCommit" name: type: "string" x-go-name: "Name" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" Comment: description: "Comment represents a comment on a commit or issue" type: "object" properties: body: type: "string" x-go-name: "Body" created_at: type: "string" format: "date-time" x-go-name: "Created" html_url: type: "string" x-go-name: "HTMLURL" id: type: "integer" format: "int64" x-go-name: "ID" issue_url: type: "string" x-go-name: "IssueURL" pull_request_url: type: "string" x-go-name: "PRURL" updated_at: type: "string" format: "date-time" x-go-name: "Updated" user: $ref: "#/definitions/User" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" CreateEmailOption: description: "CreateEmailOption options when creating email addresses" type: "object" properties: emails: description: "email addresses to add" type: "array" items: type: "string" x-go-name: "Emails" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" CreateForkOption: description: "CreateForkOption options for creating a fork" type: "object" properties: organization: description: "organization name, if forking into an organization" type: "string" x-go-name: "Organization" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" CreateGPGKeyOption: description: "CreateGPGKeyOption options create user GPG key" type: "object" required: - "armored_public_key" properties: armored_public_key: description: "An armored GPG key to add" type: "string" uniqueItems: true x-go-name: "ArmoredKey" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" CreateHookOption: description: "CreateHookOption options when create a hook" type: "object" required: - "type" - "config" properties: active: type: "boolean" default: false x-go-name: "Active" config: type: "object" additionalProperties: type: "string" x-go-name: "Config" events: type: "array" items: type: "string" x-go-name: "Events" type: type: "string" enum: - "gitea" - "gogs" - "slack" - "discord" x-go-name: "Type" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" CreateIssueCommentOption: description: "CreateIssueCommentOption options for creating a comment on an issue" type: "object" required: - "body" properties: body: type: "string" x-go-name: "Body" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" CreateIssueOption: description: "CreateIssueOption options to create one issue" type: "object" required: - "title" properties: assignee: description: "username of assignee" type: "string" x-go-name: "Assignee" assignees: type: "array" items: type: "string" x-go-name: "Assignees" body: type: "string" x-go-name: "Body" closed: type: "boolean" x-go-name: "Closed" due_date: type: "string" format: "date-time" x-go-name: "Deadline" labels: description: "list of label ids" type: "array" items: type: "integer" format: "int64" x-go-name: "Labels" milestone: description: "milestone id" type: "integer" format: "int64" x-go-name: "Milestone" title: type: "string" x-go-name: "Title" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" CreateKeyOption: description: "CreateKeyOption options when creating a key" type: "object" required: - "title" - "key" properties: key: description: "An armored SSH key to add" type: "string" uniqueItems: true x-go-name: "Key" read_only: description: "Describe if the key has only read access or read/write" type: "boolean" x-go-name: "ReadOnly" title: description: "Title of the key to add" type: "string" uniqueItems: true x-go-name: "Title" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" CreateLabelOption: description: "CreateLabelOption options for creating a label" type: "object" required: - "name" - "color" properties: color: type: "string" x-go-name: "Color" example: "#00aabb" name: type: "string" x-go-name: "Name" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" CreateMilestoneOption: description: "CreateMilestoneOption options for creating a milestone" type: "object" properties: description: type: "string" x-go-name: "Description" due_on: type: "string" format: "date-time" x-go-name: "Deadline" title: type: "string" x-go-name: "Title" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" CreateOrgOption: description: "CreateOrgOption options for creating an organization" type: "object" required: - "username" properties: description: type: "string" x-go-name: "Description" full_name: type: "string" x-go-name: "FullName" location: type: "string" x-go-name: "Location" username: type: "string" x-go-name: "UserName" website: type: "string" x-go-name: "Website" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" CreatePullRequestOption: description: "CreatePullRequestOption options when creating a pull request" type: "object" properties: assignee: type: "string" x-go-name: "Assignee" assignees: type: "array" items: type: "string" x-go-name: "Assignees" base: type: "string" x-go-name: "Base" body: type: "string" x-go-name: "Body" due_date: type: "string" format: "date-time" x-go-name: "Deadline" head: type: "string" x-go-name: "Head" labels: type: "array" items: type: "integer" format: "int64" x-go-name: "Labels" milestone: type: "integer" format: "int64" x-go-name: "Milestone" title: type: "string" x-go-name: "Title" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" CreateReleaseOption: description: "CreateReleaseOption options when creating a release" type: "object" required: - "tag_name" properties: body: type: "string" x-go-name: "Note" draft: type: "boolean" x-go-name: "IsDraft" name: type: "string" x-go-name: "Title" prerelease: type: "boolean" x-go-name: "IsPrerelease" tag_name: type: "string" x-go-name: "TagName" target_commitish: type: "string" x-go-name: "Target" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" CreateRepoOption: description: "CreateRepoOption options when creating repository" type: "object" required: - "name" properties: auto_init: description: "Whether the repository should be auto-intialized?" type: "boolean" x-go-name: "AutoInit" description: description: "Description of the repository to create" type: "string" x-go-name: "Description" gitignores: description: "Gitignores to use" type: "string" x-go-name: "Gitignores" license: description: "License to use" type: "string" x-go-name: "License" name: description: "Name of the repository to create" type: "string" uniqueItems: true x-go-name: "Name" private: description: "Whether the repository is private" type: "boolean" x-go-name: "Private" readme: description: "Readme of the repository to create" type: "string" x-go-name: "Readme" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" CreateStatusOption: description: "CreateStatusOption holds the information needed to create a new Status for a Commit" type: "object" properties: context: type: "string" x-go-name: "Context" description: type: "string" x-go-name: "Description" state: $ref: "#/definitions/StatusState" target_url: type: "string" x-go-name: "TargetURL" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" CreateTeamOption: description: "CreateTeamOption options for creating a team" type: "object" required: - "name" properties: description: type: "string" x-go-name: "Description" name: type: "string" x-go-name: "Name" permission: type: "string" enum: - "read" - "write" - "admin" x-go-name: "Permission" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" CreateUserOption: description: "CreateUserOption create user options" type: "object" required: - "username" - "email" - "password" properties: email: type: "string" format: "email" x-go-name: "Email" full_name: type: "string" x-go-name: "FullName" login_name: type: "string" x-go-name: "LoginName" password: type: "string" x-go-name: "Password" send_notify: type: "boolean" x-go-name: "SendNotify" source_id: type: "integer" format: "int64" x-go-name: "SourceID" username: type: "string" x-go-name: "Username" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" DeleteEmailOption: description: "DeleteEmailOption options when deleting email addresses" type: "object" properties: emails: description: "email addresses to delete" type: "array" items: type: "string" x-go-name: "Emails" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" DeployKey: description: "DeployKey a deploy key" type: "object" properties: created_at: type: "string" format: "date-time" x-go-name: "Created" id: type: "integer" format: "int64" x-go-name: "ID" key: type: "string" x-go-name: "Key" read_only: type: "boolean" x-go-name: "ReadOnly" title: type: "string" x-go-name: "Title" url: type: "string" x-go-name: "URL" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" EditAttachmentOptions: description: "EditAttachmentOptions options for editing attachments" type: "object" properties: name: type: "string" x-go-name: "Name" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" EditDeadlineOption: description: "EditDeadlineOption options for creating a deadline" type: "object" required: - "due_date" properties: due_date: type: "string" format: "date-time" x-go-name: "Deadline" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" EditHookOption: description: "EditHookOption options when modify one hook" type: "object" properties: active: type: "boolean" x-go-name: "Active" config: type: "object" additionalProperties: type: "string" x-go-name: "Config" events: type: "array" items: type: "string" x-go-name: "Events" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" EditIssueCommentOption: description: "EditIssueCommentOption options for editing a comment" type: "object" required: - "body" properties: body: type: "string" x-go-name: "Body" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" EditIssueOption: description: "EditIssueOption options for editing an issue" type: "object" properties: assignee: type: "string" x-go-name: "Assignee" assignees: type: "array" items: type: "string" x-go-name: "Assignees" body: type: "string" x-go-name: "Body" due_date: type: "string" format: "date-time" x-go-name: "Deadline" milestone: type: "integer" format: "int64" x-go-name: "Milestone" state: type: "string" x-go-name: "State" title: type: "string" x-go-name: "Title" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" EditLabelOption: description: "EditLabelOption options for editing a label" type: "object" properties: color: type: "string" x-go-name: "Color" name: type: "string" x-go-name: "Name" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" EditMilestoneOption: description: "EditMilestoneOption options for editing a milestone" type: "object" properties: description: type: "string" x-go-name: "Description" due_on: type: "string" format: "date-time" x-go-name: "Deadline" state: type: "string" x-go-name: "State" title: type: "string" x-go-name: "Title" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" EditOrgOption: description: "EditOrgOption options for editing an organization" type: "object" properties: description: type: "string" x-go-name: "Description" full_name: type: "string" x-go-name: "FullName" location: type: "string" x-go-name: "Location" website: type: "string" x-go-name: "Website" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" EditPullRequestOption: description: "EditPullRequestOption options when modify pull request" type: "object" properties: assignee: type: "string" x-go-name: "Assignee" assignees: type: "array" items: type: "string" x-go-name: "Assignees" body: type: "string" x-go-name: "Body" due_date: type: "string" format: "date-time" x-go-name: "Deadline" labels: type: "array" items: type: "integer" format: "int64" x-go-name: "Labels" milestone: type: "integer" format: "int64" x-go-name: "Milestone" state: type: "string" x-go-name: "State" title: type: "string" x-go-name: "Title" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" EditReleaseOption: description: "EditReleaseOption options when editing a release" type: "object" properties: body: type: "string" x-go-name: "Note" draft: type: "boolean" x-go-name: "IsDraft" name: type: "string" x-go-name: "Title" prerelease: type: "boolean" x-go-name: "IsPrerelease" tag_name: type: "string" x-go-name: "TagName" target_commitish: type: "string" x-go-name: "Target" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" EditTeamOption: description: "EditTeamOption options for editing a team" type: "object" required: - "name" properties: description: type: "string" x-go-name: "Description" name: type: "string" x-go-name: "Name" permission: type: "string" enum: - "read" - "write" - "admin" x-go-name: "Permission" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" EditUserOption: description: "EditUserOption edit user options" type: "object" required: - "email" properties: active: type: "boolean" x-go-name: "Active" admin: type: "boolean" x-go-name: "Admin" allow_git_hook: type: "boolean" x-go-name: "AllowGitHook" allow_import_local: type: "boolean" x-go-name: "AllowImportLocal" email: type: "string" format: "email" x-go-name: "Email" full_name: type: "string" x-go-name: "FullName" location: type: "string" x-go-name: "Location" login_name: type: "string" x-go-name: "LoginName" max_repo_creation: type: "integer" format: "int64" x-go-name: "MaxRepoCreation" password: type: "string" x-go-name: "Password" source_id: type: "integer" format: "int64" x-go-name: "SourceID" website: type: "string" x-go-name: "Website" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" Email: description: "Email an email address belonging to a user" type: "object" properties: email: type: "string" format: "email" x-go-name: "Email" primary: type: "boolean" x-go-name: "Primary" verified: type: "boolean" x-go-name: "Verified" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" GPGKey: description: "GPGKey a user GPG key to sign commit and tag in repository" type: "object" properties: can_certify: type: "boolean" x-go-name: "CanCertify" can_encrypt_comms: type: "boolean" x-go-name: "CanEncryptComms" can_encrypt_storage: type: "boolean" x-go-name: "CanEncryptStorage" can_sign: type: "boolean" x-go-name: "CanSign" created_at: type: "string" format: "date-time" x-go-name: "Created" emails: type: "array" items: $ref: "#/definitions/GPGKeyEmail" x-go-name: "Emails" expires_at: type: "string" format: "date-time" x-go-name: "Expires" id: type: "integer" format: "int64" x-go-name: "ID" key_id: type: "string" x-go-name: "KeyID" primary_key_id: type: "string" x-go-name: "PrimaryKeyID" public_key: type: "string" x-go-name: "PublicKey" subkeys: type: "array" items: $ref: "#/definitions/GPGKey" x-go-name: "SubsKey" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" GPGKeyEmail: description: "GPGKeyEmail an email attached to a GPGKey" type: "object" properties: email: type: "string" x-go-name: "Email" verified: type: "boolean" x-go-name: "Verified" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" Issue: description: "Issue represents an issue in a repository" type: "object" properties: assignee: $ref: "#/definitions/User" assignees: type: "array" items: $ref: "#/definitions/User" x-go-name: "Assignees" body: type: "string" x-go-name: "Body" closed_at: type: "string" format: "date-time" x-go-name: "Closed" comments: type: "integer" format: "int64" x-go-name: "Comments" created_at: type: "string" format: "date-time" x-go-name: "Created" due_date: type: "string" format: "date-time" x-go-name: "Deadline" id: type: "integer" format: "int64" x-go-name: "ID" labels: type: "array" items: $ref: "#/definitions/Label" x-go-name: "Labels" milestone: $ref: "#/definitions/Milestone" number: type: "integer" format: "int64" x-go-name: "Index" pull_request: $ref: "#/definitions/PullRequestMeta" state: $ref: "#/definitions/StateType" title: type: "string" x-go-name: "Title" updated_at: type: "string" format: "date-time" x-go-name: "Updated" url: type: "string" x-go-name: "URL" user: $ref: "#/definitions/User" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" IssueDeadline: description: "IssueDeadline represents an issue deadline" type: "object" properties: due_date: type: "string" format: "date-time" x-go-name: "Deadline" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" IssueLabelsOption: description: "IssueLabelsOption a collection of labels" type: "object" properties: labels: description: "list of label IDs" type: "array" items: type: "integer" format: "int64" x-go-name: "Labels" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" Label: description: "Label a label to an issue or a pr" type: "object" properties: color: type: "string" x-go-name: "Color" example: "00aabb" id: type: "integer" format: "int64" x-go-name: "ID" name: type: "string" x-go-name: "Name" url: type: "string" x-go-name: "URL" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" MarkdownOption: description: "MarkdownOption markdown options" type: "object" properties: Context: description: "Context to render\n\nin: body" type: "string" Mode: description: "Mode to render\n\nin: body" type: "string" Text: description: "Text markdown to render\n\nin: body" type: "string" Wiki: description: "Is it a wiki page ?\n\nin: body" type: "boolean" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" MigrateRepoForm: description: "MigrateRepoForm form for migrating repository" type: "object" required: - "clone_addr" - "uid" - "repo_name" properties: auth_password: type: "string" x-go-name: "AuthPassword" auth_username: type: "string" x-go-name: "AuthUsername" clone_addr: type: "string" x-go-name: "CloneAddr" description: type: "string" x-go-name: "Description" mirror: type: "boolean" x-go-name: "Mirror" private: type: "boolean" x-go-name: "Private" repo_name: type: "string" x-go-name: "RepoName" uid: type: "integer" format: "int64" x-go-name: "UID" x-go-package: "code.gitea.io/gitea/modules/auth" Milestone: description: "Milestone milestone is a collection of issues on one repository" type: "object" properties: closed_at: type: "string" format: "date-time" x-go-name: "Closed" closed_issues: type: "integer" format: "int64" x-go-name: "ClosedIssues" description: type: "string" x-go-name: "Description" due_on: type: "string" format: "date-time" x-go-name: "Deadline" id: type: "integer" format: "int64" x-go-name: "ID" open_issues: type: "integer" format: "int64" x-go-name: "OpenIssues" state: $ref: "#/definitions/StateType" title: type: "string" x-go-name: "Title" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" Organization: description: "Organization represents an organization" type: "object" properties: avatar_url: type: "string" x-go-name: "AvatarURL" description: type: "string" x-go-name: "Description" full_name: type: "string" x-go-name: "FullName" id: type: "integer" format: "int64" x-go-name: "ID" location: type: "string" x-go-name: "Location" username: type: "string" x-go-name: "UserName" website: type: "string" x-go-name: "Website" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" PRBranchInfo: description: "PRBranchInfo information about a branch" type: "object" properties: label: type: "string" x-go-name: "Name" ref: type: "string" x-go-name: "Ref" repo: $ref: "#/definitions/Repository" repo_id: type: "integer" format: "int64" x-go-name: "RepoID" sha: type: "string" x-go-name: "Sha" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" PayloadCommit: description: "PayloadCommit represents a commit" type: "object" properties: author: $ref: "#/definitions/PayloadUser" committer: $ref: "#/definitions/PayloadUser" id: description: "sha1 hash of the commit" type: "string" x-go-name: "ID" message: type: "string" x-go-name: "Message" timestamp: type: "string" format: "date-time" x-go-name: "Timestamp" url: type: "string" x-go-name: "URL" verification: $ref: "#/definitions/PayloadCommitVerification" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" PayloadCommitVerification: description: "PayloadCommitVerification represents the GPG verification of a commit" type: "object" properties: payload: type: "string" x-go-name: "Payload" reason: type: "string" x-go-name: "Reason" signature: type: "string" x-go-name: "Signature" verified: type: "boolean" x-go-name: "Verified" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" PayloadUser: description: "PayloadUser represents the author or committer of a commit" type: "object" properties: email: type: "string" format: "email" x-go-name: "Email" name: description: "Full name of the commit author" type: "string" x-go-name: "Name" username: type: "string" x-go-name: "UserName" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" Permission: description: "Permission represents a set of permissions" type: "object" properties: admin: type: "boolean" x-go-name: "Admin" pull: type: "boolean" x-go-name: "Pull" push: type: "boolean" x-go-name: "Push" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" PublicKey: description: "PublicKey publickey is a user key to push code to repository" type: "object" properties: created_at: type: "string" format: "date-time" x-go-name: "Created" fingerprint: type: "string" x-go-name: "Fingerprint" id: type: "integer" format: "int64" x-go-name: "ID" key: type: "string" x-go-name: "Key" title: type: "string" x-go-name: "Title" url: type: "string" x-go-name: "URL" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" PullRequest: description: "PullRequest represents a pull request" type: "object" properties: assignee: $ref: "#/definitions/User" assignees: type: "array" items: $ref: "#/definitions/User" x-go-name: "Assignees" base: $ref: "#/definitions/PRBranchInfo" body: type: "string" x-go-name: "Body" closed_at: type: "string" format: "date-time" x-go-name: "Closed" comments: type: "integer" format: "int64" x-go-name: "Comments" created_at: type: "string" format: "date-time" x-go-name: "Created" diff_url: type: "string" x-go-name: "DiffURL" due_date: type: "string" format: "date-time" x-go-name: "Deadline" head: $ref: "#/definitions/PRBranchInfo" html_url: type: "string" x-go-name: "HTMLURL" id: type: "integer" format: "int64" x-go-name: "ID" labels: type: "array" items: $ref: "#/definitions/Label" x-go-name: "Labels" merge_base: type: "string" x-go-name: "MergeBase" merge_commit_sha: type: "string" x-go-name: "MergedCommitID" mergeable: type: "boolean" x-go-name: "Mergeable" merged: type: "boolean" x-go-name: "HasMerged" merged_at: type: "string" format: "date-time" x-go-name: "Merged" merged_by: $ref: "#/definitions/User" milestone: $ref: "#/definitions/Milestone" number: type: "integer" format: "int64" x-go-name: "Index" patch_url: type: "string" x-go-name: "PatchURL" state: $ref: "#/definitions/StateType" title: type: "string" x-go-name: "Title" updated_at: type: "string" format: "date-time" x-go-name: "Updated" url: type: "string" x-go-name: "URL" user: $ref: "#/definitions/User" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" PullRequestMeta: description: "PullRequestMeta PR info if an issue is a PR" type: "object" properties: merged: type: "boolean" x-go-name: "HasMerged" merged_at: type: "string" format: "date-time" x-go-name: "Merged" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" Release: description: "Release represents a repository release" type: "object" properties: assets: type: "array" items: $ref: "#/definitions/Attachment" x-go-name: "Attachments" author: $ref: "#/definitions/User" body: type: "string" x-go-name: "Note" created_at: type: "string" format: "date-time" x-go-name: "CreatedAt" draft: type: "boolean" x-go-name: "IsDraft" id: type: "integer" format: "int64" x-go-name: "ID" name: type: "string" x-go-name: "Title" prerelease: type: "boolean" x-go-name: "IsPrerelease" published_at: type: "string" format: "date-time" x-go-name: "PublishedAt" tag_name: type: "string" x-go-name: "TagName" tarball_url: type: "string" x-go-name: "TarURL" target_commitish: type: "string" x-go-name: "Target" url: type: "string" x-go-name: "URL" zipball_url: type: "string" x-go-name: "ZipURL" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" Repository: description: "Repository represents a repository" type: "object" properties: clone_url: type: "string" x-go-name: "CloneURL" created_at: type: "string" format: "date-time" x-go-name: "Created" default_branch: type: "string" x-go-name: "DefaultBranch" description: type: "string" x-go-name: "Description" empty: type: "boolean" x-go-name: "Empty" fork: type: "boolean" x-go-name: "Fork" forks_count: type: "integer" format: "int64" x-go-name: "Forks" full_name: type: "string" x-go-name: "FullName" html_url: type: "string" x-go-name: "HTMLURL" id: type: "integer" format: "int64" x-go-name: "ID" mirror: type: "boolean" x-go-name: "Mirror" name: type: "string" x-go-name: "Name" open_issues_count: type: "integer" format: "int64" x-go-name: "OpenIssues" owner: $ref: "#/definitions/User" parent: $ref: "#/definitions/Repository" permissions: $ref: "#/definitions/Permission" private: type: "boolean" x-go-name: "Private" size: type: "integer" format: "int64" x-go-name: "Size" ssh_url: type: "string" x-go-name: "SSHURL" stars_count: type: "integer" format: "int64" x-go-name: "Stars" updated_at: type: "string" format: "date-time" x-go-name: "Updated" watchers_count: type: "integer" format: "int64" x-go-name: "Watchers" website: type: "string" x-go-name: "Website" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" SearchResults: description: "SearchResults results of a successful search" type: "object" properties: data: type: "array" items: $ref: "#/definitions/Repository" x-go-name: "Data" ok: type: "boolean" x-go-name: "OK" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" ServerVersion: description: "ServerVersion wraps the version of the server" type: "object" properties: version: type: "string" x-go-name: "Version" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" StateType: description: "StateType issue state type" type: "string" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" Status: description: "Status holds a single Status of a single Commit" type: "object" properties: context: type: "string" x-go-name: "Context" created_at: type: "string" format: "date-time" x-go-name: "Created" creator: $ref: "#/definitions/User" description: type: "string" x-go-name: "Description" id: type: "integer" format: "int64" x-go-name: "ID" status: $ref: "#/definitions/StatusState" target_url: type: "string" x-go-name: "TargetURL" updated_at: type: "string" format: "date-time" x-go-name: "Updated" url: type: "string" x-go-name: "URL" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" StatusState: description: "StatusState holds the state of a Status\nIt can be \"pending\", \"success\", \"error\", \"failure\", and \"warning\"" type: "string" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" Team: description: "Team represents a team in an organization" type: "object" properties: description: type: "string" x-go-name: "Description" id: type: "integer" format: "int64" x-go-name: "ID" name: type: "string" x-go-name: "Name" permission: type: "string" enum: - "none" - "read" - "write" - "admin" - "owner" x-go-name: "Permission" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" TrackedTime: description: "TrackedTime worked time for an issue / pr" type: "object" properties: created: type: "string" format: "date-time" x-go-name: "Created" id: type: "integer" format: "int64" x-go-name: "ID" issue_id: type: "integer" format: "int64" x-go-name: "IssueID" time: description: "Time in seconds" type: "integer" format: "int64" x-go-name: "Time" user_id: type: "integer" format: "int64" x-go-name: "UserID" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" User: description: "User represents a user" type: "object" properties: avatar_url: description: "URL to the user's avatar" type: "string" x-go-name: "AvatarURL" email: type: "string" format: "email" x-go-name: "Email" full_name: description: "the user's full name" type: "string" x-go-name: "FullName" id: description: "the user's id" type: "integer" format: "int64" x-go-name: "ID" language: description: "User locale" type: "string" x-go-name: "Language" login: description: "the user's username" type: "string" x-go-name: "UserName" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" WatchInfo: description: "WatchInfo represents an API watch status of one repository" type: "object" properties: created_at: type: "string" format: "date-time" x-go-name: "CreatedAt" ignored: type: "boolean" x-go-name: "Ignored" reason: type: "object" x-go-name: "Reason" repository_url: type: "string" x-go-name: "RepositoryURL" subscribed: type: "boolean" x-go-name: "Subscribed" url: type: "string" x-go-name: "URL" x-go-package: "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" responses: AccessToken: description: "AccessToken represents a API access token." headers: id: type: "integer" format: "int64" name: type: "string" sha1: type: "string" AccessTokenList: description: "AccessTokenList represents a list of API access token." Attachment: description: "Attachment" schema: $ref: "#/definitions/Attachment" AttachmentList: description: "AttachmentList" schema: type: "array" items: $ref: "#/definitions/Attachment" Branch: description: "Branch" schema: $ref: "#/definitions/Branch" BranchList: description: "BranchList" schema: type: "array" items: $ref: "#/definitions/Branch" Comment: description: "Comment" schema: $ref: "#/definitions/Comment" CommentList: description: "CommentList" schema: type: "array" items: $ref: "#/definitions/Comment" DeployKey: description: "DeployKey" schema: $ref: "#/definitions/DeployKey" DeployKeyList: description: "DeployKeyList" schema: type: "array" items: $ref: "#/definitions/DeployKey" EmailList: description: "EmailList" schema: type: "array" items: $ref: "#/definitions/Email" GPGKey: description: "GPGKey" schema: $ref: "#/definitions/GPGKey" GPGKeyList: description: "GPGKeyList" schema: type: "array" items: $ref: "#/definitions/GPGKey" Hook: description: "Hook" schema: type: "array" items: $ref: "#/definitions/Branch" HookList: description: "HookList" schema: type: "array" items: $ref: "#/definitions/Branch" Issue: description: "Issue" schema: $ref: "#/definitions/Issue" IssueDeadline: description: "IssueDeadline" schema: $ref: "#/definitions/IssueDeadline" IssueList: description: "IssueList" schema: type: "array" items: $ref: "#/definitions/Issue" Label: description: "Label" schema: $ref: "#/definitions/Label" LabelList: description: "LabelList" schema: type: "array" items: $ref: "#/definitions/Label" MarkdownRender: description: "MarkdownRender is a rendered markdown document" Milestone: description: "Milestone" schema: $ref: "#/definitions/Milestone" MilestoneList: description: "MilestoneList" schema: type: "array" items: $ref: "#/definitions/Milestone" Organization: description: "Organization" schema: $ref: "#/definitions/Organization" OrganizationList: description: "OrganizationList" schema: type: "array" items: $ref: "#/definitions/Organization" PublicKey: description: "PublicKey" schema: $ref: "#/definitions/PublicKey" PublicKeyList: description: "PublicKeyList" schema: type: "array" items: $ref: "#/definitions/PublicKey" PullRequest: description: "PullRequest" schema: $ref: "#/definitions/PullRequest" PullRequestList: description: "PullRequestList" schema: type: "array" items: $ref: "#/definitions/PullRequest" Release: description: "Release" schema: $ref: "#/definitions/Release" ReleaseList: description: "ReleaseList" schema: type: "array" items: $ref: "#/definitions/Release" Repository: description: "Repository" schema: $ref: "#/definitions/Repository" RepositoryList: description: "RepositoryList" schema: type: "array" items: $ref: "#/definitions/Repository" SearchResults: description: "SearchResults" schema: $ref: "#/definitions/SearchResults" ServerVersion: description: "ServerVersion" schema: $ref: "#/definitions/ServerVersion" Status: description: "Status" schema: $ref: "#/definitions/Status" StatusList: description: "StatusList" schema: type: "array" items: $ref: "#/definitions/Status" Team: description: "Team" schema: $ref: "#/definitions/Team" TeamList: description: "TeamList" schema: type: "array" items: $ref: "#/definitions/Team" TrackedTime: description: "TrackedTime" schema: $ref: "#/definitions/TrackedTime" TrackedTimeList: description: "TrackedTimeList" schema: type: "array" items: $ref: "#/definitions/TrackedTime" User: description: "User" schema: $ref: "#/definitions/User" UserList: description: "UserList" schema: type: "array" items: $ref: "#/definitions/User" WatchInfo: description: "WatchInfo" schema: $ref: "#/definitions/WatchInfo" empty: description: "APIEmpty is an empty response" error: description: "APIError is error format response" headers: message: type: "string" url: type: "string" forbidden: description: "APIForbiddenError is a forbidden error response" headers: message: type: "string" url: type: "string" notFound: description: "APINotFound is a not found empty response" parameterBodies: description: "parameterBodies" schema: $ref: "#/definitions/EditAttachmentOptions" redirect: description: "APIRedirect is a redirect response" validationError: description: "APIValidationError is error format response related to input validation" headers: message: type: "string" url: type: "string" securityDefinitions: AccessToken: type: "apiKey" name: "access_token" in: "query" AuthorizationHeaderToken: type: "apiKey" name: "Authorization" in: "header" BasicAuth: type: "basic" Token: type: "apiKey" name: "token" in: "query" security: - BasicAuth: [] - Token: [] - AccessToken: [] - AuthorizationHeaderToken: [] analysis-0.21.1/fixtures/bugs/1621/000077500000000000000000000000001413705513100166205ustar00rootroot00000000000000analysis-0.21.1/fixtures/bugs/1621/definitions.yaml000066400000000000000000000465771413705513100220420ustar00rootroot00000000000000definitions: # Generic response model V4GenericResponse: type: object properties: message: type: string description: A human readable message code: type: string description: | A machine readable [response code](https://github.com/giantswarm/api-spec/blob/master/details/RESPONSE_CODES.md) like e. g. `INVALID_CREDENTIALS` # Info resposne V4InfoResponse: type: object properties: general: description: General information type: object properties: installation_name: description: Unique name of the installation type: string provider: description: The technical provider used in this installation. Either "kvm", "aws", or "azure". type: string datacenter: description: Identifier of the datacenter or cloud provider region, e. g. "eu-west-1" type: string workers: description: Information related to worker nodes type: object properties: count_per_cluster: description: Number of workers per cluster type: object properties: max: description: Maximum number of worker a cluster can have type: number default: description: Default number of workers in a new cluster will have, if not specifiec otherwise type: number instance_type: description: Instance types to be used for worker nodes. Only available for AWS clusters. type: object properties: options: description: List of available instance types type: array items: type: string default: description: The instance type used in new cluster, if not specified type: string vm_size: description: Azure Virtual Machine size to be used for worker nodes. Only available for Azure clusters. type: object properties: options: description: List of available instance types type: array items: type: string default: description: The instance type used in new cluster, if not specified type: string # Request to create a new cluster V4AddClusterRequest: type: object required: - owner description: Request model for creating a new cluster properties: owner: type: string description: Name of the organization owning the cluster name: type: string description: Cluster name release_version: type: string description: | The [release](https://docs.giantswarm.io/api/#tag/releases) version to use in the new cluster kubernetes_version: type: string description: | Kubernetes version number (deprecated). Doesn't have any effect. This attribute is going to be removed in future API versions. workers: type: array items: $ref: '#/definitions/V4NodeDefinition' V4ModifyClusterRequest: type: object required: [] description: Request body for cluster modification properties: name: type: string description: Name for the cluster owner: type: string description: Name of the organization owning the cluster release_version: type: string description: Release version to use after an upgrade workers: type: array description: Worker node array items: $ref: '#/definitions/V4NodeDefinition' # Details on existing cluster V4ClusterDetailsResponse: type: object description: Response model showing details of a cluster properties: id: type: string description: Unique cluster identifier api_endpoint: type: string description: URI of the Kubernetes API endpoint create_date: type: string description: Date/time of cluster creation owner: type: string description: Name of the organization owning the cluster name: type: string description: Cluster name release_version: type: string description: | The [release](https://docs.giantswarm.io/api/#tag/releases) version currently running this cluster. kubernetes_version: type: string description: Deprecated. Will be removed in a future API version. workers: type: array items: $ref: '#/definitions/V4NodeDefinition' kvm: type: object description: Attributes specific to clusters running on KVM (on-prem) installations. properties: port_mappings: type: array description: | Reveals the ports on the host cluster that are mapped to this guest cluster's ingress and which protocol that port supports. Only shown and relevant on our on-prem KVM clusters. items: type: object properties: port: description: | The port on the host cluster that will forward traffic to the guest cluster type: integer protocol: description: | The protocol this port mapping is made for. type: string # Definition of a cluster node V4NodeDefinition: type: object properties: aws: type: object description: | Attributes specific to nodes running on Amazon Web Services (AWS) properties: instance_type: type: string description: | EC2 instance type name. Must be the same for all worker nodes of a cluster. azure: type: object description: | Attributes specific to nodes running on Microsoft Azure properties: vm_size: type: string description: | Azure Virtual Machine size. Must be the same for all worker nodes of a cluster. memory: type: object properties: size_gb: type: number description: RAM size in GB. Can be an integer or float. storage: type: object properties: size_gb: type: number description: Node storage size in GB. Can be an integer or float. cpu: type: object properties: cores: type: integer description: Number of CPU cores labels: type: object additionalProperties: true # List of key pairs V4GetKeyPairsResponse: type: array description: Array of sparse key pair objects items: type: object properties: id: type: string description: Unique identifier of the key pair description: type: string description: Free text information about the key pair ttl_hours: type: integer description: Expiration time (from creation) in hours create_date: type: string description: Date/time of creation common_name: type: string description: The common name of the certificate subject. certificate_organizations: type: string description: The certificate subject's `organization` fields. # Add key pair request V4AddKeyPairRequest: type: object required: - description properties: description: type: string description: Free text information about the key pair ttl_hours: type: integer format: int32 description: Expiration time (from creation) in hours cn_prefix: type: string description: The common name prefix of the certificate subject. This only allows characters that are usable in domain names (`a-z`, `0-9`, and `.-`, where `.-` must not occur at either the start or the end). certificate_organizations: type: string description: | This will set the certificate subject's `organization` fields. Use a comma seperated list of values. V4AddKeyPairResponse: type: object properties: id: type: string description: Unique identifier of the key pair description: type: string description: Free text information about the key pair ttl_hours: type: integer description: Expiration time (from creation) in hours create_date: type: string description: Date/time of creation certificate_authority_data: type: string description: PEM-encoded CA certificate of the cluster client_key_data: type: string description: PEM-encoded RSA private key client_certificate_data: type: string description: PEM-encoded certificate # cluster metrics V4GetClusterMetricsResponse: description: Response for the getClusterMetrics operation type: object properties: workers: description: Group of metrics regarding workers type: array items: $ref: '#/definitions/V4NodeMetrics' V4NodeMetrics: type: object properties: id: description: String identifying the node type: string metrics: description: Container object for all metrics available for the node type: object properties: container_count: type: object properties: timestamp: description: Time when the given value has been recorded type: string value: description: The value for the metric. Can be an integer or float. type: number pod_count: type: object properties: timestamp: description: Time when the given value has been recorded type: string value: description: The value for the metric. Can be an integer or float. type: number cpu_used: type: object properties: timestamp: description: Time when the given value has been recorded type: string value: description: The value for the metric. Can be an integer or float. type: number ram_free: type: object properties: timestamp: description: Time when the given value has been recorded type: string value: description: The value for the metric. Can be an integer or float. type: number ram_available: type: object properties: timestamp: description: Time when the given value has been recorded type: string value: description: The value for the metric. Can be an integer or float. type: number ram_cached: type: object properties: timestamp: description: Time when the given value has been recorded type: string value: description: The value for the metric. Can be an integer or float. type: number ram_buffers: type: object properties: timestamp: description: Time when the given value has been recorded type: string value: description: The value for the metric. Can be an integer or float. type: number ram_mapped: type: object properties: timestamp: description: Time when the given value has been recorded type: string value: description: The value for the metric. Can be an integer or float. type: number node_storage_used: type: object properties: timestamp: description: Time when the given value has been recorded type: string value: description: The value for the metric. Can be an integer or float. type: number network_rx: type: object properties: timestamp: description: Time when the given value has been recorded type: string value: description: The value for the metric. Can be an integer or float. type: number network_tx: type: object properties: timestamp: description: Time when the given value has been recorded type: string value: description: The value for the metric. Can be an integer or float. type: number resource_cpu_requests: type: object properties: timestamp: description: Time when the given value has been recorded type: string value: description: The value for the metric. Can be an integer or float. type: number resource_cpu_limits: type: object properties: timestamp: description: Time when the given value has been recorded type: string value: description: The value for the metric. Can be an integer or float. type: number resource_ram_requests: type: object properties: timestamp: description: Time when the given value has been recorded type: string value: description: The value for the metric. Can be an integer or float. type: number resource_ram_limits: type: object properties: timestamp: description: Time when the given value has been recorded type: string value: description: The value for the metric. Can be an integer or float. type: number # a complete organization object V4Organization: type: object properties: id: type: string description: Unique name/identifier of the organization members: type: array description: List of members that belong to this organization items: $ref: '#/definitions/V4OrganizationMember' # An organization as returned by getOrganizations as an array item V4OrganizationListItem: type: object properties: id: type: string description: Unique name/identifier of the organization # A user that belongs to an organization V4OrganizationMember: type: object properties: email: type: string description: Email address of the user # One of the users in the array as returned by getUsers V4UserListItem: type: object properties: email: type: string description: Email address of the user created: type: string description: The date and time that this account was created expiry: type: string description: The date and time when this account will expire # A cluster array item, as return by getClusters V4ClusterListItem: type: object properties: id: type: string description: Unique cluster identifier create_date: type: string description: Date/time of cluster creation name: type: string description: Cluster name owner: type: string description: Name of the organization owning the cluster release_version: type: string description: The semantic version number of this cluster # A cluster array item, as return by getClusters V4ReleaseListItem: type: object required: ["version", "timestamp", "changelog", "components"] properties: version: type: string description: The semantic version number timestamp: type: string description: Date and time of the release creation active: type: boolean description: | If true, the version is available for new clusters and cluster upgrades. Older versions become unavailable and thus have the value `false` here. changelog: description: | Structured list of changes in this release, in comparison to the previous version, with respect to the contained components. type: array items: type: object properties: component: type: string description: | If the changed item was a component, this attribute is the name of the component. description: type: string description: Human-friendly description of the change components: description: | List of components and their version contained in the release type: array items: type: object required: ["name", "version"] properties: name: type: string description: Name of the component version: type: string description: Version number of the component V4CreateUserRequest: type: object required: - password description: Request model for creating a new user properties: password: type: string description: A Base64 encoded password expiry: type: string description: The date and time when this account will expire V4AddCredentialsRequest: type: object required: - provider description: Request model for adding a set of credentials properties: provider: type: string aws: type: object description: Credentials specific to an AWS account required: - roles properties: roles: type: object descriptions: IAM roles to assume by certain entities required: - awsoperator - admin properties: admin: type: string description: ARN of the IAM role to assume by Giant Swarm support staff awsoperator: type: string description: ARN of the IAM role to assume by the software operating clusters # A request for an auth token V4CreateAuthTokenRequest: type: object properties: email: type: string description: Your email address password_base64: type: string description: Your password as a base64 encoded string # A response to a successful auth token request V4CreateAuthTokenResponse: type: object properties: auth_token: type: string description: The newly created API token analysis-0.21.1/fixtures/bugs/1621/fixture-1621.yaml000066400000000000000000001473511413705513100215740ustar00rootroot00000000000000swagger: "2.0" info: title: The Giant Swarm API v4 description: | This is the documentation for the Giant Swarm API starting at version `v4`. For an introduction to Giant Swarm, refer to the [documentation site](https://docs.giantswarm.io/). The Giant Swarm API attempts to behave in a __restful__ way. As a developer, you access resources using the `GET` method and, for example, delete them using the same path and the `DELETE` method. Accessing resources via GET usually returns all information available about a resource, while collections, like for example the list of all clusters you have access to, only contain a selected few attributes of each member item. Some requests, like for example the request to create a new cluster, don't return the resource itself. Instead, the response delivers a standard message body, showing a `code` and a `message` part. The `message` contains information for you or a client's end user. The `code` attribute contains some string (example: `RESOURCE_CREATED`) that is supposed to give you details on the state of the operation, in addition to standard HTTP status codes. This message format is also used in the case of errors. We provide a [list of all response codes](https://github.com/giantswarm/api-spec/blob/master/details/RESPONSE_CODES.md) outside this documentation. Feedback on the API as well as this documentation is welcome via `support@giantswarm.io` or on IRC channel [#giantswarm](irc://irc.freenode.org:6667/#giantswarm) on freenode. ## Source The source of this documentation is available on [GitHub](https://github.com/giantswarm/api-spec). termsOfService: https://giantswarm.io/terms/ version: 4.0.0 license: name: Apache 2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html consumes: - application/json produces: - application/json tags: - name: auth tokens description: | Auth Tokens are your way of authenticating against this API. You can create one by passing your email and base64 encoded password to the create auth token endpoint. The auth token never expires, in case you want to invalidate it you need to delete it (logout). - name: clusters description: | Clusters are a central resource of the Giant Swarm API. As a user or team using Giant Swarm, you set up Kubernetes clusters to run your own workloads. The API currently provides operations to create and delete clusters, as well as list all available clusters and get details on specific clusters. - name: info description: Information about the Giant Swarm installation - name: key pairs description: A key pair is a unique combination of a X.509 certificate and a private key. Key pairs are used to access the Kubernetes API of a cluster, both using `kubectl` and any standard web browser. externalDocs: url: https://docs.giantswarm.io/guides/accessing-services-from-the-outside/ description: "User guide: Accessing Pods and Services from the Outside" - name: organizations description: Organizations are groups of users who own resources like clusters. - name: users description: A user represents a person that should have access to the Giant Swarm API. Users can belong to many groups, and are identified by email address. - name: releases description: | A release is a software bundle that constitutes a cluster. Releases are identified by their [semantic version number](http://semver.org/) in the `MAJOR.MINOR.PATCH` format. A release provides _components_, like for example Kubernetes. For each release the contained components are listed. Changes in components are detailed in the _changelog_ of a release. securityDefinitions: AuthorizationHeaderToken: description: | Clients authenticate by passing an auth token via the `Authorization` header with a value of the format `giantswarm `. Auth tokens can be obtained using the [createAuthToken](#operation/createAuthToken) operation. type: apiKey name: Authorization in: header security: - AuthorizationHeaderToken: [] paths: /v4/info/: get: operationId: getInfo tags: - info summary: Get information on the installation description: | Returns a set of details on the installation. The output varies based on the provider used in the installation. This information is useful for example when creating new cluster, to prevent creating clusters with more worker nodes than possible. ### Example for an AWS-based installation ```json { "general": { "installation_name": "shire", "provider": "aws", "datacenter": "eu-central-1" }, "workers": { "count_per_cluster": { "max": 20, "default": 3 }, "instance_type": { "options": [ "m3.medium", "m3.large", "m3.xlarge" ], "default": "m3.large" } } } ``` ### Example for a KVM-based installation ```json { "general": { "installation_name": "isengard", "provider": "kvm", "datacenter": "string" }, "workers": { "count_per_cluster": { "max": 8, "default": 3 }, } } ``` parameters: - $ref: './parameters.yaml#/parameters/RequiredGiantSwarmAuthorizationHeader' - $ref: './parameters.yaml#/parameters/XRequestIDHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmActivityHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmCmdLineHeader' responses: "200": description: Information schema: $ref: "./definitions.yaml#/definitions/V4InfoResponse" examples: application/json: { "general": { "installation_name": "shire", "provider": "aws", "datacenter": "eu-central-1" }, "workers": { "count_per_cluster": { "max": 20, "default": 3 }, "instance_type": { "options": [ "m3.medium", "m3.large", "m3.xlarge" ], "default": "m3.large" } } } "401": $ref: "./responses.yaml#/responses/V4Generic401Response" default: description: Error schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" /v4/auth-tokens/: post: operationId: createAuthToken tags: - auth tokens summary: Create Auth Token (Login) description: | Creates a Auth Token for a given user. Must authenticate with email and password. parameters: - $ref: './parameters.yaml#/parameters/XRequestIDHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmActivityHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmCmdLineHeader' - name: body in: body required: true description: Create Auth Token Request schema: $ref: 'definitions.yaml#/definitions/V4CreateAuthTokenRequest' x-examples: application/json: { "email": "developer@example.com", "password_base64": "cGFzc3dvcmQ=" } responses: "200": description: Success schema: $ref: "./definitions.yaml#/definitions/V4CreateAuthTokenResponse" examples: application/json: { "auth_token": "e5239484-2299-41df-b901-d0568db7e3f9" } "401": $ref: "./responses.yaml#/responses/V4Generic401Response" delete: operationId: deleteAuthToken tags: - auth tokens summary: Delete Auth Token (Logout) description: | Deletes the authentication token provided in the Authorization header. This effectively logs you out. parameters: - $ref: './parameters.yaml#/parameters/RequiredGiantSwarmAuthorizationHeader' - $ref: './parameters.yaml#/parameters/XRequestIDHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmActivityHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmCmdLineHeader' responses: "200": description: Success schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" examples: application/json: { "code": "RESOURCE_DELETED", "message": "The authentication token has been succesfully deleted." } "401": $ref: "./responses.yaml#/responses/V4Generic401Response" /v4/users/: get: operationId: getUsers tags: - users summary: Get users description: | Returns a list of all users in the system. Currently this endpoint is only available to users with admin permissions. parameters: - $ref: './parameters.yaml#/parameters/RequiredGiantSwarmAuthorizationHeader' - $ref: './parameters.yaml#/parameters/XRequestIDHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmActivityHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmCmdLineHeader' responses: "200": description: Success schema: type: array items: $ref: "./definitions.yaml#/definitions/V4UserListItem" examples: application/json: [ {"email": "andy@example.com", "created": "2017-01-15T12:00:00Z", "expiry": "2019-01-15T00:00:00Z"}, {"email": "bob@example.com", "created": "2017-02-15T12:30:00Z", "expiry": "2020-01-15T00:00:00Z"}, {"email": "charles@example.com", "created": "2017-03-15T13:00:00Z", "expiry": "2021-01-15T00:00:00Z"} ] "401": $ref: "./responses.yaml#/responses/V4Generic401Response" default: description: Error schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" /v4/user/: get: operationId: getCurrentUser tags: - users summary: Get current user description: | Returns details about the currently authenticated user parameters: - $ref: './parameters.yaml#/parameters/RequiredGiantSwarmAuthorizationHeader' - $ref: './parameters.yaml#/parameters/XRequestIDHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmActivityHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmCmdLineHeader' responses: "200": description: Success schema: $ref: "./definitions.yaml#/definitions/V4UserListItem" examples: application/json: {"email": "andy@example.com", "created": "2017-01-15T12:00:00Z", "expiry": "2019-01-15T00:00:00Z"} "201": # Fake response added with expanded content of 200, to run test assertion, e.g. 200 <=> 201 description: Success schema: type: object properties: email: type: string description: Email address of the user created: type: string description: The date and time that this account was created expiry: type: string description: The date and time when this account will expire "401": $ref: "./responses.yaml#/responses/V4Generic401Response" default: description: Error schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" /v4/users/{email}/: get: operationId: getUser parameters: - $ref: './parameters.yaml#/parameters/RequiredGiantSwarmAuthorizationHeader' - $ref: './parameters.yaml#/parameters/XRequestIDHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmActivityHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmCmdLineHeader' - $ref: "./parameters.yaml#/parameters/UserEmailPathParameter" tags: - users summary: Get user description: | Returns details about a specific user responses: "200": description: Success schema: $ref: "./definitions.yaml#/definitions/V4UserListItem" examples: application/json: {"email": "andy@example.com", "created": "2017-01-15T12:00:00Z", "expiry": "2019-01-15T00:00:00Z"} "401": $ref: "./responses.yaml#/responses/V4Generic401Response" "404": description: User not found schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" examples: application/json: { "code": "RESOURCE_NOT_FOUND", "message": "The user could not be found. (not found: user with email 'bob@example.com' could not be found)" } default: description: Error schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" put: operationId: createUser parameters: - $ref: './parameters.yaml#/parameters/RequiredGiantSwarmAuthorizationHeader' - $ref: './parameters.yaml#/parameters/XRequestIDHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmActivityHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmCmdLineHeader' - $ref: "./parameters.yaml#/parameters/UserEmailPathParameter" - name: body in: body required: true description: User account details schema: $ref: "./definitions.yaml#/definitions/V4CreateUserRequest" x-examples: application/json: { "password": "cGFzc3dvcmQ=", "expiry": "2020-01-01T12:00:00.000Z" } tags: - users summary: Create user description: | Creates a users in the system. Currently this endpoint is only available to users with admin permissions. responses: "201": description: User created schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" examples: application/json: { "code": "RESOURCE_CREATED", "message": "The user with email 'bob@example.com' has been created." } "400": description: User already exists schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" examples: application/json: { "code": "RESOURCE_ALREADY_EXISTS", "message": "The user could not be created. (invalid input: email 'bob@example.com' already exists)" } "401": $ref: "./responses.yaml#/responses/V4Generic401Response" default: description: Error schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" delete: operationId: deleteUser parameters: - $ref: './parameters.yaml#/parameters/RequiredGiantSwarmAuthorizationHeader' - $ref: './parameters.yaml#/parameters/XRequestIDHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmActivityHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmCmdLineHeader' - $ref: "./parameters.yaml#/parameters/UserEmailPathParameter" tags: - users summary: Delete user description: | Deletes a users in the system. Currently this endpoint is only available to users with admin permissions. responses: "200": description: User deleted schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" examples: application/json: { "code": "RESOURCE_DELETED", "message": "The user with email 'bob@example.com' has been deleted." } "401": $ref: "./responses.yaml#/responses/V4Generic401Response" "404": description: User not found schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" examples: application/json: { "code": "RESOURCE_NOT_FOUND", "message": "The user could not be deleted. (not found: user with email 'bob@example.com' could not be found)" } default: description: Error schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" /v4/clusters/: get: operationId: getClusters tags: - clusters summary: Get clusters description: | This operation fetches a list of clusters. The result depends on the permissions of the user. A normal user will get all the clusters the user has access to, via organization membership. A user with admin permission will receive a list of all existing clusters. The result array items are sparse representations of the cluster objects. To fetch more details on a cluster, use the [getCluster](#operation/getCluster) operation. parameters: - $ref: './parameters.yaml#/parameters/RequiredGiantSwarmAuthorizationHeader' - $ref: './parameters.yaml#/parameters/XRequestIDHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmActivityHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmCmdLineHeader' responses: "200": description: Success schema: type: array items: $ref: "./definitions.yaml#/definitions/V4ClusterListItem" examples: application/json: [ { "id": "g8s3o", "create_date": "2017-06-08T12:31:47.215Z", "name": "Staging Cluster", "owner": "acme" }, { "id": "3dkr6", "create_date": "2017-05-22T13:58:02.024Z", "name": "Test Cluster", "owner": "testorg" } ] "401": $ref: "./responses.yaml#/responses/V4Generic401Response" default: description: Error schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" post: operationId: addCluster tags: - clusters summary: Create cluster description: | This operation is used to create a new Kubernetes cluster for an organization. The desired configuration can be specified using the __cluster definition format__ (see [external documentation](https://github.com/giantswarm/api-spec/blob/master/details/CLUSTER_DEFINITION.md) for details). The cluster definition format allows to set a number of optional configuration details, like memory size and number of CPU cores. However, one attribute is __mandatory__ upon creation: The `owner` attribute must carry the name of the organization the cluster will belong to. Note that the acting user must be a member of that organization in order to create a cluster. It is *recommended* to also specify the `name` attribute to give the cluster a friendly name, like e. g. "Development Cluster". Additional definition attributes can be used. Where attributes are omitted, default configuration values will be applied. For example, if no `release_version` is specified, the most recent version is used. The `workers` attribute, if present, must contain an array of node definition objects. The number of objects given determines the number of workers created. For example, requesting three worker nodes with default configuration can be achieved by submitting an array of three empty objects: ```"workers": [{}, {}, {}]``` For clusters on AWS, note that all worker nodes must use the same instance type. parameters: - $ref: './parameters.yaml#/parameters/RequiredGiantSwarmAuthorizationHeader' - $ref: './parameters.yaml#/parameters/XRequestIDHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmActivityHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmCmdLineHeader' - name: body in: body required: true description: New cluster definition schema: $ref: "./definitions.yaml#/definitions/V4AddClusterRequest" x-examples: application/json: { "owner": "myteam", "release_version": "1.4.2", "name": "Example cluster with 3 default worker nodes", "workers": [{}, {}, {}] } responses: "201": description: Cluster created headers: Location: type: string description: URI to obtain details on the new cluster using the [getCluster](#operation/getCluster) operation schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" examples: application/json: { "code": "RESOURCE_CREATED", "message": "A new cluster has been created with ID 'wqtlq'" } "401": $ref: "./responses.yaml#/responses/V4Generic401Response" default: description: error schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" /v4/clusters/{cluster_id}/: get: operationId: getCluster tags: - clusters parameters: - $ref: './parameters.yaml#/parameters/RequiredGiantSwarmAuthorizationHeader' - $ref: './parameters.yaml#/parameters/XRequestIDHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmActivityHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmCmdLineHeader' - $ref: "./parameters.yaml#/parameters/ClusterIdPathParameter" summary: Get cluster details description: | This operation allows to obtain all available details on a particular cluster. responses: "200": description: Cluster details schema: $ref: "./definitions.yaml#/definitions/V4ClusterDetailsResponse" examples: application/json: { "id": "wqtlq", "create_date": "2017-03-03T10:50:45.949270905Z", "api_endpoint": "https://api.wqtlq.example.com", "name": "Just a Standard Cluster", "release_version": "2.5.16", "kubernetes_version": "", "owner": "acme", "workers": [ { "memory": {"size_gb": 2.0}, "storage": {"size_gb": 20.0}, "cpu": {"cores": 4}, "labels": { "beta.kubernetes.io/arch": "amd64", "beta.kubernetes.io/os": "linux", "ip": "10.3.11.2", "kubernetes.io/hostname": "worker-1.x882ofna.k8s.gigantic.io", "nodetype": "hicpu" } }, { "memory": {"size_gb": 8.0}, "storage": {"size_gb": 20.0}, "cpu": {"cores": 2}, "labels": { "beta.kubernetes.io/arch": "amd64", "beta.kubernetes.io/os": "linux", "ip": "10.3.62.2", "kubernetes.io/hostname": "worker-2.x882ofna.k8s.gigantic.io", "nodetype": "hiram" } } ], "kvm": { "port_mappings": [ { "port": 30020, "protocol": "http" }, { "port": 30021, "protocol": "https" }, ] } } "401": $ref: "./responses.yaml#/responses/V4Generic401Response" "404": description: Cluster not found schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" examples: application/json: { "code": "RESOURCE_NOT_FOUND", "message": "The cluster with ID 'wqtlq' could not be found, or perhaps you do not have access to it. Please make sure the cluster ID is correct, and that you are a member of the organization that it belongs to." } default: description: error schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" patch: operationId: modifyCluster tags: - clusters parameters: - $ref: './parameters.yaml#/parameters/RequiredGiantSwarmAuthorizationHeader' - $ref: './parameters.yaml#/parameters/XRequestIDHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmActivityHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmCmdLineHeader' - name: body in: body required: true description: Merge-patch body schema: $ref: "./definitions.yaml#/definitions/V4ModifyClusterRequest" x-examples: application/merge-patch+json: { "name": "New cluster name" } - $ref: "./parameters.yaml#/parameters/ClusterIdPathParameter" summary: Modify cluster description: | This operation allows to modify an existing cluster. A cluster modification is performed by submitting a `PATCH` request to the cluster resource (as described in the [addCluster](#operation/addCluster) and [getCluster](#operation/getCluster)) in form of a [JSON Patch Merge (RFC 7386)](https://tools.ietf.org/html/rfc7386). This means, only the attributes to be modified have to be contained in the request body. The following attributes can be modified: - `name`: Rename the cluster to something more fitting. - `owner`: Changing the owner organization name means to change cluster ownership from one organization to another. The user performing the request has to be a member of both organizations. - `release_version`: By changing this attribute you can upgrade a cluster to a newer [release](https://docs.giantswarm.io/api/#tag/releases). - `workers`: By modifying the array of workers, nodes can be added to increase the cluster's capacity. See details below. ### Adding and Removing Worker Nodes (Scaling) Adding worker nodes to a cluster or removing worker nodes from a cluster works by submitting the `workers` attribute, which contains a (sparse) array of worker node defintions. _Sparse_ here means that all configuration details are optional. In the case that worker nodes are added to a cluster, wherever a configuration detail is missing, defaults will be applied. See [Creating a cluster](#operation/addCluster) for details. When modifying the cluster resource, you describe the desired state. For scaling, this means that the worker node array submitted must contain as many elements as the cluster should have worker nodes. If your cluster currently has five nodes and you submit a workers array with four elements, this means that one worker node will be removed. If your submitted workers array has six elements, this means one will be added. As an example, this request body could be used to scale a cluster to three worker nodes: ```json { "workers": [{}, {}, {}] } ``` If the scaled cluster had four worker nodes before, one would be removed. If it had two worker nodes before, one with default settings would be added. ### Limitations - As of now, existing worker nodes cannot be modified. - When removing nodes (scaling down), it is not possible to determine which nodes will be removed. - On AWS based clusters, all worker nodes must use the same EC2 instance type (`instance_type` node attribute). By not setting an `instance_type` when submitting a PATCH request, you ensure that the right instance type is used automatically. responses: "200": description: Cluster modified schema: $ref: "./definitions.yaml#/definitions/V4ClusterDetailsResponse" "401": $ref: "./responses.yaml#/responses/V4Generic401Response" "404": description: Cluster not found schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" examples: application/json: { "code": "RESOURCE_NOT_FOUND", "message": "The cluster with ID 'wqtlq' could not be found, or perhaps you do not have access to it. Please make sure the cluster ID is correct, and that you are a member of the organization that it belongs to." } default: description: error schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" delete: operationId: deleteCluster tags: - clusters parameters: - $ref: './parameters.yaml#/parameters/RequiredGiantSwarmAuthorizationHeader' - $ref: './parameters.yaml#/parameters/XRequestIDHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmActivityHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmCmdLineHeader' - $ref: "./parameters.yaml#/parameters/ClusterIdPathParameter" summary: Delete cluster description: | This operation allows to delete a cluster. __Caution:__ Deleting a cluster causes the termination of all workloads running on the cluster. Data stored on the worker nodes will be lost. There is no way to undo this operation. The response is sent as soon as the request is validated. At that point, workloads might still be running on the cluster and may be accessible for a little wile, until the cluster is actually deleted. responses: "202": description: Deleting cluster schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" examples: application/json: { "code": "RESOURCE_DELETION_STARTED", "message": "The cluster with ID 'wqtlq' is being deleted." } "401": $ref: "./responses.yaml#/responses/V4Generic401Response" "404": description: Cluster not found schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" examples: application/json: { "code": "RESOURCE_NOT_FOUND", "message": "The cluster with ID 'wqtlq' could not be found, or perhaps you do not have access to it. Please make sure the cluster ID is correct, and that you are a member of the organization that it belongs to." } default: description: error schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" /v4/clusters/{cluster_id}/key-pairs/: get: operationId: getKeyPairs tags: - key pairs summary: Get key pairs description: | Returns a list of information on all key pairs of a cluster as an array. The individual array items contain metadata on the key pairs, but neither the key nor the certificate. These can only be obtained upon creation, using the [addKeypair](#operation/addKeyPair) operation. parameters: - $ref: './parameters.yaml#/parameters/RequiredGiantSwarmAuthorizationHeader' - $ref: './parameters.yaml#/parameters/XRequestIDHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmActivityHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmCmdLineHeader' - $ref: "./parameters.yaml#/parameters/ClusterIdPathParameter" responses: "200": description: Key pairs schema: $ref: "./definitions.yaml#/definitions/V4GetKeyPairsResponse" "401": $ref: "./responses.yaml#/responses/V4Generic401Response" default: description: error schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" post: operationId: addKeyPair tags: - key pairs summary: Create key pair parameters: - $ref: './parameters.yaml#/parameters/RequiredGiantSwarmAuthorizationHeader' - $ref: './parameters.yaml#/parameters/XRequestIDHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmActivityHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmCmdLineHeader' - $ref: "./parameters.yaml#/parameters/ClusterIdPathParameter" - name: body in: body required: true description: | While the `ttl_hours` attribute is optional and will be set to a default value when omitted, the `description` is mandatory. schema: $ref: "./definitions.yaml#/definitions/V4AddKeyPairRequest" x-examples: application/json: { "description": "Admin key pair lasting twelve hours", "ttl_hours": 12, "certificate_organizations": "system:masters" } description: | This operation allows to create a new key pair for accessing a specific cluster. A key pair consists of an unencrypted private RSA key and an X.509 certificate. In addition, when obtaining a key pair for a cluster, the cluster's certificate authority file (CA certificate) is delivered, which is required by TLS clients to establish trust to the cluster. In addition to the credentials itself, a key pair has some metadata like a unique ID, a creation timestamp and a free text `description` that you can use at will, for example to note for whom a key pair has been issued. ### Customizing the certificate's subject for K8s RBAC It is possible to set the Common Name and Organization fields of the generated certificate's subject. - `cn_prefix`: The certificate's common name uses this format: `.user.`. `clusterdomain` is specific to your cluster and is not editable. The `cn_prefix` however is editable. When left blank it will default to the email address of the Giant Swarm user that is performing the create key pair request. The common name is used as the username for requests to the Kubernetes API. This allows you to set up role-based access controls. - `certificate_organizations`: This will set the certificate's `organization` fields. Use a comma separated list of values. The Kubernetes API will use these values as group memberships. __Note:__ The actual credentials coming with the key pair (key, certificate) can only be accessed once, as the result of the `POST` request that triggers their creation. This restriction exists to minimize the risk of credentials being leaked. If you fail to capture the credentials upon creation, you'll have to repeat the creation request. responses: "200": description: Success schema: $ref: "./definitions.yaml#/definitions/V4AddKeyPairResponse" examples: application/json: { "certificate_authority_data": "-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----", "client_key_data": "-----BEGIN RSA PRIVATE KEY-----...-----END RSA PRIVATE KEY-----", "client_certificate_data": "-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----", "create_date": "2016-06-01T12:00:00.000Z", "description": "Key pair description", "id": "02:cc:da:f9:fb:ce:c3:e5:e1:f6:27:d8:43:48:0d:37:4a:ee:b9:67", "ttl_hours": 8640 } "401": $ref: "./responses.yaml#/responses/V4Generic401Response" /v4/organizations/: get: operationId: getOrganizations tags: - organizations summary: Get organizations description: | This operation allows to fetch a list of organizations the user is a member of. In the case of an admin user, the result includes all existing organizations. parameters: - $ref: './parameters.yaml#/parameters/RequiredGiantSwarmAuthorizationHeader' - $ref: './parameters.yaml#/parameters/XRequestIDHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmActivityHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmCmdLineHeader' responses: "200": description: Success schema: type: array items: $ref: "./definitions.yaml#/definitions/V4OrganizationListItem" examples: application/json: [ {"id": "acme"}, {"id": "giantswarm"}, {"id": "testorg"} ] "401": $ref: "./responses.yaml#/responses/V4Generic401Response" default: description: Error schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" /v4/organizations/{organization_id}/: get: operationId: getOrganization tags: - organizations summary: Get organization details description: | This operation fetches organization details. parameters: - $ref: './parameters.yaml#/parameters/RequiredGiantSwarmAuthorizationHeader' - $ref: './parameters.yaml#/parameters/XRequestIDHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmActivityHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmCmdLineHeader' - $ref: "./parameters.yaml#/parameters/OrganizationIdPathParameter" responses: "200": description: Organization details schema: $ref: "./definitions.yaml#/definitions/V4Organization" examples: application/json: { "id": "acme", "members": [ {"email": "user1@example.com"}, {"email": "user2@example.com"} ] } "401": $ref: "./responses.yaml#/responses/V4Generic401Response" "404": description: Organization not found schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" examples: application/json: { "code": "RESOURCE_NOT_FOUND", "message": "The organization could not be found. (not found: the organization with id 'acme' could not be found)" } default: description: Error schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" put: operationId: addOrganization tags: - organizations summary: Create an organization description: | This operation allows a user to create an organization. parameters: - $ref: './parameters.yaml#/parameters/RequiredGiantSwarmAuthorizationHeader' - $ref: './parameters.yaml#/parameters/XRequestIDHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmActivityHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmCmdLineHeader' - $ref: "./parameters.yaml#/parameters/OrganizationIdPathParameter" - name: body in: body required: true schema: $ref: "./definitions.yaml#/definitions/V4Organization" x-examples: application/json: { "id": "string", "members": [ {"email": "myself@example.com"}, {"email": "colleague@example.com"} ] } responses: "201": description: Organization created schema: $ref: "./definitions.yaml#/definitions/V4Organization" examples: application/json: { "id": "acme", "members": [ {"email": "user1@example.com"}, {"email": "user2@example.com"} ] } "401": $ref: "./responses.yaml#/responses/V4Generic401Response" "409": description: Organization already exists schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" examples: application/json: { "code": "RESOURCE_ALREADY_EXISTS", "message": "The organization could not be created. (org already exists)" } default: description: Error schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" patch: operationId: modifyOrganization tags: - organizations parameters: - $ref: './parameters.yaml#/parameters/RequiredGiantSwarmAuthorizationHeader' - $ref: './parameters.yaml#/parameters/XRequestIDHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmActivityHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmCmdLineHeader' - $ref: "./parameters.yaml#/parameters/OrganizationIdPathParameter" - name: body in: body required: true schema: type: object properties: members: type: array description: List of members that belong to this organization items: $ref: "./definitions.yaml#/definitions/V4OrganizationMember" x-examples: application/merge-patch+json: { "members": [{"email": "myself@example.com"}] } summary: Modify organization description: | This operation allows you to modify an existing organization. You must be a member of the organization or an admin in order to use this endpoint. The following attributes can be modified: - `members`: By modifying the array of members, members can be added to or removed from the organization The request body must conform with the [JSON Patch Merge (RFC 7386)](https://tools.ietf.org/html/rfc7386) standard. Requests have to be sent with the `Content-Type: application/merge-patch+json` header. The full request must be valid before it will be executed, currently this means every member you attempt to add to the organization must actually exist in the system. If any member you attempt to add is invalid, the entire patch operation will fail, no members will be added or removed, and an error message will explain which members in your request are invalid. responses: "200": description: Organization modified schema: $ref: "./definitions.yaml#/definitions/V4Organization" "400": description: Invalid input schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" examples: application/json: { "code": "INVALID_INPUT", "message": "The organization could not be modified. (invalid input: user 'invalid-email' does not exist or is invalid)" } "401": $ref: "./responses.yaml#/responses/V4Generic401Response" "404": description: Organization not found schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" examples: application/json: { "code": "RESOURCE_NOT_FOUND", "message": "The organization could not be modified. (not found: the organization with id 'acme' could not be found)" } default: description: error schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" delete: operationId: deleteOrganization tags: - organizations summary: Delete an organization description: | This operation allows a user to delete an organization that they are a member of. Admin users can delete any organization. parameters: - $ref: './parameters.yaml#/parameters/RequiredGiantSwarmAuthorizationHeader' - $ref: './parameters.yaml#/parameters/XRequestIDHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmActivityHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmCmdLineHeader' - $ref: "./parameters.yaml#/parameters/OrganizationIdPathParameter" responses: "200": description: Organization deleted schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" examples: application/json: { "code": "RESOURCE_DELETED", "message": "The organization with ID 'acme' has been deleted." } "401": $ref: "./responses.yaml#/responses/V4Generic401Response" "404": description: Organization not found schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" examples: application/json: { "code": "RESOURCE_NOT_FOUND", "message": "The organization could not be deleted. (not found: the organization with id 'acme' could not be found)" } default: description: Error schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" /v4/organizations/{organization_id}/credentials/: post: operationId: addCredentials tags: - organizations summary: Set credentials description: | Add a set of credentials to the organization allowing the creation and operation of clusters within a cloud provider account/subscription. The actual type of these credentials depends on the cloud provider the installation is running on. Currently, only AWS is supported, with support for Azure being planned for the near future. Credentials in an organization are immutable. Each organization can only have one set of credentials. Once credentials have been set for an organization, they are used for every new cluster that will be created for the organization. ### Example request body for AWS ```json { "provider": "aws", "aws": { "roles": { "admin": "arn:aws:iam::123456789012:role/GiantSwarmAdmin", "awsoperator": "arn:aws:iam::123456789012:role/GiantSwarmAWSOperator" } } } ``` parameters: - $ref: './parameters.yaml#/parameters/RequiredGiantSwarmAuthorizationHeader' - $ref: './parameters.yaml#/parameters/XRequestIDHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmActivityHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmCmdLineHeader' - $ref: "./parameters.yaml#/parameters/OrganizationIdPathParameter" - name: body in: body required: true schema: $ref: "./definitions.yaml#/definitions/V4AddCredentialsRequest" x-examples: application/json: { "provider": "aws", "aws": { "roles": { "admin": "arn:aws:iam::123456789012:role/GiantSwarmAdmin", "awsoperator": "arn:aws:iam::123456789012:role/GiantSwarmAWSOperator" } } } responses: "201": description: Credentials created headers: Location: type: string description: URI of the new credentials resource schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" examples: application/json: { "code": "RESOURCE_CREATED", "message": "A new set of credentials has been created with ID '5d9h4'" } "401": $ref: "./responses.yaml#/responses/V4Generic401Response" "409": description: Conflict schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" examples: application/json: { "code": "RESOURCE_ALREADY_EXISTS", "message": "The organisation already has a set of credentials" } default: description: error schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" /v4/releases/: get: operationId: getReleases tags: - releases summary: Get releases description: | Lists all releases available for new clusters or for upgrading existing clusters. Might also serve as an archive to obtain details on older releases. parameters: - $ref: './parameters.yaml#/parameters/RequiredGiantSwarmAuthorizationHeader' - $ref: './parameters.yaml#/parameters/XRequestIDHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmActivityHeader' - $ref: './parameters.yaml#/parameters/XGiantSwarmCmdLineHeader' responses: "200": description: Releases list schema: type: array items: $ref: "./definitions.yaml#/definitions/V4ReleaseListItem" examples: application/json: [ { "version": "1.14.9", "timestamp": "2017-09-21T08:14:03.37759Z", "changelog": [ { "component": "kubernetes", "description": "Security fixes" }, { "component": "calico", "description": "Security fixes" } ], "components": [ { "name": "kubernetes", "version": "1.5.8" }, { "name": "calico", "version": "0.9.1" } ], "active": false }, { "version": "2.8.4", "timestamp": "2017-11-11T12:24:56.59969Z", "changelog": [ { "component": "calico", "description": "Bugfix" } ], "components": [ { "name": "kubernetes", "version": "1.7.3" }, { "name": "calico", "version": "1.1.1" } ], "active": true } ] "401": $ref: "./responses.yaml#/responses/V4Generic401Response" analysis-0.21.1/fixtures/bugs/1621/parameters.yaml000066400000000000000000000027031413705513100216510ustar00rootroot00000000000000parameters: RequiredGiantSwarmAuthorizationHeader: name: Authorization type: string in: header required: true description: As described in the [authentication](#section/Authentication) section ClusterIdPathParameter: name: cluster_id in: path required: true type: string description: Cluster ID UserEmailPathParameter: name: email in: path required: true type: string description: The user's email address OrganizationIdPathParameter: name: organization_id in: path required: true type: string description: | An ID for the organization. This ID must be unique and match this regular expression: ^[a-z0-9_]{4,30}$ XRequestIDHeader: name: X-Request-ID in: header type: string required: false description: | A randomly generated key that can be used to track a request throughout services of Giant Swarm. XGiantSwarmActivityHeader: name: X-Giant-Swarm-Activity in: header type: string required: false description: | Name of an activity to track, like "list-clusters". This allows to analyze several API requests sent in context and gives an idea on the purpose. XGiantSwarmCmdLineHeader: name: X-Giant-Swarm-CmdLine in: header type: string required: false description: | If activity has been issued by a CLI, this header can contain the command line analysis-0.21.1/fixtures/bugs/1621/responses.yaml000066400000000000000000000005411413705513100215250ustar00rootroot00000000000000responses: V4Generic401Response: description: Permission denied schema: $ref: "./definitions.yaml#/definitions/V4GenericResponse" examples: application/json: { "code": "PERMISSION_DENIED", "message": "The requested resource cannot be accessed using the provided authentication details." } analysis-0.21.1/fixtures/bugs/1767/000077500000000000000000000000001413705513100166335ustar00rootroot00000000000000analysis-0.21.1/fixtures/bugs/1767/Identifier.yaml000066400000000000000000000006141413705513100216020ustar00rootroot00000000000000type: object title: "Identifier" description: "v3.1.0-12545" properties: use: type: string example: "usual" enum: - "usual" - "official" - "temp" - "secondary" - "old" system: type: string value: description: "Some unique value" type: string assigner: description: "Organization" allOf: - $ref: 'Reference.yaml' required: - use analysis-0.21.1/fixtures/bugs/1767/Patient.yaml000066400000000000000000000005461413705513100211300ustar00rootroot00000000000000type: object title: "Info about patient" description: "" properties: id: type: string identifier: type: array description: "Identifier" items: allOf: - $ref: 'Identifier.yaml' active: type: boolean name: description: "Name" type: string required: - name analysis-0.21.1/fixtures/bugs/1767/Reference.yaml000066400000000000000000000007161413705513100214210ustar00rootroot00000000000000type: object title: "reference" description: "v3.1.0-12545" properties: reference: description: "Literal reference, Relative, internal or absolute URL" type: string example: "literal reference" identifier: description: "Logical reference, when literal reference is not known" allOf: - $ref: 'Identifier.yaml' display: type: string description: "Text alternative for the resource" analysis-0.21.1/fixtures/bugs/1767/fixture-1767.yaml000066400000000000000000000015211413705513100216060ustar00rootroot00000000000000--- swagger: '2.0' info: version: "1.0.0" title: FHIR API description: | #### FHIR API schemes: - http host: "fhir.test.lan" basePath: / parameters: patientID: name: patientID in: path description: "patient ID" type: string required: true paths: /Patient/{patientID}: parameters: - $ref: "#/parameters/patientID" get: tags: - fhir produces: - application/fhir+json consumes: - application/fhir+json responses: 200: $ref: "#/responses/Patient" put: tags: - fhir produces: - application/fhir+json consumes: - application/fhir+json responses: 200: $ref: "#/responses/Patient" responses: Patient: description: "Patient" schema: allOf: - $ref: 'Patient.yaml' analysis-0.21.1/fixtures/bugs/1774/000077500000000000000000000000001413705513100166315ustar00rootroot00000000000000analysis-0.21.1/fixtures/bugs/1774/AccessToken.yaml000066400000000000000000000002621413705513100217170ustar00rootroot00000000000000type: object properties: value: type: string issuedAt: type: string format: datetime signature: type: string required: - value - issuedAt - signature analysis-0.21.1/fixtures/bugs/1774/Credentials.yaml000066400000000000000000000004031413705513100217470ustar00rootroot00000000000000# User type: object properties: username: type: string example: "Testuser" description: "A username of the user" password: type: string example: "123Test!" description: "A password of the user" required: - username - password analysis-0.21.1/fixtures/bugs/1774/Data.yaml000066400000000000000000000002761413705513100203730ustar00rootroot00000000000000# Data type: object properties: name: type: string example: "Test User" description: "A name of the user" credentials: $ref: "./Credentials.yaml" required: - credentials analysis-0.21.1/fixtures/bugs/1774/Error.yaml000066400000000000000000000012521413705513100206060ustar00rootroot00000000000000# Error type: object properties: code: type: string description: "Error code" example: RESOURCE_NOT_FOUND message: type: string description: "Error message" example: "Requested resource not found" target: type: string description: "Related resource" example: "/products/42" details: type: object properties: code: type: string description: "Detailed error code" example: "MongoDB:2038" message: type: string description: "Detailed error message" example: "MongoDB: no document with ObjectID 42" required: - code - message required: - code - message analysis-0.21.1/fixtures/bugs/1774/Roles.yaml000066400000000000000000000001731413705513100206020ustar00rootroot00000000000000# Roles type: array items: type: string enum: - ADMIN - USER example: "User" description: "A role of the user" analysis-0.21.1/fixtures/bugs/1774/User.yaml000066400000000000000000000004111413705513100204270ustar00rootroot00000000000000# User type: object properties: id: type: string format: uuid readOnly: true example: "87dcb276-d495-11e8-b06f-54ee75efd688" description: "An ID of the user" data: $ref: "./Data.yaml" roles: $ref: "./Roles.yaml" required: - data analysis-0.21.1/fixtures/bugs/1774/Users.yaml000066400000000000000000000001611413705513100206140ustar00rootroot00000000000000# Users type: object properties: users: type: array items: $ref: "./User.yaml" required: - users analysis-0.21.1/fixtures/bugs/1774/def_api.yaml000066400000000000000000000160031413705513100211040ustar00rootroot00000000000000swagger: "2.0" info: description: >- REST API for the User Management Service version: "1" title: "User Management" termsOfService: "Experimental, no SLA" contact: email: "development@bbgo.org" license: name: "Apache 2.0" url: "http://www.apache.org/licenses/LICENSE-2.0.html" # host: "localhost" basePath: "/user-service/v1" tags: - name: User description: "User" - name: Token description: "Token" schemes: - "https" - "http" paths: /users: post: tags: - User summary: "an operation to register a new user" description: >- Registers a new user operationId: "registerUser" consumes: - "application/json" produces: - "application/json" parameters: - name: payload in: body description: >- Data for the user to be registered schema: $ref: "./Data.yaml" required: true responses: 201: description: Created headers: Location: description: URI of the registered resource type: string #format: uri ETag: description: >- Fingerprint of the created resource type: string schema: $ref: "./User.yaml" 400: $ref: "./responses.yaml#/400" 401: $ref: "./responses.yaml#/401" 403: $ref: "./responses.yaml#/403" 500: $ref: "./responses.yaml#/500" get: tags: - User summary: Get all users description: >- Get all users operationId: "getUsers" produces: - "application/json" parameters: - $ref: "./parameters.yaml#/filter" - $ref: "./parameters.yaml#/top" - $ref: "./parameters.yaml#/skip" - $ref: "./parameters.yaml#/search" responses: 200: description: OK schema: $ref: "./Users.yaml" 400: $ref: "./responses.yaml#/400" 401: $ref: "./responses.yaml#/401" 403: $ref: "./responses.yaml#/403" 404: $ref: "./responses.yaml#/404" 500: $ref: "./responses.yaml#/500" security: - tokenAuth: [ADMIN, USER] /users/{id}: get: tags: - User summary: "Retrieve a user by ID" description: >- Returns user operationId: "getUser" produces: - "application/json" parameters: - in: path name: "id" description: "User ID" type: string required: true responses: 200: description: OK headers: ETag: description: >- Fingerprint of the user object retrieved type: string schema: $ref: "./User.yaml" 400: $ref: "./responses.yaml#/400" 401: $ref: "./responses.yaml#/401" 403: $ref: "./responses.yaml#/403" 404: $ref: "./responses.yaml#/404" 500: $ref: "./responses.yaml#/500" security: - tokenAuth: [ADMIN, USER] delete: tags: - User summary: Deletes a user description: >- Deletes a user operationId: deleteUser parameters: - name: id in: path description: ID of a user to delete required: true type: "string" responses: 204: $ref: "./responses.yaml#/204" 400: $ref: "./responses.yaml#/400" 401: $ref: "./responses.yaml#/401" 403: $ref: "./responses.yaml#/403" 404: $ref: "./responses.yaml#/404" 500: $ref: "./responses.yaml#/500" security: - tokenAuth: [ADMIN, USER] /users/{id}/data: put: tags: - User summary: Update an existing user data description: >- Updates data for an existing user operationId: updateData consumes: - application/json produces: - application/json parameters: - in: path name: id description: ID of the user to update type: string required: true - in: body name: payload description: User data to be updated required: true schema: $ref: "./Data.yaml" - $ref: "./parameters.yaml#/ifmatch" responses: 200: description: OK headers: ETag: description: "Fingerprint of the user object updated" type: string schema: $ref: "./User.yaml" 400: $ref: "./responses.yaml#/400" 401: $ref: "./responses.yaml#/401" 403: $ref: "./responses.yaml#/403" 404: $ref: "./responses.yaml#/404" 412: $ref: "./responses.yaml#/412" 500: $ref: "./responses.yaml#/500" security: - tokenAuth: [ADMIN, USER] /users/{id}/roles: put: tags: - User summary: Update roles for an existing user description: >- Updates roles for an existing user operationId: updateRoles consumes: - application/json produces: - application/json parameters: - in: path name: id description: ID of the user to update type: string required: true - in: body name: payload description: User roles to be updated required: true schema: $ref: "./Roles.yaml" - $ref: "./parameters.yaml#/ifmatch" responses: 200: description: OK headers: ETag: description: "Fingerprint of the user object updated" type: string schema: $ref: "./User.yaml" 400: $ref: "./responses.yaml#/400" 401: $ref: "./responses.yaml#/401" 403: $ref: "./responses.yaml#/403" 404: $ref: "./responses.yaml#/404" 412: $ref: "./responses.yaml#/412" 500: $ref: "./responses.yaml#/500" security: - tokenAuth: [ADMIN, USER] /token: post: tags: - Token summary: Issues a token for an authenticated user description: >- Issues a token for an authenticated user operationId: issueToken produces: - application/json responses: 200: description: OK schema: $ref: "./AccessToken.yaml" 400: $ref: "./responses.yaml#/400" 401: $ref: "./responses.yaml#/401" 403: $ref: "./responses.yaml#/403" 404: $ref: "./responses.yaml#/404" 412: $ref: "./responses.yaml#/412" 500: $ref: "./responses.yaml#/500" security: - basicAuth: [] securityDefinitions: basicAuth: type: basic tokenAuth: type: apiKey in: header name: Authorizationanalysis-0.21.1/fixtures/bugs/1774/parameters.yaml000066400000000000000000000021501413705513100216560ustar00rootroot00000000000000top: name: $top in: query description: >- Show only the first N elements, where N is a positive integer. If a value less than 0 is specified, the URI should be considered malformed. type: integer minimum: 0 required: false skip: name: $skip in: query description: >- Skip the first N elements, where N is a positive integer as specified by this query option. If a value less than 0 is specified, the URI should be considered malformed. type: integer minimum: 0 required: false search: name: $search in: query description: Free text search on selected entity. type: string required: false filter: name: $filter in: query description: >- Causes returning only entities, for those the filter condition evaluates true. type: string required: false etag: name: ETag in: header description: Known fingerprint of the entity type: string required: false ifmatch: name: If-Match in: header description: >- The request will succeed if the value equals to the current fingerprint of the entity on the server side. type: string required: false analysis-0.21.1/fixtures/bugs/1774/responses.yaml000066400000000000000000000030051413705513100215340ustar00rootroot00000000000000204: description: No Content 400: description: Bad Request schema: $ref: './Error.yaml' examples: application/json: code: MISSING_PARAMETERS message: >- Required parameters missing or incorrect. 401: description: Unauthorized headers: WWW_Authenticate: type: string schema: $ref: './Error.yaml' examples: application/json: code: UNAUTHORIZED message: >- To access API you have to login 403: description: Forbidden schema: $ref: './Error.yaml' examples: application/json: code: FORBIDDEN message: >- Insufficient privileges to access API 404: description: Not Found schema: $ref: './Error.yaml' examples: application/json: code: RESOURCE_NOT_FOUND message: >- Requested resource not found 412: description: Precondition Failed schema: $ref: "./Error.yaml" examples: application/json: code: CONCURRENT_MODIFICATION message: >- The resource was modified in the meanwhile 500: description: Internal server error schema: $ref: './Error.yaml' examples: application/json: code: INTERNAL_SERVER_ERROR message: >- Internal server error occurred, retry after some time. In case the issue persists contact your system administrator 501: description: Not Implemented schema: $ref: './Error.yaml' examples: application/json: code: FEATURE_NOT_IMPLEMENTED message: Requested feature is not implemented. analysis-0.21.1/fixtures/bugs/1796/000077500000000000000000000000001413705513100166355ustar00rootroot00000000000000analysis-0.21.1/fixtures/bugs/1796/models/000077500000000000000000000000001413705513100201205ustar00rootroot00000000000000analysis-0.21.1/fixtures/bugs/1796/models/pair.json000066400000000000000000000011021413705513100217400ustar00rootroot00000000000000{ "Pair": { "description": "Simple key value pair model that is used by some of the other models.", "type": "object", "required": ["key", "value"], "properties": { "key": { "type": "string" }, "value": { "type": "string" } }, "x-go-type": { "import": { "package": "bitbucket.di2e.net/scm/pir/ab-models.git", "alias": "abmodels" }, "type": "Pair" } } }analysis-0.21.1/fixtures/bugs/1796/models/query.json000066400000000000000000000035351413705513100221660ustar00rootroot00000000000000{ "Query": { "description": "Represents a search query using a boolean expression tree", "type": "object", "properties": { "queryRoot": { "$ref": "#/QueryNode" }, "limit": { "type": "integer", "format": "int64" }, "offset": { "type": "integer", "format": "int64" } }, "x-go-type": { "import": { "package": "bitbucket.di2e.net/scm/pir/ab-models.git", "alias": "models" }, "type": "Query" } }, "QueryNode": { "description": "Node in a boolean expression tree that represents a query", "type": "object", "properties": { "and": { "type": "array", "items": { "$ref": "#/QueryNode" } }, "or": { "type": "array", "items": { "$ref": "#/QueryNode" } }, "not": { "type": "array", "items": { "$ref": "#/QueryNode" } }, "wildcards": { "description": "Array of key/value pairs representing wildcard term matches", "type": "array", "items": { "$ref": "./pair.json#/Pair" } }, "exact": { "description": "Array of key/value pairs representing exact term matches", "type": "array", "items": { "$ref": "./pair.json#/Pair" } } }, "x-go-type": { "import": { "package": "bitbucket.di2e.net/scm/pir/ab-models.git", "alias": "models" }, "type": "QueryNode" } } }analysis-0.21.1/fixtures/bugs/1796/queryIssue.json000066400000000000000000000031351413705513100217100ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "Query Model Issue", "description": "Test for Query Model Issue", "version": "0.0.1" }, "schemes": ["http"], "produces": ["application/json"], "paths": { "/search": { "post": { "operationId": "searchObject", "tags": ["Query"], "produces": ["application/json"], "consumes": ["application/json"], "security": [ { "Bearer": [] } ], "summary": "Get a list of the algorithms available in the AlgorithmBank instance. By default returns the first 10 results.", "parameters": [ { "name": "query", "in": "body", "required": true, "schema": { "$ref": "./models/query.json#/Query" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "string" } }, "400": { "description": "Invalid parameters." }, "401": { "description": "Unauthenticated." }, "403": { "description": "User is not authorized to perform the action", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } } }, "definitions": { } } analysis-0.21.1/fixtures/bugs/1851/000077500000000000000000000000001413705513100166255ustar00rootroot00000000000000analysis-0.21.1/fixtures/bugs/1851/definitions-3.yaml000066400000000000000000000007311413705513100221650ustar00rootroot00000000000000definitions: ServerStatus: type: string enum: [OK, Not OK] Server: type: object properties: Name: type: string Status: $ref: '#/definitions/ServerStatus' # introduce a circular ref here SiblingServer: $ref: '#/definitions/Server' # introduce a nest ref here RemoteProps: $ref: 'definitions-31.yaml#/definitions/RemoteProperty' # TODO: same with absolute ref (e.g. http://...) analysis-0.21.1/fixtures/bugs/1851/definitions-31.yaml000066400000000000000000000005401413705513100222440ustar00rootroot00000000000000definitions: RemoteProperty: type: object properties: RemoteName: type: string MoreRemoteName: $ref: 'remote/definitions-32.yaml#/definitions/MoreRemoteProperty' # introduce a circular ref here RemoteCircular: $ref: '#/definitions/RemoteProperty' # TODO: same with circular in a remote analysis-0.21.1/fixtures/bugs/1851/definitions.yaml000066400000000000000000000003131413705513100220210ustar00rootroot00000000000000definitions: ServerStatus: type: string enum: [OK, Not OK] Server: type: object properties: Name: type: string Status: $ref: '#/definitions/ServerStatus' analysis-0.21.1/fixtures/bugs/1851/fixture-1851-2.yaml000066400000000000000000000016131413705513100217330ustar00rootroot00000000000000swagger: '2.0' info: title: 'Title' version: '1.0' paths: '/': get: responses: 200: description: OK response schema: $ref: '#/definitions/Response' post: parameters: - in: body schema: $ref: '#/definitions/Request' name: filter responses: 200: description: OK response schema: $ref: '#/definitions/Response' definitions: Response: type: object properties: Server: type: array items: $ref: '#/definitions/Server' Request: type: object properties: ServerStatus: $ref: '#/definitions/ServerStatus' ServerStatus: type: string enum: [OK, Not OK] Server: type: object properties: Name: type: string Status: $ref: '#/definitions/ServerStatus' analysis-0.21.1/fixtures/bugs/1851/fixture-1851-3.yaml000066400000000000000000000013601413705513100217330ustar00rootroot00000000000000swagger: '2.0' info: title: 'Title' version: '1.0' paths: '/': get: responses: 200: description: OK response schema: $ref: '#/definitions/Response' post: parameters: - in: body schema: $ref: '#/definitions/Request' name: filter responses: 200: description: OK response schema: $ref: '#/definitions/Response' definitions: Response: type: object properties: Server: type: array items: $ref: 'definitions-3.yaml#/definitions/Server' Request: type: object properties: ServerStatus: $ref: 'definitions-3.yaml#/definitions/ServerStatus' analysis-0.21.1/fixtures/bugs/1851/fixture-1851.yaml000066400000000000000000000013541413705513100215760ustar00rootroot00000000000000swagger: '2.0' info: title: 'Title' version: '1.0' paths: '/': get: responses: 200: description: OK response schema: $ref: '#/definitions/Response' post: parameters: - in: body schema: $ref: '#/definitions/Request' name: filter responses: 200: description: OK response schema: $ref: '#/definitions/Response' definitions: Response: type: object properties: Server: type: array items: $ref: 'definitions.yaml#/definitions/Server' Request: type: object properties: ServerStatus: $ref: 'definitions.yaml#/definitions/ServerStatus' analysis-0.21.1/fixtures/bugs/1851/remote/000077500000000000000000000000001413705513100201205ustar00rootroot00000000000000analysis-0.21.1/fixtures/bugs/1851/remote/definitions-32.yaml000066400000000000000000000000641413705513100235410ustar00rootroot00000000000000definitions: MoreRemoteProperty: type: string analysis-0.21.1/fixtures/bugs/2092/000077500000000000000000000000001413705513100166235ustar00rootroot00000000000000analysis-0.21.1/fixtures/bugs/2092/definitions/000077500000000000000000000000001413705513100211365ustar00rootroot00000000000000analysis-0.21.1/fixtures/bugs/2092/definitions/addresses.yaml000066400000000000000000000001021413705513100237700ustar00rootroot00000000000000address: type: object properties: id: type: integer analysis-0.21.1/fixtures/bugs/2092/definitions/response.yaml000066400000000000000000000001351413705513100236570ustar00rootroot00000000000000ok: type: object required: - "message" properties: message: type: string analysis-0.21.1/fixtures/bugs/2092/definitions/teams.yaml000066400000000000000000000006531413705513100231370ustar00rootroot00000000000000teamupdate: type: object properties: id: type: string home_address: $ref: './addresses.yaml#/address' invoice_address: $ref: './addresses.yaml#/address' members: type: array items: $ref: "./user.yaml#/user" settings: $ref: "./teams.yaml#/teampatchsettings" teampatchsettings: type: object properties: a: type: string b: type: string analysis-0.21.1/fixtures/bugs/2092/definitions/user.yaml000066400000000000000000000001451413705513100230000ustar00rootroot00000000000000user: type: object properties: id: type: integer readOnly: true x-order: 1 analysis-0.21.1/fixtures/bugs/2092/swagger.yaml000066400000000000000000000010131413705513100211410ustar00rootroot00000000000000consumes: - application/json produces: - application/json schemes: - http - https swagger: "2.0" info: description: Descr title: Titl version: 2.0.0 paths: /users: get: summary: dummy path, in order to have a path. responses: "200": description: (empty) schema: $ref: '#/definitions/user' definitions: ok: $ref: ./definitions/response.yaml#/ok teamupdate: $ref: ./definitions/teams.yaml#/teamupdate user: $ref: ./definitions/user.yaml#/user analysis-0.21.1/fixtures/bugs/2113/000077500000000000000000000000001413705513100166155ustar00rootroot00000000000000analysis-0.21.1/fixtures/bugs/2113/base.yaml000066400000000000000000000003021413705513100204060ustar00rootroot00000000000000swagger: "2.0" info: version: "1" title: "nested $ref fixture" paths: /dummy: $ref: ./schemas/api/api.yaml#/paths/~1dummy /example: $ref: ./schemas/api/api.yaml#/paths/~1example analysis-0.21.1/fixtures/bugs/2113/schemas/000077500000000000000000000000001413705513100202405ustar00rootroot00000000000000analysis-0.21.1/fixtures/bugs/2113/schemas/api/000077500000000000000000000000001413705513100210115ustar00rootroot00000000000000analysis-0.21.1/fixtures/bugs/2113/schemas/api/api.yaml000066400000000000000000000005121413705513100224440ustar00rootroot00000000000000swagger: "2.0" info: version: "1" title: "sub api" paths: /dummy: get: responses: 200: description: OK schema: $ref: ../dummy/dummy.yaml /example: get: responses: 200: description: OK schema: $ref: ../example/example.yaml analysis-0.21.1/fixtures/bugs/2113/schemas/dummy/000077500000000000000000000000001413705513100213735ustar00rootroot00000000000000analysis-0.21.1/fixtures/bugs/2113/schemas/dummy/dummy.yaml000066400000000000000000000001101413705513100234020ustar00rootroot00000000000000required: - dummyPayload properties: dummyPayload: type: string analysis-0.21.1/fixtures/bugs/2113/schemas/example/000077500000000000000000000000001413705513100216735ustar00rootroot00000000000000analysis-0.21.1/fixtures/bugs/2113/schemas/example/example.yaml000066400000000000000000000001571413705513100242150ustar00rootroot00000000000000$schema: http://json-schema.org/draft-07/schema# required: - payload properties: payload: type: string analysis-0.21.1/fixtures/bugs/bitbucket.json000066400000000000000000007422251413705513100211120ustar00rootroot00000000000000{ "info": { "termsOfService": "https://www.atlassian.com/end-user-agreement", "version": "2.0", "contact": { "url": "https://bitbucket.org/support", "name": "Bitbucket Support", "email": "support@bitbucket.org" }, "description": "Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework.", "title": "Bitbucket API" }, "paths": { "/repositories/{username}/{repo_slug}/refs/branches/{name}": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "name", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "refs" ] } }, "/teams/{username}/following": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" } ], "get": { "security": [ { "oauth2": [ "account" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the list of accounts this team is following.", "responses": { "200": { "description": "A paginated list of user objects.", "schema": { "$ref": "#/definitions/paginated_users" } }, "404": { "description": "If no team exists for the specified name, or if the specified account is a personal account, not a team account.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "string", "description": "The team's username", "name": "username", "in": "path" } ], "tags": [ "teams" ] } }, "/repositories/{username}/{repo_slug}/commit/{sha}/comments/{comment_id}": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "sha", "in": "path" }, { "required": true, "type": "string", "name": "comment_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the specified commit comment.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "commits" ] } }, "/repositories/{username}/{repo_slug}/hooks": { "post": { "security": [ { "oauth2": [ "webhook" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Creates a new webhook on the specified repository.", "responses": { "201": { "description": "If the webhook was registered successfully.", "schema": { "$ref": "#/definitions/webhook_subscription" } }, "403": { "description": "If the authenticated user does not have permission to install webhooks on the specified repository.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the repository does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "webhooks" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" } ], "get": { "security": [ { "oauth2": [ "webhook" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns a paginated list of webhooks installed on this repository.", "responses": { "200": { "description": "The paginated list of installed webhooks.", "schema": { "$ref": "#/definitions/paginated_webhook_subscriptions" } }, "403": { "description": "If the authenticated user does not have permission to access the webhooks.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the repository does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "webhooks" ] } }, "/repositories/{username}/{repo_slug}/issues/{issue_id}/attachments/{path}": { "delete": { "security": [ { "oauth2": [ "issue:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Deletes an attachment.", "responses": { "401": { "description": "If the issue tracker is private and the request was not authenticated." }, "404": { "description": "If the specified repository, issue, or attachment does not exist, or if the repository doesn't have the issue tracker enabled.", "schema": { "$ref": "#/definitions/error" } }, "204": { "description": "Indicates that the deletion was successful" } }, "parameters": [], "tags": [ "issue_tracker" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "issue_id", "in": "path" }, { "required": true, "type": "string", "name": "path", "in": "path" } ], "get": { "security": [ { "oauth2": [ "issue" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the contents of the specified file attachment.\n\nNote that this endpoint does not return a JSON response, but instead\nreturns a redirect pointing to the actual file that in turn will return\nthe raw contents.\n\nThe redirect URL contains a one-time token that has a limited lifetime.\nAs a result, the link should not be persisted, stored, or shared.", "responses": { "401": { "description": "If the issue tracker is private and the request was not authenticated." }, "404": { "description": "If the specified repository or issue does not exist, or if the repository doesn't have the issue tracker enabled.", "schema": { "$ref": "#/definitions/error" } }, "302": { "headers": { "Location": { "type": "string" } }, "description": "A redirect to the file's contents" } }, "parameters": [], "tags": [ "issue_tracker" ] } }, "/repositories/{username}/{repo_slug}/versions/{version_id}": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "version_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "issue" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the specified issue tracker version object.", "responses": { "200": { "description": "The specified version object.", "schema": { "$ref": "#/definitions/version" } }, "404": { "description": "If the specified repository or version does not exist, or if the repository doesn't have the issue tracker enabled.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "integer", "description": "The version's id", "name": "version_id", "in": "path" } ], "tags": [ "issue_tracker" ] } }, "/repositories/{username}/{repo_slug}/issues/{issue_id}/vote": { "put": { "security": [ { "oauth2": [ "issue", "account:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Vote for this issue.\n\nTo cast your vote, do an empty PUT. The 204 status code indicates that\nthe operation was successful.", "responses": { "401": { "description": "When the request wasn't authenticated.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "When the issue does not exist, the repo does not exist, or when the repos does not have an issue tracker.", "schema": { "$ref": "#/definitions/error" } }, "204": { "description": "Indicating the authenticated user has cast their vote successfully.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "integer", "description": "The issue's id", "name": "issue_id", "in": "path" } ], "tags": [ "issue_tracker" ] }, "delete": { "security": [ { "oauth2": [ "issue:write", "account:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Retract your vote.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "integer", "description": "The issue's id", "name": "issue_id", "in": "path" } ], "tags": [ "issue_tracker" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "issue_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "issue", "account" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Check whether the authenticated user has voted for this issue.\nA 204 status code indicates that the user has voted, while a 404\nimplies they haven't.", "responses": { "401": { "description": "When the request wasn't authenticated.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the authenticated user has not voted for this issue, or when the repo does not exist, or does not have an issue tracker.", "schema": { "$ref": "#/definitions/error" } }, "204": { "description": "If the authenticated user has not voted for this issue.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "integer", "description": "The issue's id", "name": "issue_id", "in": "path" } ], "tags": [ "issue_tracker" ] } }, "/repositories/{username}/{repo_slug}/milestones": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" } ], "get": { "security": [ { "oauth2": [ "issue" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the milestones that have been defined in the issue tracker.\n\nThis resource is only available on repositories that have the issue\ntracker enabled.", "responses": { "200": { "description": "The milestones that have been defined in the issue tracker.", "schema": { "$ref": "#/definitions/paginated_milestones" } }, "404": { "description": "If the specified repository does not exist, or if the repository doesn't have the issue tracker enabled.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "issue_tracker" ] } }, "/repositories/{username}/{repo_slug}/components": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" } ], "get": { "security": [ { "oauth2": [ "issue" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the components that have been defined in the issue tracker.\n\nThis resource is only available on repositories that have the issue\ntracker enabled.", "responses": { "200": { "description": "The components that have been defined in the issue tracker.", "schema": { "$ref": "#/definitions/paginated_components" } }, "404": { "description": "If the specified repository does not exist, or if the repository doesn't have the issue tracker enabled.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "issue_tracker" ] } }, "/account/{username}/addons/{encoded_context_id}/refresh": { "put": { "security": [ { "oauth2": [ "account:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "addon" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "encoded_context_id", "in": "path" } ] }, "/addon/linkers/{linker_key}/values": { "put": { "security": [ { "oauth2": [] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "addon" ] }, "post": { "security": [ { "oauth2": [] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "addon" ] }, "delete": { "security": [ { "oauth2": [] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "addon" ] }, "parameters": [ { "required": true, "type": "string", "name": "linker_key", "in": "path" } ], "get": { "security": [ { "oauth2": [] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "addon" ] } }, "/repositories/{username}/{repo_slug}/refs/branches": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "refs" ] } }, "/hook_events/{subject_type}": { "parameters": [ { "required": true, "type": "string", "name": "subject_type", "in": "path" } ], "get": { "security": [ { "oauth2": [] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns a paginated list of all valid webhook events for the\nspecified entity.\n\nThis is public data that does not require any scopes or authentication.", "responses": { "200": { "description": "A paginated list of webhook types available to subscribe on.", "schema": { "$ref": "#/definitions/paginated_hook_events" } }, "404": { "description": "If an invalid `{subject_type}` value was specified.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "enum": [ "user", "repository", "team" ], "name": "subject_type", "required": true, "in": "path", "type": "string", "description": "A resource or subject type." } ], "tags": [ "webhooks" ] } }, "/users/{username}/followers": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" } ], "get": { "security": [ { "oauth2": [] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the list of accounts that are following this team.", "responses": { "200": { "description": "A paginated list of user objects.", "schema": { "$ref": "#/definitions/paginated_users" } }, "404": { "description": "If no account exists for the specified name, or if the specified account is a team account, not a personal account.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "string", "description": "The account's username", "name": "username", "in": "path" } ], "tags": [ "users" ] } }, "/repositories/{username}/{repo_slug}/default-reviewers": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository:admin" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the repository's default reviewers.\n\nThese are the users that are automatically added as reviewers on every\nnew pull request that is created.", "responses": { "200": { "description": "The paginated list of default reviewers" } }, "parameters": [], "tags": [ "pullrequests" ] } }, "/repositories/{username}/{repo_slug}/downloads/{filename}": { "delete": { "security": [ { "oauth2": [ "repository:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Deletes the specified download artifact from the repository.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "downloads" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "filename", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Return a redirect to the contents of a download artifact.\n\nThis endpoint returns the actual file contents and not the artifact's\nmetadata.\n\n $ curl -s -L https://api.bitbucket.org/2.0/repositories/evzijst/git-tests/downloads/hello.txt\n Hello World", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "downloads" ] } }, "/repositories/{username}/{repo_slug}/commit/{node}/statuses/build/{key}": { "put": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "node", "in": "path" }, { "required": true, "type": "string", "name": "key", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [] } }, "/repositories/{username}/{repo_slug}/watchers": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns a paginated list of all the watchers on the specified\nrepository.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "repositories" ] } }, "/snippets/{username}/{encoded_id}/commits": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "encoded_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "snippet" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the changes (commits) made on this snippet.", "responses": { "200": { "description": "The paginated list of snippet commits.", "schema": { "$ref": "#/definitions/paginated_snippet_commit" } }, "403": { "description": "If the authenticated user does not have access to the snippet.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the snippet does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "snippets" ] } }, "/users/{username}/repositories": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "All repositories owned by a user/team. This includes private\nrepositories, but filtered down to the ones that the calling user has\naccess to.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "users", "teams" ] } }, "/repositories/{username}/{repo_slug}/pullrequests/activity": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" } ], "get": { "security": [ { "oauth2": [ "pullrequest" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the pull request's activity log. This includes comments that\nwere made by the reviewers, updates and approvals.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "pullrequests" ] } }, "/snippets/{username}/{encoded_id}/comments/{comment_id}": { "put": { "security": [ { "oauth2": [ "snippet" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Updates a comment.\n\nComments can only be updated by their author.", "responses": { "200": { "description": "The updated comment object." }, "403": { "description": "If the authenticated user does not have access to the snippet.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the comment or snippet does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "snippets" ] }, "delete": { "security": [ { "oauth2": [ "snippet" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Deletes a snippet comment.\n\nComments can only be removed by their author.", "responses": { "204": { "description": "Indicates the comment was deleted successfully." }, "403": { "description": "If the authenticated user is not the author of the comment.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the comment or the snippet does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "snippets" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "encoded_id", "in": "path" }, { "required": true, "type": "string", "name": "comment_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "snippet" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the specific snippet comment.", "responses": { "200": { "description": "The specified comment.", "schema": { "$ref": "#/definitions/snippet_comment" } }, "403": { "description": "If the authenticated user does not have access to the snippet.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the comment or snippet does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "snippets" ] } }, "/repositories/{username}/{repo_slug}/diff/{spec}": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "spec", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "commits" ] } }, "/repositories/{username}/{repo_slug}/branch-restrictions": { "post": { "security": [ { "oauth2": [ "repository:admin" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "branch_restrictions" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository:admin" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "branch_restrictions" ] } }, "/repositories/{username}/{repo_slug}/issues/{issue_id}/comments/{comment_id}": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "issue_id", "in": "path" }, { "required": true, "type": "string", "name": "comment_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "issue" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the specified issue comment object.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "issue_tracker" ] } }, "/repositories/{username}/{repo_slug}/hooks/{uid}": { "put": { "security": [ { "oauth2": [ "webhook" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Updates the specified webhook subscription.\n\nThe following properties can be mutated:\n\n* `description`\n* `url`\n* `active`\n* `events`", "responses": { "200": { "description": "The webhook subscription object.", "schema": { "$ref": "#/definitions/webhook_subscription" } }, "403": { "description": "If the authenticated user does not have permission to update the webhook.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the webhook or repository does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "string", "description": "The installed webhook's id", "name": "uid", "in": "path" } ], "tags": [ "webhooks" ] }, "delete": { "security": [ { "oauth2": [ "webhook" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Deletes the specified webhook subscription.", "responses": { "204": { "description": "When the webhook was deleted successfully", "schema": { "$ref": "#/definitions/webhook_subscription" } }, "403": { "description": "If the authenticated user does not have permission to delete the webhook.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the webhook or repository does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "string", "description": "The installed webhook's id", "name": "uid", "in": "path" } ], "tags": [ "webhooks" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "uid", "in": "path" } ], "get": { "security": [ { "oauth2": [ "webhook" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the webhook installed on the specified repository.", "responses": { "200": { "description": "The webhook subscription object.", "schema": { "$ref": "#/definitions/webhook_subscription" } }, "404": { "description": "If the webhook or repository does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "string", "description": "The installed webhook's id.", "name": "uid", "in": "path" } ], "tags": [ "webhooks" ] } }, "/users/{username}": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" } ], "get": { "security": [ { "oauth2": [] }, { "basic": [] }, { "api_key": [] } ], "description": "Gets the public information associated with a user account.\n\nIf the user's profile is private, `location`, `website` and\n`created_on` elements are omitted.", "responses": { "200": { "description": "The user object", "schema": { "$ref": "#/definitions/team" } }, "404": { "description": "If no user exists for the specified name or UUID, or if the specified account is a team account, not a personal account.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "string", "description": "The account's username or UUID.", "name": "username", "in": "path" } ], "tags": [ "users" ] } }, "/snippets/{username}/{encoded_id}": { "put": { "responses": { "200": { "description": "The updated snippet object.", "schema": { "$ref": "#/definitions/snippet" } }, "401": { "description": "If the snippet is private and the request was not authenticated.", "schema": { "$ref": "#/definitions/error" } }, "403": { "description": "If authenticated user does not have permission to update the private snippet.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the snippet does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "string", "description": "The snippet's id.", "name": "encoded_id", "in": "path" } ], "tags": [ "snippets" ], "produces": [ "application/json", "multipart/related", "multipart/form-data" ], "security": [ { "oauth2": [ "snippet:write" ] }, { "basic": [] }, { "api_key": [] } ], "consumes": [ "application/json", "multipart/related", "multipart/form-data" ], "description": "Used to update a snippet. Use this to add and delete files and to\nchange a snippet's title.\n\nTo update a snippet, one can either PUT a full snapshot, or only the\nparts that need to be changed.\n\nThe contract for PUT on this API is that properties missing from the\nrequest remain untouched so that snippets can be efficiently\nmanipulated with differential payloads.\n\nTo delete a property (e.g. the title, or a file), include its name in\nthe request, but omit its value (use `null`).\n\nAs in Git, explicit renaming of files is not supported. Instead, to\nrename a file, delete it and add it again under another name. This can\nbe done atomically in a single request. Rename detection is left to\nthe SCM.\n\nPUT supports three different content types for both request and\nresponse bodies:\n\n* `application/json`\n* `multipart/related`\n* `multipart/form-data`\n\nThe content type used for the request body can be different than that\nused for the response. Content types are specified using standard HTTP\nheaders.\n\nUse the `Content-Type` and `Accept` headers to select the desired\nrequest and response format.\n\n\napplication/json\n----------------\n\nAs with creation and retrieval, the content type determines what\nproperties can be manipulated. `application/json` does not support\nfile contents and is therefore limited to a snippet's meta data.\n\nTo update the title, without changing any of its files:\n\n $ curl -X POST -H \"Content-Type: application/json\" https://api.bitbucket.org/2.0/snippets/evzijst/kypj -d '{\"title\": \"Updated title\"}'\n\n\nTo delete the title:\n\n $ curl -X POST -H \"Content-Type: application/json\" https://api.bitbucket.org/2.0/snippets/evzijst/kypj -d '{\"title\": null}'\n\nNot all parts of a snippet can be manipulated. The owner and creator\nfor instance are immutable.\n\n\nmultipart/related\n-----------------\n\n`multipart/related` can be used to manipulate all of a snippet's\nproperties. The body is identical to a POST. properties omitted from\nthe request are left unchanged. Since the `start` part contains JSON,\nthe mechanism for manipulating the snippet's meta data is identical\nto `application/json` requests.\n\nTo update one of a snippet's file contents, while also changing its\ntitle:\n\n PUT /2.0/snippets/evzijst/kypj HTTP/1.1\n Content-Length: 288\n Content-Type: multipart/related; start=\"snippet\"; boundary=\"===============1438169132528273974==\"\n MIME-Version: 1.0\n\n --===============1438169132528273974==\n Content-Type: application/json; charset=\"utf-8\"\n MIME-Version: 1.0\n Content-ID: snippet\n\n {\n \"title\": \"My updated snippet\",\n \"files\": {\n \"foo.txt\": {}\n }\n }\n\n --===============1438169132528273974==\n Content-Type: text/plain; charset=\"us-ascii\"\n MIME-Version: 1.0\n Content-Transfer-Encoding: 7bit\n Content-ID: \"foo.txt\"\n Content-Disposition: attachment; filename=\"foo.txt\"\n\n Updated file contents.\n\n --===============1438169132528273974==--\n\nHere only the parts that are changed are included in the body. The\nother files remain untouched.\n\nNote the use of the `files` list in the JSON part. This list contains\nthe files that are being manipulated. This list should have\ncorresponding multiparts in the request that contain the new contents\nof these files.\n\nIf a filename in the `files` list does not have a corresponding part,\nit will be deleted from the snippet, as shown below:\n\n PUT /2.0/snippets/evzijst/kypj HTTP/1.1\n Content-Length: 188\n Content-Type: multipart/related; start=\"snippet\"; boundary=\"===============1438169132528273974==\"\n MIME-Version: 1.0\n\n --===============1438169132528273974==\n Content-Type: application/json; charset=\"utf-8\"\n MIME-Version: 1.0\n Content-ID: snippet\n\n {\n \"files\": {\n \"image.png\": {}\n }\n }\n\n --===============1438169132528273974==--\n\nTo simulate a rename, delete a file and add the same file under\nanother name:\n\n PUT /2.0/snippets/evzijst/kypj HTTP/1.1\n Content-Length: 212\n Content-Type: multipart/related; start=\"snippet\"; boundary=\"===============1438169132528273974==\"\n MIME-Version: 1.0\n\n --===============1438169132528273974==\n Content-Type: application/json; charset=\"utf-8\"\n MIME-Version: 1.0\n Content-ID: snippet\n\n {\n \"files\": {\n \"foo.txt\": {},\n \"bar.txt\": {}\n }\n }\n\n --===============1438169132528273974==\n Content-Type: text/plain; charset=\"us-ascii\"\n MIME-Version: 1.0\n Content-Transfer-Encoding: 7bit\n Content-ID: \"bar.txt\"\n Content-Disposition: attachment; filename=\"bar.txt\"\n\n foo\n\n --===============1438169132528273974==--\n\n\nmultipart/form-data\n-----------------\n\nAgain, one can also use `multipart/form-data` to manipulate file\ncontents and meta data atomically.\n\n $ curl -X PUT http://localhost:12345/2.0/snippets/evzijst/kypj -F title=\"My updated snippet\" -F file=@foo.txt\n\n PUT /2.0/snippets/evzijst/kypj HTTP/1.1\n Content-Length: 351\n Content-Type: multipart/form-data; boundary=----------------------------63a4b224c59f\n\n ------------------------------63a4b224c59f\n Content-Disposition: form-data; name=\"file\"; filename=\"foo.txt\"\n Content-Type: text/plain\n\n foo\n\n ------------------------------63a4b224c59f\n Content-Disposition: form-data; name=\"title\"\n\n My updated snippet\n ------------------------------63a4b224c59f\n\nTo delete a file, omit its contents while including its name in the\n`files` field:\n\n $ curl -X PUT https://api.bitbucket.org/2.0/snippets/evzijst/kypj -F files=image.png\n\n PUT /2.0/snippets/evzijst/kypj HTTP/1.1\n Content-Length: 149\n Content-Type: multipart/form-data; boundary=----------------------------ef8871065a86\n\n ------------------------------ef8871065a86\n Content-Disposition: form-data; name=\"files\"\n\n image.png\n ------------------------------ef8871065a86--\n\nThe explicit use of the `files` element in `multipart/related` and\n`multipart/form-data` is only required when deleting files.\nThe default mode of operation is for file parts to be processed,\nregardless of whether or not they are listed in `files`, as a\nconvenience to the client." }, "delete": { "security": [ { "oauth2": [ "snippet:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Deletes a snippet and returns an empty response.", "responses": { "401": { "description": "If the snippet is private and the request was not authenticated.", "schema": { "$ref": "#/definitions/error" } }, "403": { "description": "If authenticated user does not have permission to delete the private snippet.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the snippet does not exist.", "schema": { "$ref": "#/definitions/error" } }, "204": { "description": "If the snippet was deleted successfully." } }, "parameters": [ { "required": true, "type": "string", "description": "The snippet's id.", "name": "encoded_id", "in": "path" } ], "tags": [ "snippets" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "encoded_id", "in": "path" } ], "get": { "responses": { "200": { "description": "The snippet object.", "schema": { "$ref": "#/definitions/snippet" } }, "401": { "description": "If the snippet is private and the request was not authenticated.", "schema": { "$ref": "#/definitions/error" } }, "403": { "description": "If authenticated user does not have access to the private snippet.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the snippet does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "string", "description": "The snippet's id.", "name": "encoded_id", "in": "path" } ], "produces": [ "application/json", "multipart/related", "multipart/form-data" ], "tags": [ "snippets" ], "security": [ { "oauth2": [ "snippet" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Retrieves a single snippet.\n\nSnippets support multiple content types:\n\n* application/json\n* multipart/related\n* multipart/form-data\n\n\napplication/json\n----------------\n\nThe default content type of the response is `application/json`.\nSince JSON is always `utf-8`, it cannot reliably contain file contents\nfor files that are not text. Therefore, JSON snippet documents only\ncontain the filename and links to the file contents.\n\nThis means that in order to retrieve all parts of a snippet, N+1\nrequests need to be made (where N is the number of files in the\nsnippet).\n\n\nmultipart/related\n-----------------\n\nTo retrieve an entire snippet in a single response, use the\n`Accept: multipart/related` HTTP request header.\n\n $ curl -H \"Accept: multipart/related\" https://api.bitbucket.org/2.0/snippets/evzijst/1\n\nResponse:\n\n HTTP/1.1 200 OK\n Content-Length: 2214\n Content-Type: multipart/related; start=\"snippet\"; boundary=\"===============1438169132528273974==\"\n MIME-Version: 1.0\n\n --===============1438169132528273974==\n Content-Type: application/json; charset=\"utf-8\"\n MIME-Version: 1.0\n Content-ID: snippet\n\n {\n \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj\"\n },\n \"html\": {\n \"href\": \"https://bitbucket.org/snippets/evzijst/kypj\"\n },\n \"comments\": {\n \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj/comments\"\n },\n \"watchers\": {\n \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj/watchers\"\n },\n \"commits\": {\n \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj/commits\"\n }\n },\n \"id\": kypj,\n \"title\": \"My snippet\",\n \"created_on\": \"2014-12-29T22:22:04.790331+00:00\",\n \"updated_on\": \"2014-12-29T22:22:04.790331+00:00\",\n \"is_private\": false,\n \"files\": {\n \"foo.txt\": {\n \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj/files/367ab19/foo.txt\"\n },\n \"html\": {\n \"href\": \"https://bitbucket.org/snippets/evzijst/kypj#foo.txt\"\n }\n }\n },\n \"image.png\": {\n \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj/files/367ab19/image.png\"\n },\n \"html\": {\n \"href\": \"https://bitbucket.org/snippets/evzijst/kypj#image.png\"\n }\n }\n }\n ],\n \"owner\": {\n \"username\": \"evzijst\",\n \"display_name\": \"Erik van Zijst\",\n \"uuid\": \"{d301aafa-d676-4ee0-88be-962be7417567}\",\n \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/users/evzijst\"\n },\n \"html\": {\n \"href\": \"https://bitbucket.org/evzijst\"\n },\n \"avatar\": {\n \"href\": \"https://bitbucket-staging-assetroot.s3.amazonaws.com/c/photos/2013/Jul/31/erik-avatar-725122544-0_avatar.png\"\n }\n }\n },\n \"creator\": {\n \"username\": \"evzijst\",\n \"display_name\": \"Erik van Zijst\",\n \"uuid\": \"{d301aafa-d676-4ee0-88be-962be7417567}\",\n \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/users/evzijst\"\n },\n \"html\": {\n \"href\": \"https://bitbucket.org/evzijst\"\n },\n \"avatar\": {\n \"href\": \"https://bitbucket-staging-assetroot.s3.amazonaws.com/c/photos/2013/Jul/31/erik-avatar-725122544-0_avatar.png\"\n }\n }\n }\n }\n\n --===============1438169132528273974==\n Content-Type: text/plain; charset=\"us-ascii\"\n MIME-Version: 1.0\n Content-Transfer-Encoding: 7bit\n Content-ID: \"foo.txt\"\n Content-Disposition: attachment; filename=\"foo.txt\"\n\n foo\n\n --===============1438169132528273974==\n Content-Type: image/png\n MIME-Version: 1.0\n Content-Transfer-Encoding: base64\n Content-ID: \"image.png\"\n Content-Disposition: attachment; filename=\"image.png\"\n\n iVBORw0KGgoAAAANSUhEUgAAABQAAAAoCAYAAAD+MdrbAAABD0lEQVR4Ae3VMUoDQRTG8ccUaW2m\n TKONFxArJYJamCvkCnZTaa+VnQdJSBFl2SMsLFrEWNjZBZs0JgiL/+KrhhVmJRbCLPx4O+/DT2TB\n cbblJxf+UWFVVRNsEGAtgvJxnLm2H+A5RQ93uIl+3632PZyl/skjfOn9Gvdwmlcw5aPUwimG+NT5\n EnNN036IaZePUuIcK533NVfal7/5yjWeot2z9ta1cAczHEf7I+3J0ws9Cgx0fsOFpmlfwKcWPuBQ\n 73Oc4FHzBaZ8llq4q1mr5B2mOUCt815qYR8eB1hG2VJ7j35q4RofaH7IG+Xrf/PfJhfmwtfFYoIN\n AqxFUD6OMxcvkO+UfKfkOyXfKdsv/AYCHMLVkHAFWgAAAABJRU5ErkJggg==\n --===============1438169132528273974==--\n\nmultipart/form-data\n-------------------\n\nAs with creating new snippets, `multipart/form-data` can be used as an\nalternative to `multipart/related`. However, the inherently flat\nstructure of form-data means that only basic, root-level properties\ncan be returned, while nested elements like `links` are omitted:\n\n $ curl -H \"Accept: multipart/form-data\" https://api.bitbucket.org/2.0/snippets/evzijst/kypj\n\nResponse:\n\n HTTP/1.1 200 OK\n Content-Length: 951\n Content-Type: multipart/form-data; boundary=----------------------------63a4b224c59f\n\n ------------------------------63a4b224c59f\n Content-Disposition: form-data; name=\"title\"\n Content-Type: text/plain; charset=\"utf-8\"\n\n My snippet\n ------------------------------63a4b224c59f--\n Content-Disposition: attachment; name=\"file\"; filename=\"foo.txt\"\n Content-Type: text/plain\n\n foo\n\n ------------------------------63a4b224c59f\n Content-Disposition: attachment; name=\"file\"; filename=\"image.png\"\n Content-Transfer-Encoding: base64\n Content-Type: application/octet-stream\n\n iVBORw0KGgoAAAANSUhEUgAAABQAAAAoCAYAAAD+MdrbAAABD0lEQVR4Ae3VMUoDQRTG8ccUaW2m\n TKONFxArJYJamCvkCnZTaa+VnQdJSBFl2SMsLFrEWNjZBZs0JgiL/+KrhhVmJRbCLPx4O+/DT2TB\n cbblJxf+UWFVVRNsEGAtgvJxnLm2H+A5RQ93uIl+3632PZyl/skjfOn9Gvdwmlcw5aPUwimG+NT5\n EnNN036IaZePUuIcK533NVfal7/5yjWeot2z9ta1cAczHEf7I+3J0ws9Cgx0fsOFpmlfwKcWPuBQ\n 73Oc4FHzBaZ8llq4q1mr5B2mOUCt815qYR8eB1hG2VJ7j35q4RofaH7IG+Xrf/PfJhfmwtfFYoIN\n AqxFUD6OMxcvkO+UfKfkOyXfKdsv/AYCHMLVkHAFWgAAAABJRU5ErkJggg==\n ------------------------------5957323a6b76--" } }, "/addon/linkers": { "parameters": [], "get": { "security": [ { "oauth2": [] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "addon" ] } }, "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/comments/{comment_id}": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "pull_request_id", "in": "path" }, { "required": true, "type": "string", "name": "comment_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "pullrequest" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns a specific pull request comment.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "pullrequests" ] } }, "/repositories/{username}/{repo_slug}/components/{component_id}": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "component_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "issue" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the specified issue tracker component object.", "responses": { "200": { "description": "The specified component object.", "schema": { "$ref": "#/definitions/component" } }, "404": { "description": "If the specified repository or component does not exist, or if the repository doesn't have the issue tracker enabled.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "integer", "description": "The component's id", "name": "component_id", "in": "path" } ], "tags": [ "issue_tracker" ] } }, "/addon": { "put": { "security": [ { "oauth2": [] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "addon" ] }, "parameters": [], "delete": { "security": [ { "oauth2": [] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "addon" ] } }, "/users/{username}/following": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" } ], "get": { "security": [ { "oauth2": [ "account" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the list of accounts this user is following.", "responses": { "200": { "description": "A paginated list of user objects.", "schema": { "$ref": "#/definitions/paginated_users" } }, "404": { "description": "If no user exists for the specified name, or if the specified account is a team account, not a personal account.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "string", "description": "The user's username", "name": "username", "in": "path" } ], "tags": [ "users" ] } }, "/repositories/{username}/{repo_slug}/issues/{issue_id}": { "delete": { "security": [ { "oauth2": [ "issue:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Deletes the specified issue. This requires write access to the\nrepository.", "responses": { "200": { "description": "The issue object.", "schema": { "$ref": "#/definitions/issue" } }, "403": { "description": "When the authenticated user lacks isn't authorized to delete the issue tracker.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the specified repository or issue does not exist, or if the repository doesn't have the issue tracker enabled.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "issue_tracker" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "issue_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "issue" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the specified issue.", "responses": { "200": { "description": "The issue object.", "schema": { "$ref": "#/definitions/issue" } }, "403": { "description": "When the authenticated user lacks isn't authorized to access the issue tracker.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the specified repository or issue does not exist, or if the repository doesn't have the issue tracker enabled.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "issue_tracker" ] } }, "/teams/{username}/repositories": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "All repositories owned by a user/team. This includes private\nrepositories, but filtered down to the ones that the calling user has\naccess to.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "users", "teams" ] } }, "/repositories/{username}/{repo_slug}/downloads": { "post": { "security": [ { "oauth2": [ "repository:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Upload new download artifacts.\n\nTo upload files, perform a `multipart/form-data` POST containing one\nor more `files` fields:\n\n $ echo Hello World > hello.txt\n $ curl -s -u evzijst -X POST https://api.bitbucket.org/2.0/repositories/evzijst/git-tests/downloads -F files=@hello.txt\n\nWhen a file is uploaded with the same name as an existing artifact,\nthen the existing file will be replaced.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "downloads" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns a list of download links associated with the repository.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "downloads" ] } }, "/repositories/{username}/{repo_slug}/refs": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "refs" ] } }, "/hook_events": { "parameters": [], "get": { "security": [ { "oauth2": [] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the webhook resource or subject types on which webhooks can\nbe registered.\n\nEach resource/subject type contains an `event` link that returns the\npaginated list of specific events each individual subject type can\nemit.\n\nThis endpoint is publicly accessible and does not require\nauthentication or scopes.", "responses": { "200": { "description": "A mapping of resource/subject types pointing to their individual event types.", "schema": { "$ref": "#/definitions/subject_types" } } }, "parameters": [], "tags": [ "webhooks" ] } }, "/teams/{username}": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" } ], "get": { "security": [ { "oauth2": [] }, { "basic": [] }, { "api_key": [] } ], "description": "Gets the public information associated with a team.\n\nIf the team's profile is private, `location`, `website` and\n`created_on` elements are omitted.", "responses": { "200": { "description": "The team object", "schema": { "$ref": "#/definitions/team" } }, "404": { "description": "If no team exists for the specified name or UUID, or if the specified account is a personal account, not a team account.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "string", "description": "The team's username or UUID.", "name": "username", "in": "path" } ], "tags": [ "teams" ] } }, "/user/emails/{email}": { "parameters": [ { "required": true, "type": "string", "name": "email", "in": "path" } ], "get": { "security": [ { "oauth2": [ "email" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns details about a specific one of the authenticated user's\nemail addresses.\n\nDetails describe whether the address has been confirmed by the user and\nwhether it is the user's primary address or not.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "users" ] } }, "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/approve": { "post": { "security": [ { "oauth2": [ "pullrequest:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Approve the specified pull request as the authenticated user.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "pullrequests" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "pull_request_id", "in": "path" } ], "delete": { "security": [ { "oauth2": [ "pullrequest:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Redact the authenticated user's approval of the specified pull\nrequest.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "pullrequests" ] } }, "/repositories/{username}/{repo_slug}/patch/{spec}": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "spec", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "commits" ] } }, "/snippets/{username}/{encoded_id}/{node_id}/diff": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "encoded_id", "in": "path" }, { "required": true, "type": "string", "name": "node_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "snippet" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the diff of the specified commit against its first parent.\n\nNote that this resource is different in functionality from the `patch`\nresource.\n\nThe differences between a diff and a patch are:\n\n* patches have a commit header with the username, message, etc\n* diffs support the optional `path=foo/bar.py` query param to filter the\n diff to just that one file diff (not supported for patches)\n* for a merge, the diff will show the diff between the merge commit and\n its first parent (identical to how PRs work), while patch returns a\n response containing separate patches for each commit on the second\n parent's ancestry, up to the oldest common ancestor (identical to\n its reachability).\n\nNote that the character encoding of the contents of the diff is\nunspecified as Git and Mercurial do not track this, making it hard for\nBitbucket to reliably determine this.", "responses": { "200": { "description": "The raw diff contents." }, "403": { "description": "If the authenticated user does not have access to the snippet.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the snippet does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "type": "string", "description": "When used, only one the diff of the specified file will be returned.", "name": "path", "in": "query" }, { "required": true, "type": "string", "description": "The snippet id.", "name": "encoded_id", "in": "path" } ], "tags": [ "snippets" ] } }, "/repositories/{username}/{repo_slug}/forks": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns a paginated list of all the forks of the specified\nrepository.", "responses": { "200": { "description": "All forks.", "schema": { "$ref": "#/definitions/paginated_repositories" } } }, "parameters": [], "tags": [ "repositories" ] } }, "/repositories/{username}/{repo_slug}/issues": { "post": { "security": [ { "oauth2": [ "issue:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Creates a new issue.\n\nThis call requires authentication. Private repositories or private\nissue trackers require the caller to authenticate with an account that\nhas appropriate authorisation.\n\nThe authenticated user is used for the issue's `reporter` field.", "responses": { "201": { "headers": { "Location": { "type": "string", "description": "The (absolute) URL of the newly created issue." } }, "description": "The newly created issue.", "schema": { "$ref": "#/definitions/issue" } }, "403": { "description": "When the authenticated user lacks the privilege to create issues in the issue tracker.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the specified repository or version does not exist, or if the repository doesn't have the issue tracker enabled.", "schema": { "$ref": "#/definitions/error" } }, "401": { "description": "When the request wasn't authenticated.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "schema": { "$ref": "#/definitions/issue" }, "required": true, "description": "The new issue. Note that the only required element is `title`. All other elements can be omitted from the body.", "name": "_body", "in": "body" } ], "tags": [ "issue_tracker" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" } ], "get": { "security": [ { "oauth2": [ "issue" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the issues in the issue tracker.", "responses": { "200": { "description": "A paginated list of the issues matching any filter criteria that were provided.", "schema": { "$ref": "#/definitions/paginated_issues" } }, "404": { "description": "If the specified repository or version does not exist, or if the repository doesn't have the issue tracker enabled.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "issue_tracker" ] } }, "/repositories/{username}/{repo_slug}/issues/{issue_id}/attachments": { "post": { "security": [ { "oauth2": [ "issue:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Upload new issue attachments.\n\nTo upload files, perform a `multipart/form-data` POST containing one\nor more file fields.\n\nWhen a file is uploaded with the same name as an existing attachment,\nthen the existing file will be replaced.", "responses": { "400": { "description": "If no files were uploaded, or if the wrong `Content-Type` was used." }, "201": { "headers": { "Location": { "type": "string", "description": "The URL to the issue's collection of attachments." } }, "description": "An empty response document." }, "404": { "description": "If the specified repository or issue does not exist, or if the repository doesn't have the issue tracker enabled.", "schema": { "$ref": "#/definitions/error" } }, "401": { "description": "If the issue tracker is private and the request was not authenticated." } }, "parameters": [ { "required": true, "type": "integer", "description": "The issue's id", "name": "issue_id", "in": "path" } ], "tags": [ "issue_tracker" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "issue_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "issue" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns all attachments for this issue.\n\nThis returns the files' meta data. This does not return the files'\nactual contents.\n\nThe files are always ordered by their upload date.", "responses": { "200": { "description": "A paginated list of all attachments for this issue.", "schema": { "$ref": "#/definitions/paginated_issue_attachments" } }, "401": { "description": "If the issue tracker is private and the request was not authenticated." }, "404": { "description": "If the specified repository or version does not exist, or if the repository doesn't have the issue tracker enabled.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "integer", "description": "The issue's id", "name": "issue_id", "in": "path" } ], "tags": [ "issue_tracker" ] } }, "/repositories/{username}/{repo_slug}/versions": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" } ], "get": { "security": [ { "oauth2": [ "issue" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the versions that have been defined in the issue tracker.\n\nThis resource is only available on repositories that have the issue\ntracker enabled.", "responses": { "200": { "description": "The versions that have been defined in the issue tracker.", "schema": { "$ref": "#/definitions/paginated_versions" } }, "404": { "description": "If the specified repository does not exist, or if the repository doesn't have the issue tracker enabled.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "issue_tracker" ] } }, "/repositories/{username}/{repo_slug}/refs/tags/{name}": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "name", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "refs" ] } }, "/snippets/{username}/{encoded_id}/watch": { "put": { "security": [ { "oauth2": [ "snippet:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Used to start watching a specific snippet. Returns 204 (No Content).", "responses": { "401": { "description": "If the request was not authenticated.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the snippet does not exist.", "schema": { "$ref": "#/definitions/error" } }, "204": { "description": "Indicates the authenticated user is now watching the snippet.", "schema": { "$ref": "#/definitions/paginated_users" } } }, "parameters": [ { "required": true, "type": "string", "description": "The snippet id.", "name": "encoded_id", "in": "path" } ], "tags": [ "snippets" ] }, "delete": { "security": [ { "oauth2": [ "snippet:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Used to stop watching a specific snippet. Returns 204 (No Content)\nto indicate success.", "responses": { "401": { "description": "If the request was not authenticated.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the snippet does not exist.", "schema": { "$ref": "#/definitions/error" } }, "204": { "description": "Indicates the user stopped watching the snippet successfully.", "schema": { "$ref": "#/definitions/paginated_users" } } }, "parameters": [ { "required": true, "type": "string", "description": "The snippet id.", "name": "encoded_id", "in": "path" } ], "tags": [ "snippets" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "encoded_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "snippet" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Used to check if the current user is watching a specific snippet.\n\nReturns 204 (No Content) if the user is watching the snippet and 404 if\nnot.\n\nHitting this endpoint anonymously always returns a 404.", "responses": { "204": { "description": "If the authenticated user is watching the snippet.", "schema": { "$ref": "#/definitions/paginated_users" } }, "404": { "description": "If the snippet does not exist, or if the authenticated user is not watching the snippet.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "string", "description": "The snippet id.", "name": "encoded_id", "in": "path" } ], "tags": [ "snippets" ] } }, "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/diff": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "pull_request_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "pullrequest" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "pullrequests" ] } }, "/snippets": { "post": { "security": [ { "oauth2": [ "snippet:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Creates a new snippet under the authenticated user's account.\n\nSnippets can contain multiple files. Both text and binary files are\nsupported.\n\nThe simplest way to create a new snippet from a local file:\n\n $ curl -u username:password -X POST https://api.bitbucket.org/2.0/snippets -F file=@image.png\n\nCreating snippets through curl has a few limitations and so let's look\nat a more complicated scenario.\n\nSnippets are created with a multipart POST. Both `multipart/form-data`\nand `multipart/related` are supported. Both allow the creation of\nsnippets with both meta data (title, etc), as well as multiple text\nand binary files.\n\nThe main difference is that `multipart/related` can use rich encoding\nfor the meta data (currently JSON).\n\n\nmultipart/related (RFC-2387)\n----------------------------\n\nThis is the most advanced and efficient way to create a paste.\n\n POST /2.0/snippets/evzijst HTTP/1.1\n Content-Length: 1188\n Content-Type: multipart/related; start=\"snippet\"; boundary=\"===============1438169132528273974==\"\n MIME-Version: 1.0\n\n --===============1438169132528273974==\n Content-Type: application/json; charset=\"utf-8\"\n MIME-Version: 1.0\n Content-ID: snippet\n\n {\n \"title\": \"My snippet\",\n \"is_private\": true,\n \"scm\": \"hg\",\n \"files\": {\n \"foo.txt\": {},\n \"image.png\": {}\n }\n }\n\n --===============1438169132528273974==\n Content-Type: text/plain; charset=\"us-ascii\"\n MIME-Version: 1.0\n Content-Transfer-Encoding: 7bit\n Content-ID: \"foo.txt\"\n Content-Disposition: attachment; filename=\"foo.txt\"\n\n foo\n\n --===============1438169132528273974==\n Content-Type: image/png\n MIME-Version: 1.0\n Content-Transfer-Encoding: base64\n Content-ID: \"image.png\"\n Content-Disposition: attachment; filename=\"image.png\"\n\n iVBORw0KGgoAAAANSUhEUgAAABQAAAAoCAYAAAD+MdrbAAABD0lEQVR4Ae3VMUoDQRTG8ccUaW2m\n TKONFxArJYJamCvkCnZTaa+VnQdJSBFl2SMsLFrEWNjZBZs0JgiL/+KrhhVmJRbCLPx4O+/DT2TB\n cbblJxf+UWFVVRNsEGAtgvJxnLm2H+A5RQ93uIl+3632PZyl/skjfOn9Gvdwmlcw5aPUwimG+NT5\n EnNN036IaZePUuIcK533NVfal7/5yjWeot2z9ta1cAczHEf7I+3J0ws9Cgx0fsOFpmlfwKcWPuBQ\n 73Oc4FHzBaZ8llq4q1mr5B2mOUCt815qYR8eB1hG2VJ7j35q4RofaH7IG+Xrf/PfJhfmwtfFYoIN\n AqxFUD6OMxcvkO+UfKfkOyXfKdsv/AYCHMLVkHAFWgAAAABJRU5ErkJggg==\n --===============1438169132528273974==--\n\nThe request contains multiple parts and is structured as follows.\n\nThe first part is the JSON document that describes the snippet's\nproperties or meta data. It either has to be the first part, or the\nrequest's `Content-Type` header must contain the `start` parameter to\npoint to it.\n\nThe remaining parts are the files of which there can be zero or more.\nEach file part should contain the `Content-ID` MIME header through\nwhich the JSON meta data's `files` element addresses it. The value\nshould be the name of the file.\n\n`Content-Disposition` is an optional MIME header. The header's\noptional `filename` parameter can be used to specify the file name\nthat Bitbucket should use when writing the file to disk. When present,\n`filename` takes precedence over the value of `Content-ID`.\n\nWhen the JSON body omits the `files` element, the remaining parts are\nnot ignored. Instead, each file is added to the new snippet as if its\nname was explicitly linked (the use of the `files` elements is\nmandatory for some operations like deleting or renaming files).\n\n\nmultipart/form-data\n-------------------\n\nThe use of JSON for the snippet's meta data is optional. Meta data can\nalso be supplied as regular form fields in a more conventional\n`multipart/form-data` request:\n\n $ curl -X POST -u credentials https://api.bitbucket.org/2.0/snippets -F title=\"My snippet\" -F file=@foo.txt -F file=@image.png\n\n POST /2.0/snippets HTTP/1.1\n Content-Length: 951\n Content-Type: multipart/form-data; boundary=----------------------------63a4b224c59f\n\n ------------------------------63a4b224c59f\n Content-Disposition: form-data; name=\"file\"; filename=\"foo.txt\"\n Content-Type: text/plain\n\n foo\n\n ------------------------------63a4b224c59f\n Content-Disposition: form-data; name=\"file\"; filename=\"image.png\"\n Content-Type: application/octet-stream\n\n ?PNG\n\n IHDR?1??I.....\n ------------------------------63a4b224c59f\n Content-Disposition: form-data; name=\"title\"\n\n My snippet\n ------------------------------63a4b224c59f--\n\nHere the meta data properties are included as flat, top-level form\nfields. The file attachments use the `file` field name. To attach\nmultiple files, simply repeat the field.\n\nThe advantage of `multipart/form-data` over `multipart/related` is\nthat it can be easier to build clients.\n\nEssentially all properties are optional, `title` and `files` included.\n\n\nSharing and Visibility\n----------------------\n\nSnippets can be either public (visible to anyone on Bitbucket, as well\nas anonymous users), or private (visible only to the owner, creator\nand members of the team in case the snippet is owned by a team). This\nis controlled through the snippet's `is_private` element:\n\n* **is_private=false** -- everyone, including anonymous users can view\n the snippet\n* **is_private=true** -- only the owner and team members (for team\n snippets) can view it\n\nTo create the snippet under a team account, just append the team name\nto the URL (see `/2.0/snippets/{username}`).", "responses": { "201": { "headers": { "Location": { "type": "string", "description": "The URL of the newly created snippet." } }, "description": "The newly created snippet object.", "schema": { "$ref": "#/definitions/snippet" } }, "401": { "description": "If the request was not authenticated", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "schema": { "$ref": "#/definitions/snippet" }, "required": true, "description": "The new snippet object.", "name": "_body", "in": "body" } ], "tags": [ "snippets" ] }, "parameters": [], "get": { "security": [ { "oauth2": [ "snippet" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns all snippets. Like pull requests, repositories and teams, the\nfull set of snippets is defined by what the current user has access to.\n\nThis includes all snippets owned by the current user, but also all snippets\nowned by any of the teams the user is a member of, or snippets by other\nusers that the current user is either watching or has collaborated on (for\ninstance by commenting on it).\n\nTo limit the set of returned snippets, apply the\n`?role=[owner|contributor|member]` query parameter where the roles are\ndefined as follows:\n\n* `owner`: all snippets owned by the current user\n* `contributor`: all snippets owned by, or watched by the current user\n* `member`: owned by the user, their teams, or watched by the current user\n\nWhen no role is specified, all public snippets are returned, as well as all\nprivately owned snippets watched or commented on.\n\nThe returned response is a normal paginated JSON list. This endpoint\nonly supports `application/json` responses and no\n`multipart/form-data` or `multipart/related`. As a result, it is not\npossible to include the file contents.", "responses": { "200": { "description": "A paginated list of snippets.", "schema": { "$ref": "#/definitions/paginated_snippets" } }, "404": { "description": "If the snippet does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "enum": [ "owner", "contributor", "member" ], "name": "role", "required": false, "in": "query", "type": "string", "description": "Filter down the result based on the authenticated user's role (`owner`, `contributor`, or `member`)." } ], "tags": [ "snippets" ] } }, "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}": { "put": { "security": [ { "oauth2": [ "pullrequest:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Mutates the specified pull request.\n\nThis can be used to change the pull request's branches or description.\n\nOnly open pull requests can be mutated.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "pullrequests" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "pull_request_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "pullrequest" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the specified pull request.", "responses": { "200": { "description": "The pull request object", "schema": { "$ref": "#/definitions/pullrequest" } } }, "parameters": [], "tags": [ "pullrequests" ] } }, "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/comments": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "pull_request_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "pullrequest" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns all the pull request's comments.\n\nThis includes both global, inline comments and replies.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "pullrequests" ] } }, "/account/{username}/addons/{encoded_context_id}": { "put": { "security": [ { "oauth2": [ "account:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "addon" ] }, "delete": { "security": [ { "oauth2": [ "account:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "addon" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "encoded_context_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "account:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "addon" ] } }, "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/decline": { "post": { "security": [ { "oauth2": [ "pullrequest:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "pullrequests" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "pull_request_id", "in": "path" } ] }, "/user/emails": { "parameters": [], "get": { "security": [ { "oauth2": [ "email" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns all the authenticated user's email addresses. Both\nconfirmed and unconfirmed.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "users" ] } }, "/repositories/{username}/{repo_slug}/pullrequests": { "post": { "security": [ { "oauth2": [ "pullrequest:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Creates a new pull request.", "responses": { "201": { "headers": { "Location": { "type": "string", "description": "The URL of new newly created pull request." } }, "description": "The newly created pull request.", "schema": { "$ref": "#/definitions/pullrequest" } } }, "parameters": [ { "schema": { "$ref": "#/definitions/pullrequest" }, "required": false, "description": "The new pull request.\n\nThe request URL you POST to becomes the destination repository URL. For this reason, you must specify an explicit source repository in the request object if you want to pull from a different repository (fork).\n\nSince not all elements are required or even mutable, you only need to include the elements you want to initialize, such as the source branch and the title.", "name": "_body", "in": "body" } ], "tags": [ "pullrequests" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" } ], "get": { "security": [ { "oauth2": [ "pullrequest" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns all pull requests on the specified repository.\n\nBy default only open pull requests are returned. This can be controlled\nusing the `state` query parameter. To retrieve pull requests that are\nin one of multiple states, repeat the `state` parameter for each\nindividual state.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "enum": [ "MERGED", "SUPERSEDED", "OPEN", "DECLINED" ], "type": "string", "description": "Only return pull requests that in this state. This parameter can be repeated.", "name": "state", "in": "query" } ], "tags": [ "pullrequests" ] } }, "/repositories/{username}/{repo_slug}/commits": { "post": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Identical to `GET /repositories/{username}/{repo_slug}/commits`,\nexcept that POST allows clients to place the include and exclude\nparameters in the request body to avoid URL length issues.\n\n**Note that this resource does NOT support new commit creation.**", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "commits" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "These are the repository's commits. They are paginated and returned\nin reverse chronological order, similar to the output of `git log` and\n`hg log`. Like these tools, the DAG can be filtered.\n\n## GET /repositories/{username}/{repo_slug}/commits/\n\nReturns all commits in the repo in topological order (newest commit\nfirst). All branches and tags are included (similar to\n`git log --all` and `hg log`).\n\n## GET /repositories/{username}/{repo_slug}/commits/master\n\nReturns all commits on rev `master` (similar to `git log master`,\n`hg log master`).\n\n## GET /repositories/{username}/{repo_slug}/commits/dev?exclude=master\n\nReturns all commits on ref `dev`, except those that are reachable on\n`master` (similar to `git log dev ^master`).\n\n## GET /repositories/{username}/{repo_slug}/commits/?exclude=master\n\nReturns all commits in the repo that are not on master\n(similar to `git log --all ^master`).\n\n## GET /repositories/{username}/{repo_slug}/commits/?include=foo&include=bar&exclude=fu&exclude=fubar\n\nReturns all commits that are on refs `foo` or `bar`, but not on `fu` or\n`fubar` (similar to `git log foo bar ^fu ^fubar`).\n\nBecause the response could include a very large number of commits, it\nis paginated. Follow the 'next' link in the response to navigate to the\nnext page of commits. As with other paginated resources, do not\nconstruct your own links.\n\nWhen the include and exclude parameters are more than ca fit in a\nquery string, clients can use a `x-www-form-urlencoded` POST instead.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "commits" ] } }, "/repositories/{username}/{repo_slug}/commit/{sha}/comments": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "sha", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the commit's comments.\n\nThis includes both global and inline comments.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "commits" ] } }, "/repositories/{username}/{repo_slug}/commit/{revision}": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "revision", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the specified commit.", "responses": { "200": { "description": "The commit object", "schema": { "$ref": "#/definitions/commit" } }, "404": { "description": "If the specified commit or repository does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "string", "description": "The commit's SHA1.", "name": "revision", "in": "path" } ], "tags": [ "commits" ] } }, "/snippets/{username}": { "post": { "security": [ { "oauth2": [ "snippet:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Identical to `/snippets`, except that the new snippet will be\ncreated under the account specified in the path parameter `{username}`.", "responses": { "201": { "headers": { "Location": { "type": "string", "description": "The URL of the newly created snippet." } }, "description": "The newly created snippet object.", "schema": { "$ref": "#/definitions/snippet" } }, "403": { "description": "If the authenticated user does not have permission to create snippets under the specified account.", "schema": { "$ref": "#/definitions/error" } }, "401": { "description": "If the request was not authenticated", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "schema": { "$ref": "#/definitions/snippet" }, "required": true, "description": "The new snippet object.", "name": "_body", "in": "body" } ], "tags": [ "snippets" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" } ], "get": { "security": [ { "oauth2": [ "snippet" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Identical to `/snippets`, except that the result is further filtered\nby the snippet owner and only those that are owned by `{username}` are\nreturned.", "responses": { "200": { "description": "A paginated list of snippets.", "schema": { "$ref": "#/definitions/paginated_snippets" } }, "404": { "description": "If the user does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "enum": [ "owner", "contributor", "member" ], "name": "role", "required": false, "in": "query", "type": "string", "description": "Filter down the result based on the authenticated user's role (`owner`, `contributor`, or `member`)." }, { "required": true, "type": "string", "description": "Limits the result to snippets owned by this user.", "name": "username", "in": "path" } ], "tags": [ "snippets" ] } }, "/repositories/{username}/{repo_slug}/issues/{issue_id}/watch": { "put": { "security": [ { "oauth2": [ "issue", "account:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Start watching this issue.\n\nTo start watching this issue, do an empty PUT. The 204 status code\nindicates that the operation was successful.", "responses": { "401": { "description": "When the request wasn't authenticated.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the authenticated user is not watching this issue, or when the repo does not exist, or does not have an issue tracker.", "schema": { "$ref": "#/definitions/error" } }, "204": { "description": "Indicates that the authenticated user successfully started watching this issue.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "integer", "description": "The issue's id", "name": "issue_id", "in": "path" } ], "tags": [ "issue_tracker" ] }, "delete": { "security": [ { "oauth2": [ "issue:write", "account:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Stop watching this issue.", "responses": { "401": { "description": "When the request wasn't authenticated.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the issue or the repo does not exist, or the repository does not have an issue tracker.", "schema": { "$ref": "#/definitions/error" } }, "204": { "description": "Indicates that the authenticated user successfully stopped watching this issue.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "integer", "description": "The issue's id", "name": "issue_id", "in": "path" } ], "tags": [ "issue_tracker" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "issue_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "issue", "account" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Indicated whether or not the authenticated user is watching this\nissue.", "responses": { "401": { "description": "When the request wasn't authenticated.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the authenticated user is not watching this issue, or when the repo does not exist, or does not have an issue tracker.", "schema": { "$ref": "#/definitions/error" } }, "204": { "description": "If the authenticated user is watching this issue.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "integer", "description": "The issue's id", "name": "issue_id", "in": "path" } ], "tags": [ "issue_tracker" ] } }, "/repositories/{username}/{repo_slug}/milestones/{milestone_id}": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "milestone_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "issue" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the specified issue tracker milestone object.", "responses": { "200": { "description": "The specified milestone object.", "schema": { "$ref": "#/definitions/milestone" } }, "404": { "description": "If the specified repository or milestone does not exist, or if the repository doesn't have the issue tracker enabled.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "integer", "description": "The milestone's id", "name": "milestone_id", "in": "path" } ], "tags": [ "issue_tracker" ] } }, "/teams": { "parameters": [], "get": { "security": [ { "oauth2": [ "team" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns all the teams that the authenticated user is associated\nwith.", "responses": { "200": { "description": "A paginated list of teams.", "schema": { "$ref": "#/definitions/paginated_teams" } }, "401": { "description": "When the request wasn't authenticated.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "enum": [ "admin", "contributor", "member" ], "name": "role", "required": false, "in": "query", "type": "string", "description": "\nFilters the teams based on the authenticated user's role on each team.\n\n* **member**: returns a list of all the teams which the caller is a member of\n at least one team group or repository owned by the team\n* **contributor**: returns a list of teams which the caller has write access\n to at least one repository owned by the team\n* **admin**: returns a list teams which the caller has team administrator access\n" } ], "tags": [ "teams" ] } }, "/user": { "parameters": [], "get": { "security": [ { "oauth2": [ "account" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the currently logged in user.", "responses": { "200": { "description": "The current user.", "schema": { "$ref": "#/definitions/user" } }, "401": { "description": "When the request wasn't authenticated.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "users" ] } }, "/repositories/{username}/{repo_slug}/commits/{revision}": { "post": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Identical to `GET /repositories/{username}/{repo_slug}/commits`,\nexcept that POST allows clients to place the include and exclude\nparameters in the request body to avoid URL length issues.\n\n**Note that this resource does NOT support new commit creation.**", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "commits" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "revision", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "These are the repository's commits. They are paginated and returned\nin reverse chronological order, similar to the output of `git log` and\n`hg log`. Like these tools, the DAG can be filtered.\n\n## GET /repositories/{username}/{repo_slug}/commits/\n\nReturns all commits in the repo in topological order (newest commit\nfirst). All branches and tags are included (similar to\n`git log --all` and `hg log`).\n\n## GET /repositories/{username}/{repo_slug}/commits/master\n\nReturns all commits on rev `master` (similar to `git log master`,\n`hg log master`).\n\n## GET /repositories/{username}/{repo_slug}/commits/dev?exclude=master\n\nReturns all commits on ref `dev`, except those that are reachable on\n`master` (similar to `git log dev ^master`).\n\n## GET /repositories/{username}/{repo_slug}/commits/?exclude=master\n\nReturns all commits in the repo that are not on master\n(similar to `git log --all ^master`).\n\n## GET /repositories/{username}/{repo_slug}/commits/?include=foo&include=bar&exclude=fu&exclude=fubar\n\nReturns all commits that are on refs `foo` or `bar`, but not on `fu` or\n`fubar` (similar to `git log foo bar ^fu ^fubar`).\n\nBecause the response could include a very large number of commits, it\nis paginated. Follow the 'next' link in the response to navigate to the\nnext page of commits. As with other paginated resources, do not\nconstruct your own links.\n\nWhen the include and exclude parameters are more than ca fit in a\nquery string, clients can use a `x-www-form-urlencoded` POST instead.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "commits" ] } }, "/snippets/{username}/{encoded_id}/comments": { "post": { "security": [ { "oauth2": [ "snippet" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Creates a new comment.\n\nThe only required field in the body is `content.raw`.\n\nTo create a threaded reply to an existing comment, include `parent.id`.", "responses": { "201": { "headers": { "Location": { "type": "string", "description": "The URL of the new comment" } }, "description": "The newly created comment.", "schema": { "$ref": "#/definitions/snippet" } }, "403": { "description": "If the authenticated user does not have access to the snippet.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the snippet does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "schema": { "$ref": "#/definitions/snippet" }, "required": true, "description": "The contents of the new comment.", "name": "_body", "in": "body" } ], "tags": [ "snippets" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "encoded_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "snippet" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Used to retrieve a paginated list of all comments for a specific\nsnippet.\n\nThis resource works identical to commit and pull request comments.", "responses": { "200": { "description": "A paginated list of snippet comments, ordered by creation date.", "schema": { "$ref": "#/definitions/paginated_snippet_comments" } }, "403": { "description": "If the authenticated user does not have access to the snippet.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the snippet does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "snippets" ] } }, "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/activity": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "pull_request_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "pullrequest" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the pull request's activity log. This includes comments that\nwere made by the reviewers, updates and approvals.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "pullrequests" ] } }, "/repositories/{username}": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns all repositories owned by the specified account.\n\nThe result can be narrowed down based on the authenticated user's role.\n\nE.g. with `?role=contributor`, only those repositories that the\nauthenticated user has write access to are returned (this includes any\nrepo the user is an admin on, as that implies write access).", "responses": { "200": { "description": "The repositories owned by the specified account.", "schema": { "$ref": "#/definitions/paginated_repositories" } }, "404": { "description": "If the specified account does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "enum": [ "admin", "contributor", "member", "owner" ], "name": "role", "required": false, "in": "query", "type": "string", "description": "\nFilters the result based on the authenticated user's role on each repository.\n\n* **member**: returns repositories to which the user has explicit read access\n* **contributor**: returns repositories to which the user has explicit write access\n* **admin**: returns repositories to which the user has explicit administrator access\n* **owner**: returns all repositories owned by the current user\n" } ], "tags": [ "repositories" ] } }, "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/merge": { "post": { "security": [ { "oauth2": [ "pullrequest:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "pullrequests" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "pull_request_id", "in": "path" } ] }, "/snippets/{username}/{encoded_id}/commits/": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "encoded_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "snippet" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "200": { "description": "The specified snippet commit.", "schema": { "$ref": "#/definitions/snippet_commit" } }, "403": { "description": "If the authenticated user does not have access to the snippet.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the commit or the snippet does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "snippets" ] } }, "/snippets/{username}/{encoded_id}/{node_id}/patch": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "encoded_id", "in": "path" }, { "required": true, "type": "string", "name": "node_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "snippet" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the patch of the specified commit against its first\nparent.\n\nNote that this resource is different in functionality from the `diff`\nresource.\n\nThe differences between a diff and a patch are:\n\n* patches have a commit header with the username, message, etc\n* diffs support the optional `path=foo/bar.py` query param to filter the\n diff to just that one file diff (not supported for patches)\n* for a merge, the diff will show the diff between the merge commit and\n its first parent (identical to how PRs work), while patch returns a\n response containing separate patches for each commit on the second\n parent's ancestry, up to the oldest common ancestor (identical to\n its reachability).\n\nNote that the character encoding of the contents of the patch is\nunspecified as Git and Mercurial do not track this, making it hard for\nBitbucket to reliably determine this.", "responses": { "200": { "description": "The raw patch contents." }, "403": { "description": "If the authenticated user does not have access to the snippet.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the snippet does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "string", "description": "The snippet id.", "name": "encoded_id", "in": "path" } ], "tags": [ "snippets" ] } }, "/teams/{username}/followers": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" } ], "get": { "security": [ { "oauth2": [] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the list of accounts that are following this team.", "responses": { "200": { "description": "A paginated list of user objects.", "schema": { "$ref": "#/definitions/paginated_users" } }, "404": { "description": "If no team exists for the specified name, or if the specified account is a personal account, not a team account.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "string", "description": "The team's username", "name": "username", "in": "path" } ], "tags": [ "teams" ] } }, "/snippets/{username}/{encoded_id}/{node_id}/files/{path}": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "encoded_id", "in": "path" }, { "required": true, "type": "string", "name": "node_id", "in": "path" }, { "required": true, "type": "string", "name": "path", "in": "path" } ], "get": { "security": [ { "oauth2": [ "snippet" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Retrieves the raw contents of a specific file in the snippet. The\n`Content-Disposition` header will be \"attachment\" to avoid issues with\nmalevolent executable files.\n\nThe file's mime type is derived from its filename and returned in the\n`Content-Type` header.\n\nNote that for text files, no character encoding is included as part of\nthe content type.", "responses": { "200": { "headers": { "Content-Type": { "type": "string", "description": "The mime type as derived from the filename" }, "Content-Disposition": { "type": "string", "description": "attachment" } }, "description": "Returns the contents of the specified file." }, "403": { "description": "If the authenticated user does not have access to the snippet.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the file or snippet does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "snippets" ] } }, "/addon/linkers/{linker_key}": { "parameters": [ { "required": true, "type": "string", "name": "linker_key", "in": "path" } ], "get": { "security": [ { "oauth2": [] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "addon" ] } }, "/repositories/{username}/{repo_slug}/refs/tags": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "refs" ] } }, "/repositories/{username}/{repo_slug}/commit/{node}/approve": { "post": { "security": [ { "oauth2": [ "repository:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Approve the specified commit as the authenticated user.\n\nThis operation is only available to users that have explicit access to\nthe repository. In contrast, just the fact that a repository is\npublicly accessible to users does not give them the ability to approve\ncommits.", "responses": { "200": { "description": "The `participant` object recording that the authenticated user approved the commit.", "schema": { "$ref": "#/definitions/participant" } }, "404": { "description": "If the specified commit, or the repository does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "string", "description": "The commit's SHA1.", "name": "node", "in": "path" } ], "tags": [ "commits" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "node", "in": "path" } ], "delete": { "security": [ { "oauth2": [ "repository:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Redact the authenticated user's approval of the specified commit.\n\nThis operation is only available to users that have explicit access to\nthe repository. In contrast, just the fact that a repository is\npublicly accessible to users does not give them the ability to approve\ncommits.", "responses": { "204": { "description": "An empty response indicating the authenticated user's approval has been withdrawn." }, "404": { "description": "If the specified commit, or the repository does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "string", "description": "The commit's SHA1.", "name": "node", "in": "path" } ], "tags": [ "commits" ] } }, "/account/{username}/addons": { "post": { "security": [ { "oauth2": [ "account:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "addon" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" } ], "get": { "security": [ { "oauth2": [ "account:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "addon" ] } }, "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/commits": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "pull_request_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "pullrequest" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the pull request's commits.\n\nThese are the commits that are being merged into the destination\nbranch when the pull requests gets accepted.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "pullrequests" ] } }, "/snippets/{username}/{encoded_id}/watchers": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "encoded_id", "in": "path" } ], "get": { "responses": { "200": { "description": "The paginated list of users watching this snippet", "schema": { "$ref": "#/definitions/paginated_users" } }, "404": { "description": "If the snippet does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "string", "description": "The snippet id.", "name": "encoded_id", "in": "path" } ], "tags": [ "snippets" ], "deprecated": true, "security": [ { "oauth2": [ "snippet" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns a paginated list of all users watching a specific snippet." } }, "/repositories/{username}/{repo_slug}/branch-restrictions/{id}": { "put": { "security": [ { "oauth2": [ "repository:admin" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "branch_restrictions" ] }, "delete": { "security": [ { "oauth2": [ "repository:admin" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "branch_restrictions" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository:admin" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "branch_restrictions" ] } }, "/repositories/{username}/{repo_slug}/commit/{node}/statuses/build": { "post": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "node", "in": "path" } ] }, "/repositories/{username}/{repo_slug}": { "post": { "security": [ { "oauth2": [ "repository:admin" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Creates a new repository.", "responses": { "200": { "description": "The newly created repository.", "schema": { "$ref": "#/definitions/repository" } }, "401": { "description": "If the request was not authenticated.", "schema": { "$ref": "#/definitions/error" } }, "400": { "description": "If the input document was invalid, or if the caller lacks the privilege to create repositories under the targeted account.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "schema": { "$ref": "#/definitions/repository" }, "required": false, "description": "The repository that is to be created. Note that most object elements are optional. Elements \"owner\" and \"full_name\" are ignored as the URL implies them.", "name": "_body", "in": "body" } ], "tags": [ "repositories" ] }, "delete": { "security": [ { "oauth2": [ "repository:admin" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Deletes the repository. This is an irreversible operation.\n\nThis does not affect its forks.", "responses": { "204": { "description": "Indicates successful deletion." }, "403": { "description": "If the caller either does not have admin access to the repository, or the repository is set to read-only.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the repository does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "repositories" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the object describing this repository.", "responses": { "200": { "description": "The repository object.", "schema": { "$ref": "#/definitions/repository" } }, "403": { "description": "If the repository is private and the authenticated user does not have access to it.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If no repository exists at this location.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "repositories" ] } }, "/repositories/{username}/{repo_slug}/default-reviewers/{target_username}": { "put": { "security": [ { "oauth2": [ "repository:admin" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Adds the specified user to the repository's list of default\nreviewers.\n\nThis method is idempotent. Adding a user a second time has no effect.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "pullrequests" ] }, "delete": { "security": [ { "oauth2": [ "repository:admin" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Removes a default reviewer from the repository.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "pullrequests" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "target_username", "in": "path" } ], "get": { "security": [ { "oauth2": [ "repository:admin" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns the specified reviewer.\n\nThis can be used to test whether a user is among the repository's\ndefault reviewers list. A 404 indicates that that specified user is not\na default reviewer.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "pullrequests" ] } }, "/repositories/{username}/{repo_slug}/issues/{issue_id}/comments": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "issue_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "issue" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns all comments that were made on the specified issue.", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "issue_tracker" ] } }, "/snippets/{username}/{encoded_id}/{node_id}": { "put": { "responses": { "200": { "description": "The updated snippet object.", "schema": { "$ref": "#/definitions/snippet" } }, "401": { "description": "If the snippet is private and the request was not authenticated.", "schema": { "$ref": "#/definitions/error" } }, "403": { "description": "If authenticated user does not have permission to update the private snippet.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the snippet or the revision does not exist.", "schema": { "$ref": "#/definitions/error" } }, "405": { "description": "If `{node_id}` is not the latest revision.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "string", "description": "The snippet's id.", "name": "encoded_id", "in": "path" }, { "required": true, "type": "string", "description": "A commit revision (SHA1).", "name": "node_id", "in": "path" } ], "tags": [ "snippets" ], "produces": [ "application/json", "multipart/related", "multipart/form-data" ], "security": [ { "oauth2": [ "snippet:write" ] }, { "basic": [] }, { "api_key": [] } ], "consumes": [ "application/json", "multipart/related", "multipart/form-data" ], "description": "Identical to `UPDATE /snippets/encoded_id`, except that this endpoint\ntakes an explicit commit revision. Only the snippet's \"HEAD\"/\"tip\"\n(most recent) version can be updated and requests on all other,\nolder revisions fail by returning a 405 status.\n\nUsage of this endpoint over the unrestricted `/snippets/encoded_id`\ncould be desired if the caller wants to be sure no concurrent\nmodifications have taken place between the moment of the UPDATE\nrequest and the original GET.\n\nThis can be considered a so-called \"Compare And Swap\", or CAS\noperation.\n\nOther than that, the two endpoints are identical in behavior." }, "delete": { "security": [ { "oauth2": [ "snippet:write" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Deletes the snippet.\n\nNote that this only works for versioned URLs that point to the latest\ncommit of the snippet. Pointing to an older commit results in a 405\nstatus code.\n\nTo delete a snippet, regardless of whether or not concurrent changes\nare being made to it, use `DELETE /snippets/{encoded_id}` instead.", "responses": { "401": { "description": "If the snippet is private and the request was not authenticated.", "schema": { "$ref": "#/definitions/error" } }, "403": { "description": "If authenticated user does not have permission to delete the private snippet.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the snippet does not exist.", "schema": { "$ref": "#/definitions/error" } }, "204": { "description": "If the snippet was deleted successfully." }, "405": { "description": "If `{node_id}` is not the latest revision.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "string", "description": "The snippet's id.", "name": "encoded_id", "in": "path" } ], "tags": [ "snippets" ] }, "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "encoded_id", "in": "path" }, { "required": true, "type": "string", "name": "node_id", "in": "path" } ], "get": { "responses": { "200": { "description": "The snippet object.", "schema": { "$ref": "#/definitions/snippet" } }, "401": { "description": "If the snippet is private and the request was not authenticated.", "schema": { "$ref": "#/definitions/error" } }, "403": { "description": "If authenticated user does not have access to the private snippet.", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "If the snippet, or the revision does not exist.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [ { "required": true, "type": "string", "description": "The snippet's id.", "name": "encoded_id", "in": "path" }, { "required": true, "type": "string", "description": "A commit revision (SHA1).", "name": "node_id", "in": "path" } ], "produces": [ "application/json", "multipart/related", "multipart/form-data" ], "tags": [ "snippets" ], "security": [ { "oauth2": [ "snippet" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Identical to `GET /snippets/encoded_id`, except that this endpoint\ncan be used to retrieve the contents of the snippet as it was at an\nolder revision, while `/snippets/encoded_id` always returns the\nsnippet's current revision.\n\nNote that only the snippet's file contents are versioned, not its\nmeta data properties like the title.\n\nOther than that, the two endpoints are identical in behavior." } }, "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/patch": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" }, { "required": true, "type": "string", "name": "repo_slug", "in": "path" }, { "required": true, "type": "string", "name": "pull_request_id", "in": "path" } ], "get": { "security": [ { "oauth2": [ "pullrequest" ] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "pullrequests" ] } }, "/addon/linkers/{linker_key}/values/": { "delete": { "security": [ { "oauth2": [] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "addon" ] }, "parameters": [ { "required": true, "type": "string", "name": "linker_key", "in": "path" } ], "get": { "security": [ { "oauth2": [] }, { "basic": [] }, { "api_key": [] } ], "description": "", "responses": { "default": { "description": "Unexpected error.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "addon" ] } }, "/repositories": { "parameters": [], "get": { "security": [ { "oauth2": [ "repository" ] }, { "basic": [] }, { "api_key": [] } ], "description": "Returns all public repositories.", "responses": { "200": { "description": "All public repositories.", "schema": { "$ref": "#/definitions/paginated_repositories" } } }, "parameters": [], "tags": [ "repositories" ] } }, "/teams/{username}/members": { "parameters": [ { "required": true, "type": "string", "name": "username", "in": "path" } ], "get": { "security": [ { "oauth2": [ "account" ] }, { "basic": [] }, { "api_key": [] } ], "description": "All members of a team.\n\nReturns all members of the specified team. Any member of any of the\nteam's groups is considered a member of the team. This includes users\nin groups that may not actually have access to any of the team's\nrepositories.\n\nNote that members using the \"private profile\" feature are not included.", "responses": { "200": { "description": "All members", "schema": { "$ref": "#/definitions/user" } }, "404": { "description": "When the team does not exist, or multiple teams with the same name exist that differ only in casing and the URL did not match the exact casing of a particular one.", "schema": { "$ref": "#/definitions/error" } } }, "parameters": [], "tags": [ "teams" ] } } }, "schemes": [ "https" ], "tags": [ { "name": "users", "description": "" }, { "name": "teams", "description": "" }, { "name": "repositories", "description": "" }, { "name": "refs", "description": "" }, { "name": "commits", "description": "" }, { "name": "pullrequests", "description": "" }, { "name": "issue_tracker", "description": "The issues resource provides functionality for getting information on\nissues in an issue tracker, creating new issues, updating them and deleting\nthem.\n\nYou can access public issues without authentication, but you can't gain access\nto private repositories' issues. By authenticating, you will get the ability\nto create issues, as well as access to updating data or deleting issues you\nhave access to." }, { "name": "wiki", "description": "" }, { "name": "downloads", "description": "" }, { "name": "snippets", "description": "" }, { "name": "webhooks", "description": "Webhooks provide a way to configure Bitbucket Cloud to make requests to\nyour server (or another external service) whenever certain events occur in\nBitbucket Cloud.\n\nA webhook consists of:\n\n* A subject -- The resource that generates the events. Currently, this resource\n is the repository, user account, or team where you create the webhook.\n* One or more event -- The default event is a repository push, but you can\n select multiple events that can trigger the webhook.\n* A URL -- The endpoint where you want Bitbucket to send the event payloads\n when a matching event happens.\n\nThere are two parts to getting a webhook to work: creating the webhook and\ntriggering the webhook. After you create a webhook for an event, every time\nthat event occurs, Bitbucket sends a payload request that describes the event\nto the specified URL. Thus, you can think of webhooks as a kind of\nnotification system.\n\nUse webhooks to integrate applications with Bitbucket Cloud. The following\nuse cases provides examples of when you would want to use webhooks:\n\n* Every time a user pushes commits in a repository, you may want to notify\n your CI server to start a build.\n* Every time a user pushes commits or creates a pull request, you may want to\n display a notification in your application.\n" } ], "basePath": "/2.0", "produces": [ "application/json" ], "securityDefinitions": { "oauth2": { "scopes": { "wiki": "Read and write to your repositories' wikis", "snippet": "Read your snippets", "account": "Read your account information", "repository:admin": "Administer your repositories", "repository": "Read your repositories", "snippet:write": "Read and write to your snippets", "issue:write": "Read and write to your repositories' issues", "pullrequest": "Read your repositories and their pull requests", "webhook": "Read and write to your repositories' webhooks", "pullrequest:write": "Read and write to your repositories and their pull requests", "project": "Read your team's projects", "project:write": "Read and write to your team's projects and move repositories between them", "team": "Read your team membership information", "repository:write": "Read and write to your repositories", "team:write": "Read and write to your team membership information", "account:write": "Read and write to your account information", "issue": "Read your repositories' issues", "email": "Read your account's primary email address" }, "tokenUrl": "http://dev.bitbucket.org:8000/site/oauth2/access_token", "description": "OAuth 2 as per [RFC-6749](https://tools.ietf.org/html/rfc6749).", "flow": "accessCode", "type": "oauth2", "authorizationUrl": "http://dev.bitbucket.org:8000/site/oauth2/authorize" }, "api_key": { "in": "header", "type": "apiKey", "description": "API Keys can be used as Basic HTTP Authentication credentials and provide a substitute for the account's actual username and password. API Keys are only available to team accounts and there is only 1 key per account. API Keys do not support scopes and have therefore access to all contents of the account.", "name": "Authorization" }, "basic": { "type": "basic", "description": "Basic HTTP Authentication as per [RFC-2617](https://tools.ietf.org/html/rfc2617) (Digest not supported). Note that Basic Auth with username and password as credentials is only available on accounts that have 2-factor-auth / 2-step-verification disabled. If you use 2fa, you should authenticate using OAuth2 instead." } }, "x-revision": "dev-1452122794", "host": "api.dev.bitbucket.org:8000", "definitions": { "paginated_repositories": { "allOf": [ { "$ref": "#/definitions/page" }, { "additionalProperties": true, "type": "object", "description": "A paginated list of repositories.", "properties": { "values": { "minItems": 0, "items": { "$ref": "#/definitions/repository" }, "uniqueItems": true, "type": "array" } } } ] }, "subject_types": { "additionalProperties": false, "type": "object", "description": "The mapping of resource/subject types pointing to their individual event types.", "properties": { "user": { "additionalProperties": false, "type": "object", "properties": { "events": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } } } }, "repository": { "additionalProperties": false, "type": "object", "properties": { "events": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } } } }, "team": { "additionalProperties": false, "type": "object", "properties": { "events": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } } } } } }, "paginated_hook_events": { "allOf": [ { "$ref": "#/definitions/object" }, { "additionalProperties": true, "type": "object", "description": "A paginated list of webhook types available to subscribe on.", "properties": { "next": { "type": "string", "description": "Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs.", "format": "uri" }, "values": { "minItems": 0, "items": { "$ref": "#/definitions/hook_event" }, "uniqueItems": true, "type": "array" }, "pagelen": { "minimum": 1, "type": "integer", "description": "Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values." }, "size": { "minimum": 0, "type": "integer", "description": "Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute." }, "page": { "minimum": 1, "type": "integer", "description": "Page number of the current results. This is an optional element that is not provided in all responses." }, "previous": { "type": "string", "description": "Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs.", "format": "uri" } } } ] }, "base_commit": { "allOf": [ { "$ref": "#/definitions/object" }, { "additionalProperties": true, "type": "object", "description": "The common base type for both repository and snippet commits.", "properties": { "date": { "type": "string", "format": "date-time" }, "parents": { "minItems": 0, "items": { "$ref": "#/definitions/base_commit" }, "type": "array" }, "message": { "type": "string" }, "hash": { "pattern": "[0-9a-f]{7,}?", "type": "string" }, "author": { "$ref": "#/definitions/account" } } } ] }, "error": { "additionalProperties": false, "type": "object", "properties": { "error": { "additionalProperties": false, "required": [ "message" ], "type": "object", "properties": { "message": { "type": "string" }, "detail": { "type": "string" } } } } }, "participant": { "allOf": [ { "$ref": "#/definitions/object" }, { "additionalProperties": true, "type": "object", "description": "Object describing a user's role on resources like commits or pull requests.", "properties": { "role": { "enum": [ "PARTICIPANT", "REVIEWER" ], "type": "string" }, "user": { "$ref": "#/definitions/user" }, "approved": { "type": "boolean" } } } ] }, "paginated_versions": { "allOf": [ { "$ref": "#/definitions/object" }, { "additionalProperties": true, "type": "object", "description": "A paginated list of issue tracker versions.", "properties": { "next": { "type": "string", "description": "Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs.", "format": "uri" }, "values": { "minItems": 0, "items": { "$ref": "#/definitions/version" }, "uniqueItems": true, "type": "array" }, "pagelen": { "minimum": 1, "type": "integer", "description": "Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values." }, "size": { "minimum": 0, "type": "integer", "description": "Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute." }, "page": { "minimum": 1, "type": "integer", "description": "Page number of the current results. This is an optional element that is not provided in all responses." }, "previous": { "type": "string", "description": "Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs.", "format": "uri" } } } ] }, "paginated_users": { "allOf": [ { "$ref": "#/definitions/object" }, { "additionalProperties": true, "type": "object", "description": "A paginated list of users.", "properties": { "next": { "type": "string", "description": "Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs.", "format": "uri" }, "values": { "minItems": 0, "items": { "$ref": "#/definitions/user" }, "uniqueItems": true, "type": "array" }, "pagelen": { "minimum": 1, "type": "integer", "description": "Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values." }, "size": { "minimum": 0, "type": "integer", "description": "Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute." }, "page": { "minimum": 1, "type": "integer", "description": "Page number of the current results. This is an optional element that is not provided in all responses." }, "previous": { "type": "string", "description": "Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs.", "format": "uri" } } } ] }, "snippet": { "allOf": [ { "$ref": "#/definitions/object" }, { "additionalProperties": true, "type": "object", "description": "A snippet object.", "properties": { "scm": { "enum": [ "hg", "git" ], "type": "string", "description": "The DVCS used to store the snippet." }, "title": { "type": "string" }, "creator": { "$ref": "#/definitions/account" }, "created_on": { "type": "string", "format": "date-time" }, "owner": { "$ref": "#/definitions/account" }, "updated_on": { "type": "string", "format": "date-time" }, "id": { "minimum": 0, "type": "integer" }, "is_private": { "type": "boolean" } } } ] }, "hook_event": { "additionalProperties": false, "type": "object", "description": "An event, associated with a resource or subject type.", "properties": { "category": { "type": "string", "description": "The category this event belongs to." }, "event": { "enum": [ "pullrequest:updated", "repo:commit_status_created", "repo:fork", "issue:comment_created", "pullrequest:rejected", "pullrequest:fulfilled", "pullrequest:comment_created", "pullrequest:comment_deleted", "issue:created", "repo:commit_comment_created", "pullrequest:approved", "repo:commit_status_updated", "pullrequest:comment_updated", "issue:updated", "pullrequest:unapproved", "pullrequest:created", "repo:push" ], "type": "string", "description": "The event identifier." }, "description": { "type": "string", "description": "More detailed description of the webhook event type." }, "label": { "type": "string", "description": "Summary of the webhook event type." } } }, "version": { "allOf": [ { "$ref": "#/definitions/object" }, { "additionalProperties": true, "type": "object", "description": "A version as defined in a repository's issue tracker.", "properties": { "name": { "type": "string" }, "links": { "additionalProperties": false, "type": "object", "properties": { "self": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } } } }, "id": { "type": "integer" } } } ] }, "issue": { "allOf": [ { "$ref": "#/definitions/object" }, { "additionalProperties": true, "type": "object", "description": "An issue.", "properties": { "content": { "additionalProperties": false, "type": "object", "properties": { "raw": { "type": "string", "description": "The text as it was typed by a user." }, "markup": { "enum": [ "markdown", "creole" ], "type": "string", "description": "The type of markup language the content is to be interpreted in." }, "html": { "type": "string", "description": "The user's markup rendered as HTML." } } }, "kind": { "enum": [ "bug", "enhancement", "proposal", "task" ], "type": "string" }, "repository": { "$ref": "#/definitions/repository" }, "links": { "additionalProperties": false, "type": "object", "properties": { "attachments": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "self": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "watch": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "comments": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "html": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "vote": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } } } }, "title": { "type": "string" }, "reporter": { "$ref": "#/definitions/user" }, "component": { "$ref": "#/definitions/component" }, "votes": { "type": "integer" }, "priority": { "enum": [ "trivial", "minor", "major", "critical", "blocker" ], "type": "string" }, "assignee": { "$ref": "#/definitions/user" }, "state": { "enum": [ "new", "open", "resolved", "on hold", "invalid", "duplicate", "wontfix", "closed" ], "type": "string" }, "version": { "$ref": "#/definitions/version" }, "edited_on": { "type": "string", "format": "date-time" }, "created_on": { "type": "string", "format": "date-time" }, "milestone": { "$ref": "#/definitions/milestone" }, "updated_on": { "type": "string", "format": "date-time" }, "id": { "type": "integer" } } } ] }, "webhook_subscription": { "allOf": [ { "$ref": "#/definitions/object" }, { "additionalProperties": true, "type": "object", "description": "A Webhook subscription.", "properties": { "subject_type": { "enum": [ "user", "repository", "team" ], "type": "string", "description": "The type of entity, which is `repository` in the case of webhook subscriptions on repositories." }, "uuid": { "type": "string", "description": "The webhook's id" }, "url": { "type": "string", "description": "The URL events get delivered to.", "format": "uri" }, "created_at": { "type": "string", "format": "date-time" }, "description": { "type": "string", "description": "A user-defined description of the webhook." }, "active": { "type": "boolean" }, "events": { "minItems": 1, "items": { "enum": [ "pullrequest:updated", "repo:commit_status_created", "repo:fork", "issue:comment_created", "pullrequest:rejected", "pullrequest:fulfilled", "pullrequest:comment_created", "pullrequest:comment_deleted", "issue:created", "repo:commit_comment_created", "pullrequest:approved", "repo:commit_status_updated", "pullrequest:comment_updated", "issue:updated", "pullrequest:unapproved", "pullrequest:created", "repo:push" ], "type": "string" }, "uniqueItems": true, "description": "The events this webhook is subscribed to.", "type": "array" }, "subject": { "$ref": "#/definitions/object" } } } ] }, "repository": { "allOf": [ { "$ref": "#/definitions/object" }, { "additionalProperties": true, "type": "object", "description": "A Bitbucket repository.", "properties": { "scm": { "enum": [ "hg", "git" ], "type": "string" }, "has_wiki": { "type": "boolean" }, "uuid": { "type": "string", "description": "The repository's immutable id. This can be used as a substitute for the slug segment in URLs. Doing this guarantees your URLs will survive renaming of the repository by its owner, or even transfer of the repository to a different user." }, "links": { "additionalProperties": false, "type": "object", "properties": { "watchers": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "commits": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "downloads": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "self": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "html": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "avatar": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "hooks": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "forks": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "clone": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "pullrequests": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } } } }, "fork_policy": { "enum": [ "allow_forks", "no_public_forks", "no_forks" ], "type": "string", "description": "\nControls the rules for forking this repository.\n\n* **allow_forks**: unrestricted forking\n* **no_public_forks**: restrict forking to private forks (forks cannot\n be made public later)\n* **no_forks**: deny all forking\n" }, "description": { "type": "string" }, "language": { "type": "string" }, "created_on": { "type": "string", "format": "date-time" }, "parent": { "$ref": "#/definitions/repository" }, "full_name": { "type": "string", "description": "The concatenation of the repository owner's username and the slugified name, e.g. \"evzijst/interruptingcow\". This is the same string used in Bitbucket URLs." }, "has_issues": { "type": "boolean" }, "owner": { "$ref": "#/definitions/account" }, "updated_on": { "type": "string", "format": "date-time" }, "size": { "type": "integer" }, "is_private": { "type": "boolean" }, "name": { "type": "string" } } } ] }, "snippet_commit": { "allOf": [ { "$ref": "#/definitions/base_commit" }, { "additionalProperties": true, "type": "object", "description": "", "properties": { "snippet": { "$ref": "#/definitions/snippet" }, "links": { "additionalProperties": false, "type": "object", "properties": { "diff": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "self": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "html": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } } } } } } ] }, "object": { "description": "Base type for most resource objects. It defines the common `type` element that identifies an object's type. It also identifies the element as Swagger's `discriminator`.", "required": [ "type" ], "additionalProperties": true, "discriminator": "type", "type": "object", "properties": { "type": { "type": "string" } } }, "component": { "allOf": [ { "$ref": "#/definitions/object" }, { "additionalProperties": true, "type": "object", "description": "A component as defined in a repository's issue tracker.", "properties": { "name": { "type": "string" }, "links": { "additionalProperties": false, "type": "object", "properties": { "self": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } } } }, "id": { "type": "integer" } } } ] }, "paginated_issues": { "allOf": [ { "$ref": "#/definitions/page" }, { "additionalProperties": true, "type": "object", "description": "A paginated list of issues.", "properties": { "values": { "minItems": 0, "items": { "$ref": "#/definitions/issue" }, "uniqueItems": true, "type": "array" } } } ] }, "user": { "allOf": [ { "$ref": "#/definitions/account" }, { "additionalProperties": true, "type": "object", "description": "A user object.", "properties": {} } ] }, "milestone": { "allOf": [ { "$ref": "#/definitions/object" }, { "additionalProperties": true, "type": "object", "description": "A milestone as defined in a repository's issue tracker.", "properties": { "name": { "type": "string" }, "links": { "additionalProperties": false, "type": "object", "properties": { "self": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } } } }, "id": { "type": "integer" } } } ] }, "paginated_issue_attachments": { "allOf": [ { "$ref": "#/definitions/page" }, { "additionalProperties": true, "type": "object", "description": "A paginated list of issue attachments.", "properties": { "values": { "minItems": 0, "items": { "$ref": "#/definitions/issue_attachment" }, "type": "array" } } } ] }, "paginated_webhook_subscriptions": { "allOf": [ { "$ref": "#/definitions/object" }, { "additionalProperties": true, "type": "object", "description": "A paginated list of webhook subscriptions", "properties": { "next": { "type": "string", "description": "Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs.", "format": "uri" }, "values": { "minItems": 0, "items": { "$ref": "#/definitions/webhook_subscription" }, "uniqueItems": true, "type": "array" }, "pagelen": { "minimum": 1, "type": "integer", "description": "Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values." }, "size": { "minimum": 0, "type": "integer", "description": "Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute." }, "page": { "minimum": 1, "type": "integer", "description": "Page number of the current results. This is an optional element that is not provided in all responses." }, "previous": { "type": "string", "description": "Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs.", "format": "uri" } } } ] }, "snippet_comment": { "allOf": [ { "$ref": "#/definitions/object" }, { "additionalProperties": true, "type": "object", "description": "A comment on a snippet.", "properties": { "snippet": { "$ref": "#/definitions/snippet" }, "links": { "additionalProperties": false, "type": "object", "properties": { "self": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "html": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } } } } } } ] }, "paginated_milestones": { "allOf": [ { "$ref": "#/definitions/object" }, { "additionalProperties": true, "type": "object", "description": "A paginated list of issue tracker milestones.", "properties": { "next": { "type": "string", "description": "Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs.", "format": "uri" }, "values": { "minItems": 0, "items": { "$ref": "#/definitions/milestone" }, "uniqueItems": true, "type": "array" }, "pagelen": { "minimum": 1, "type": "integer", "description": "Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values." }, "size": { "minimum": 0, "type": "integer", "description": "Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute." }, "page": { "minimum": 1, "type": "integer", "description": "Page number of the current results. This is an optional element that is not provided in all responses." }, "previous": { "type": "string", "description": "Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs.", "format": "uri" } } } ] }, "paginated_components": { "allOf": [ { "$ref": "#/definitions/object" }, { "additionalProperties": true, "type": "object", "description": "A paginated list of issue tracker components.", "properties": { "next": { "type": "string", "description": "Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs.", "format": "uri" }, "values": { "minItems": 0, "items": { "$ref": "#/definitions/component" }, "uniqueItems": true, "type": "array" }, "pagelen": { "minimum": 1, "type": "integer", "description": "Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values." }, "size": { "minimum": 0, "type": "integer", "description": "Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute." }, "page": { "minimum": 1, "type": "integer", "description": "Page number of the current results. This is an optional element that is not provided in all responses." }, "previous": { "type": "string", "description": "Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs.", "format": "uri" } } } ] }, "account": { "allOf": [ { "$ref": "#/definitions/object" }, { "additionalProperties": true, "type": "object", "description": "An account object.", "properties": { "username": { "pattern": "^[a-zA-Z0-9_\\-]+$", "type": "string" }, "website": { "type": "string" }, "display_name": { "type": "string" }, "uuid": { "type": "string" }, "links": { "additionalProperties": false, "type": "object", "properties": { "self": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "repositories": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "html": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "followers": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "avatar": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "following": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } } } }, "created_on": { "type": "string", "format": "date-time" } } } ] }, "issue_attachment": { "allOf": [ { "$ref": "#/definitions/object" }, { "additionalProperties": true, "type": "object", "description": "An issue file attachment's meta data. Note this does not contain the file's actual contents.", "properties": { "name": { "type": "string" }, "links": { "additionalProperties": false, "type": "object", "properties": { "self": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } } } } } } ] }, "paginated_snippet_commit": { "allOf": [ { "$ref": "#/definitions/page" }, { "additionalProperties": true, "type": "object", "description": "A paginated list of snippet commits.", "properties": { "values": { "minItems": 0, "items": { "$ref": "#/definitions/snippet_commit" }, "type": "array" } } } ] }, "pullrequest": { "allOf": [ { "$ref": "#/definitions/object" }, { "additionalProperties": true, "type": "object", "description": "A pull request object.", "properties": { "state": { "enum": [ "MERGED", "SUPERSEDED", "OPEN", "DECLINED" ], "type": "string" }, "author": { "$ref": "#/definitions/account" }, "id": { "type": "integer" }, "links": { "additionalProperties": false, "type": "object", "properties": { "decline": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "commits": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "self": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "comments": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "merge": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "html": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "activity": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "diff": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "approve": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } } } }, "title": { "type": "string" } } } ] }, "paginated_teams": { "allOf": [ { "$ref": "#/definitions/object" }, { "additionalProperties": true, "type": "object", "description": "A paginated list of teams.", "properties": { "next": { "type": "string", "description": "Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs.", "format": "uri" }, "values": { "minItems": 0, "items": { "$ref": "#/definitions/team" }, "uniqueItems": true, "type": "array" }, "pagelen": { "minimum": 1, "type": "integer", "description": "Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values." }, "size": { "minimum": 0, "type": "integer", "description": "Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute." }, "page": { "minimum": 1, "type": "integer", "description": "Page number of the current results. This is an optional element that is not provided in all responses." }, "previous": { "type": "string", "description": "Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs.", "format": "uri" } } } ] }, "paginated_snippet_comments": { "allOf": [ { "$ref": "#/definitions/page" }, { "additionalProperties": true, "type": "object", "description": "A paginated list of snippet comments.", "properties": { "values": { "minItems": 0, "items": { "$ref": "#/definitions/snippet_comment" }, "uniqueItems": true, "type": "array" } } } ] }, "team": { "allOf": [ { "$ref": "#/definitions/account" }, { "additionalProperties": true, "type": "object", "description": "A team object.", "properties": {} } ] }, "commit": { "allOf": [ { "$ref": "#/definitions/base_commit" }, { "additionalProperties": true, "type": "object", "description": "A repository commit object.", "properties": { "participants": { "minItems": 0, "items": { "$ref": "#/definitions/participant" }, "type": "array" }, "repository": { "$ref": "#/definitions/repository" }, "links": { "additionalProperties": false, "type": "object", "properties": { "self": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "comments": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "patch": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "html": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "diff": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } }, "approve": { "additionalProperties": false, "type": "object", "properties": { "href": { "type": "string", "format": "uri" } } } } } } } ] }, "paginated_snippets": { "allOf": [ { "$ref": "#/definitions/object" }, { "additionalProperties": true, "type": "object", "description": "A paginated list of snippets.", "properties": { "next": { "type": "string", "description": "Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs.", "format": "uri" }, "values": { "minItems": 0, "items": { "$ref": "#/definitions/snippet" }, "uniqueItems": true, "type": "array" }, "pagelen": { "minimum": 1, "type": "integer", "description": "Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values." }, "size": { "minimum": 0, "type": "integer", "description": "Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute." }, "page": { "minimum": 1, "type": "integer", "description": "Page number of the current results. This is an optional element that is not provided in all responses." }, "previous": { "type": "string", "description": "Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs.", "format": "uri" } } } ] }, "page": { "allOf": [ { "$ref": "#/definitions/object" }, { "additionalProperties": true, "type": "object", "description": "Base type for most resource objects. It defines the common `type` element that identifies an object's type. It also identifies the element as Swagger's `discriminator`.", "properties": { "previous": { "type": "string", "description": "Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs.", "format": "uri" }, "pagelen": { "minimum": 1, "type": "integer", "description": "Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values." }, "next": { "type": "string", "description": "Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs.", "format": "uri" }, "page": { "minimum": 1, "type": "integer", "description": "Page number of the current results. This is an optional element that is not provided in all responses." }, "size": { "minimum": 0, "type": "integer", "description": "Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute." } } } ] } }, "swagger": "2.0", "consumes": [ "application/json" ] } analysis-0.21.1/fixtures/bugs/remote-absolute/000077500000000000000000000000001413705513100213365ustar00rootroot00000000000000analysis-0.21.1/fixtures/bugs/remote-absolute/ce_v0_2_without_data.json000066400000000000000000000025061413705513100262250ustar00rootroot00000000000000{ "$ref": "#/definitions/event", "definitions": { "specversion": { "type": "string" }, "contenttype": { "type": "string" }, "event": { "properties": { "specversion": { "$ref": "#/definitions/specversion" }, "contenttype": { "$ref": "#/definitions/contenttype" }, "id": { "$ref": "#/definitions/id" }, "time": { "$ref": "#/definitions/time" }, "type": { "$ref": "#/definitions/type" }, "extensions": { "$ref": "#/definitions/extensions" }, "source": { "$ref": "#/definitions/source" }, "shkeptncontext": { "type": "string" } }, "required": [ "specversion", "id", "type", "source" ], "type": "object" }, "id": { "type": "string" }, "time": { "format": "date-time", "type": "string" }, "type": { "type": "string" }, "extensions": { "type": "object" }, "source": { "format": "uri-reference", "type": "string" } }, "type": "object" }analysis-0.21.1/fixtures/bugs/remote-absolute/remote-spec.json000066400000000000000000000023721413705513100244600ustar00rootroot00000000000000{ "definitions": { "specversion": { "type": "string" }, "contenttype": { "type": "string" }, "data": { "type": [ "object", "string" ] }, "event": { "properties": { "specversion": { "$ref": "#/definitions/specversion" }, "contenttype": { "$ref": "#/definitions/contenttype" }, "data": { "$ref": "#/definitions/data" }, "id": { "$ref": "#/definitions/id" }, "time": { "$ref": "#/definitions/time" }, "type": { "$ref": "#/definitions/type" }, "extensions": { "$ref": "#/definitions/extensions" }, "source": { "$ref": "#/definitions/source" } }, "required": [ "specversion", "id", "type", "source" ], "type": "object" }, "id": { "type": "string" }, "time": { "format": "date-time", "type": "string" }, "type": { "type": "string" }, "extensions": { "type": "object" }, "source": { "format": "uri-reference", "type": "string" } }, "type": "object" } analysis-0.21.1/fixtures/bugs/remote-absolute/swagger-mini.json000066400000000000000000000020451413705513100246230ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "keptn api", "version": "0.1.0" }, "schemes": [ "http" ], "basePath": "/", "consumes": [ "application/cloudevents+json" ], "produces": [ "application/cloudevents+json" ], "securityDefinitions": { "key": { "type": "apiKey", "in": "header", "name": "x-token" } }, "security": [ { "key": [] } ], "paths": { "/auth": { "post": { "tags": [ "auth" ], "operationId": "auth", "summary": "Checks the provided token", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/remote" } } ], "responses": { "200": { "description": "authenticated" } } } } }, "definitions": { "remote": { "$ref": "https://raw.githubusercontent.com/cloudevents/spec/v0.2/spec.json#/definitions/event" } } } analysis-0.21.1/fixtures/bugs/remote-absolute/swagger-with-local-ref.json000066400000000000000000000214641413705513100265120ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "keptn api", "version": "0.1.0" }, "schemes": [ "http" ], "basePath": "/", "consumes": [ "application/cloudevents+json" ], "produces": [ "application/cloudevents+json" ], "securityDefinitions": { "key": { "type": "apiKey", "in": "header", "name": "x-token" } }, "security": [ { "key": [] } ], "paths": { "/auth": { "post": { "tags": [ "auth" ], "operationId": "auth", "summary": "Checks the provided token", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "remote-spec.json#/definitions/event" } } ], "responses": { "200": { "description": "authenticated" } } } }, "/event": { "post": { "tags": [ "event" ], "operationId": "sendEvent", "summary": "Forwards the received event to the eventbroker", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/KeptnContextExtendedCE" } } ], "responses": { "201": { "description": "forwarded", "schema" : { "$ref" : "#/definitions/ChannelInfo" } }, "default": { "description": "error", "schema": { "$ref": "#/definitions/error" } } } } }, "/configure": { "post": { "tags": [ "configure" ], "operationId": "configure", "summary": "Forwards the received configure event to the eventbroker", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/ConfigureCE" } } ], "responses": { "201": { "description": "configured", "schema" : { "$ref" : "#/definitions/ChannelInfo" } }, "default": { "description": "error", "schema": { "$ref": "#/definitions/error" } } } } }, "/project": { "post": { "tags": [ "project" ], "operationId": "project", "summary": "Forwards the received project event to the eventbroker", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/CreateProjectCE" } } ], "responses": { "201": { "description": "project created", "schema" : { "$ref" : "#/definitions/ChannelInfo" } }, "default": { "description": "error", "schema": { "$ref": "#/definitions/error" } } } } }, "/dynatrace": { "post": { "tags": [ "dynatrace" ], "operationId": "dynatrace", "summary": "Forwards the received event from Dynatrace to the eventbroker", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/DynatraceProblemCE" } } ], "responses": { "201": { "description": "event forwarded" }, "default": { "description": "error", "schema": { "$ref": "#/definitions/error" } } } } } }, "definitions": { "KeptnContextExtendedCE": { "allOf": [ { "$ref": "remote-spec.json#/definitions/event" }, { "type": "object", "required": [ "shkeptncontext" ], "properties": { "shkeptncontext": { "type": "string" } } } ] }, "ConfigureCE": { "allOf": [ { "$ref": "remote-spec.json#/definitions/event" }, { "type": "object", "properties": { "data": { "required": [ "org", "user", "token" ], "properties": { "org": { "type": "string" }, "user": { "type": "string" }, "token": { "type": "string" } } } } } ] }, "DynatraceProblemCE": { "allOf": [ { "$ref": "remote-spec.json#/definitions/event" }, { "type": "object", "properties": { "data": { "required": [ "state", "problemid", "pid", "problemtitle", "problemdetails", "impactedentities", "impactedentity" ], "properties": { "state": { "type": "string" }, "problemid": { "type": "string" }, "pid": { "type": "string" }, "problemtitle": { "type": "string" }, "problemdetails": { "required": [ "id" ], "properties": { "id": { "type": "string" } } }, "impactedentities": { "type": "array", "items": { "required": [ "type", "name", "entity" ], "properties": { "type": { "type": "string" }, "name": { "type": "string" }, "entity": { "type": "string" } } } }, "impactedentity": { "type": "string" } } } } } ] }, "CreateProjectCE": { "allOf": [ { "$ref": "remote-spec.json#/definitions/event" }, { "type": "object", "properties": { "data": { "required": [ "project", "stages" ], "properties": { "project": { "type": "string" }, "stages": { "type": "array", "items": { "required": [ "name", "deployment_strategy" ], "properties": { "name": { "type": "string" }, "deployment_strategy": { "type": "string" }, "test_strategy": { "type": "string" } } } } } } } } ] }, "error": { "type": "object", "required": [ "message" ], "properties": { "code": { "type": "integer", "format": "int64" }, "message": { "type": "string" }, "fields": { "type": "string" } } }, "ChannelInfo" : { "allOf": [ { "$ref": "remote-spec.json#/definitions/event" }, { "type": "object", "properties": { "data": { "properties": { "channelInfo": { "required": [ "token", "channelID" ], "properties": { "token": { "type": "string" }, "channelID": { "type": "string" } } } } } } } ] } } } analysis-0.21.1/fixtures/bugs/remote-absolute/swagger-with-ref.json000066400000000000000000000216721413705513100254230ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "keptn api", "version": "0.1.0" }, "schemes": [ "http" ], "basePath": "/", "consumes": [ "application/cloudevents+json" ], "produces": [ "application/cloudevents+json" ], "securityDefinitions": { "key": { "type": "apiKey", "in": "header", "name": "x-token" } }, "security": [ { "key": [] } ], "paths": { "/auth": { "post": { "tags": [ "auth" ], "operationId": "auth", "summary": "Checks the provided token", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "https://raw.githubusercontent.com/cloudevents/spec/v0.2/spec.json#/definitions/event" } } ], "responses": { "200": { "description": "authenticated" } } } }, "/event": { "post": { "tags": [ "event" ], "operationId": "sendEvent", "summary": "Forwards the received event to the eventbroker", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/KeptnContextExtendedCE" } } ], "responses": { "201": { "description": "forwarded", "schema" : { "$ref" : "#/definitions/ChannelInfo" } }, "default": { "description": "error", "schema": { "$ref": "#/definitions/error" } } } } }, "/configure": { "post": { "tags": [ "configure" ], "operationId": "configure", "summary": "Forwards the received configure event to the eventbroker", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/ConfigureCE" } } ], "responses": { "201": { "description": "configured", "schema" : { "$ref" : "#/definitions/ChannelInfo" } }, "default": { "description": "error", "schema": { "$ref": "#/definitions/error" } } } } }, "/project": { "post": { "tags": [ "project" ], "operationId": "project", "summary": "Forwards the received project event to the eventbroker", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/CreateProjectCE" } } ], "responses": { "201": { "description": "project created", "schema" : { "$ref" : "#/definitions/ChannelInfo" } }, "default": { "description": "error", "schema": { "$ref": "#/definitions/error" } } } } }, "/dynatrace": { "post": { "tags": [ "dynatrace" ], "operationId": "dynatrace", "summary": "Forwards the received event from Dynatrace to the eventbroker", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/DynatraceProblemCE" } } ], "responses": { "201": { "description": "event forwarded" }, "default": { "description": "error", "schema": { "$ref": "#/definitions/error" } } } } } }, "definitions": { "KeptnContextExtendedCE": { "allOf": [ { "$ref": "https://raw.githubusercontent.com/cloudevents/spec/v0.2/spec.json#/definitions/event" }, { "type": "object", "required": [ "shkeptncontext" ], "properties": { "shkeptncontext": { "type": "string" } } } ] }, "ConfigureCE": { "allOf": [ { "$ref": "ce_v0_2_without_data.json#/definitions/event" }, { "type": "object", "properties": { "data": { "required": [ "org", "user", "token" ], "properties": { "org": { "type": "string" }, "user": { "type": "string" }, "token": { "type": "string" } } } } } ] }, "DynatraceProblemCE": { "allOf": [ { "$ref": "ce_v0_2_without_data.json#/definitions/event" }, { "type": "object", "properties": { "data": { "required": [ "state", "problemid", "pid", "problemtitle", "problemdetails", "impactedentities", "impactedentity" ], "properties": { "state": { "type": "string" }, "problemid": { "type": "string" }, "pid": { "type": "string" }, "problemtitle": { "type": "string" }, "problemdetails": { "required": [ "id" ], "properties": { "id": { "type": "string" } } }, "impactedentities": { "type": "array", "items": { "required": [ "type", "name", "entity" ], "properties": { "type": { "type": "string" }, "name": { "type": "string" }, "entity": { "type": "string" } } } }, "impactedentity": { "type": "string" } } } } } ] }, "CreateProjectCE": { "allOf": [ { "$ref": "ce_v0_2_without_data.json#/definitions/event" }, { "type": "object", "properties": { "data": { "required": [ "project", "stages" ], "properties": { "project": { "type": "string" }, "stages": { "type": "array", "items": { "required": [ "name", "deployment_strategy" ], "properties": { "name": { "type": "string" }, "deployment_strategy": { "type": "string" }, "test_strategy": { "type": "string" } } } } } } } } ] }, "error": { "type": "object", "required": [ "message" ], "properties": { "code": { "type": "integer", "format": "int64" }, "message": { "type": "string" }, "fields": { "type": "string" } } }, "ChannelInfo" : { "allOf": [ { "$ref": "ce_v0_2_without_data.json#/definitions/event" }, { "type": "object", "properties": { "data": { "properties": { "channelInfo": { "required": [ "token", "channelID" ], "properties": { "token": { "type": "string" }, "channelID": { "type": "string" } } } } } } } ] } } } analysis-0.21.1/fixtures/bugs/remote-absolute/swagger-with-remote-only-ref.json000066400000000000000000000221321413705513100276630ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "keptn api", "version": "0.1.0" }, "schemes": [ "http" ], "basePath": "/", "consumes": [ "application/cloudevents+json" ], "produces": [ "application/cloudevents+json" ], "securityDefinitions": { "key": { "type": "apiKey", "in": "header", "name": "x-token" } }, "security": [ { "key": [] } ], "paths": { "/auth": { "post": { "tags": [ "auth" ], "operationId": "auth", "summary": "Checks the provided token", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "https://raw.githubusercontent.com/cloudevents/spec/v0.2/spec.json#/definitions/event" } } ], "responses": { "200": { "description": "authenticated" } } } }, "/event": { "post": { "tags": [ "event" ], "operationId": "sendEvent", "summary": "Forwards the received event to the eventbroker", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/KeptnContextExtendedCE" } } ], "responses": { "201": { "description": "forwarded", "schema" : { "$ref" : "#/definitions/ChannelInfo" } }, "default": { "description": "error", "schema": { "$ref": "#/definitions/error" } } } } }, "/configure": { "post": { "tags": [ "configure" ], "operationId": "configure", "summary": "Forwards the received configure event to the eventbroker", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/ConfigureCE" } } ], "responses": { "201": { "description": "configured", "schema" : { "$ref" : "#/definitions/ChannelInfo" } }, "default": { "description": "error", "schema": { "$ref": "#/definitions/error" } } } } }, "/project": { "post": { "tags": [ "project" ], "operationId": "project", "summary": "Forwards the received project event to the eventbroker", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/CreateProjectCE" } } ], "responses": { "201": { "description": "project created", "schema" : { "$ref" : "#/definitions/ChannelInfo" } }, "default": { "description": "error", "schema": { "$ref": "#/definitions/error" } } } } }, "/dynatrace": { "post": { "tags": [ "dynatrace" ], "operationId": "dynatrace", "summary": "Forwards the received event from Dynatrace to the eventbroker", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/DynatraceProblemCE" } } ], "responses": { "201": { "description": "event forwarded" }, "default": { "description": "error", "schema": { "$ref": "#/definitions/error" } } } } } }, "definitions": { "KeptnContextExtendedCE": { "allOf": [ { "$ref": "https://raw.githubusercontent.com/cloudevents/spec/v0.2/spec.json#/definitions/event" }, { "type": "object", "required": [ "shkeptncontext" ], "properties": { "shkeptncontext": { "type": "string" } } } ] }, "ConfigureCE": { "allOf": [ { "$ref": "https://raw.githubusercontent.com/cloudevents/spec/v0.2/spec.json#/definitions/event" }, { "type": "object", "properties": { "data": { "required": [ "org", "user", "token" ], "properties": { "org": { "type": "string" }, "user": { "type": "string" }, "token": { "type": "string" } } } } } ] }, "DynatraceProblemCE": { "allOf": [ { "$ref": "https://raw.githubusercontent.com/cloudevents/spec/v0.2/spec.json#/definitions/event" }, { "type": "object", "properties": { "data": { "required": [ "state", "problemid", "pid", "problemtitle", "problemdetails", "impactedentities", "impactedentity" ], "properties": { "state": { "type": "string" }, "problemid": { "type": "string" }, "pid": { "type": "string" }, "problemtitle": { "type": "string" }, "problemdetails": { "required": [ "id" ], "properties": { "id": { "type": "string" } } }, "impactedentities": { "type": "array", "items": { "required": [ "type", "name", "entity" ], "properties": { "type": { "type": "string" }, "name": { "type": "string" }, "entity": { "type": "string" } } } }, "impactedentity": { "type": "string" } } } } } ] }, "CreateProjectCE": { "allOf": [ { "$ref": "https://raw.githubusercontent.com/cloudevents/spec/v0.2/spec.json#/definitions/event" }, { "type": "object", "properties": { "data": { "required": [ "project", "stages" ], "properties": { "project": { "type": "string" }, "stages": { "type": "array", "items": { "required": [ "name", "deployment_strategy" ], "properties": { "name": { "type": "string" }, "deployment_strategy": { "type": "string" }, "test_strategy": { "type": "string" } } } } } } } } ] }, "error": { "type": "object", "required": [ "message" ], "properties": { "code": { "type": "integer", "format": "int64" }, "message": { "type": "string" }, "fields": { "type": "string" } } }, "ChannelInfo" : { "allOf": [ { "$ref": "https://raw.githubusercontent.com/cloudevents/spec/v0.2/spec.json#/definitions/event" }, { "type": "object", "properties": { "data": { "properties": { "channelInfo": { "required": [ "token", "channelID" ], "properties": { "token": { "type": "string" }, "channelID": { "type": "string" } } } } } } } ] } } } analysis-0.21.1/fixtures/bugs/remote-absolute/swagger.json000066400000000000000000000213171413705513100236740ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "keptn api", "version": "0.1.0" }, "schemes": [ "http" ], "basePath": "/", "consumes": [ "application/cloudevents+json" ], "produces": [ "application/cloudevents+json" ], "securityDefinitions": { "key": { "type": "apiKey", "in": "header", "name": "x-token" } }, "security": [ { "key": [] } ], "paths": { "/auth": { "post": { "tags": [ "auth" ], "operationId": "auth", "summary": "Checks the provided token", "parameters": [ { "name": "body", "in": "body", "schema": { } } ], "responses": { "200": { "description": "authenticated" } } } }, "/event": { "post": { "tags": [ "event" ], "operationId": "sendEvent", "summary": "Forwards the received event to the eventbroker", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/KeptnContextExtendedCE" } } ], "responses": { "201": { "description": "forwarded", "schema" : { "$ref" : "#/definitions/ChannelInfo" } }, "default": { "description": "error", "schema": { "$ref": "#/definitions/error" } } } } }, "/configure": { "post": { "tags": [ "configure" ], "operationId": "configure", "summary": "Forwards the received configure event to the eventbroker", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/ConfigureCE" } } ], "responses": { "201": { "description": "configured", "schema" : { "$ref" : "#/definitions/ChannelInfo" } }, "default": { "description": "error", "schema": { "$ref": "#/definitions/error" } } } } }, "/project": { "post": { "tags": [ "project" ], "operationId": "project", "summary": "Forwards the received project event to the eventbroker", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/CreateProjectCE" } } ], "responses": { "201": { "description": "project created", "schema" : { "$ref" : "#/definitions/ChannelInfo" } }, "default": { "description": "error", "schema": { "$ref": "#/definitions/error" } } } } }, "/dynatrace": { "post": { "tags": [ "dynatrace" ], "operationId": "dynatrace", "summary": "Forwards the received event from Dynatrace to the eventbroker", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/DynatraceProblemCE" } } ], "responses": { "201": { "description": "event forwarded" }, "default": { "description": "error", "schema": { "$ref": "#/definitions/error" } } } } } }, "definitions": { "KeptnContextExtendedCE": { "allOf": [ { "type": "object", "required": [ "shkeptncontext" ], "properties": { "shkeptncontext": { "type": "string" } } } ] }, "ConfigureCE": { "allOf": [ { "$ref": "ce_v0_2_without_data.json#/definitions/event" }, { "type": "object", "properties": { "data": { "required": [ "org", "user", "token" ], "properties": { "org": { "type": "string" }, "user": { "type": "string" }, "token": { "type": "string" } } } } } ] }, "DynatraceProblemCE": { "allOf": [ { "$ref": "ce_v0_2_without_data.json#/definitions/event" }, { "type": "object", "properties": { "data": { "required": [ "state", "problemid", "pid", "problemtitle", "problemdetails", "impactedentities", "impactedentity" ], "properties": { "state": { "type": "string" }, "problemid": { "type": "string" }, "pid": { "type": "string" }, "problemtitle": { "type": "string" }, "problemdetails": { "required": [ "id" ], "properties": { "id": { "type": "string" } } }, "impactedentities": { "type": "array", "items": { "required": [ "type", "name", "entity" ], "properties": { "type": { "type": "string" }, "name": { "type": "string" }, "entity": { "type": "string" } } } }, "impactedentity": { "type": "string" } } } } } ] }, "CreateProjectCE": { "allOf": [ { "$ref": "ce_v0_2_without_data.json#/definitions/event" }, { "type": "object", "properties": { "data": { "required": [ "project", "stages" ], "properties": { "project": { "type": "string" }, "stages": { "type": "array", "items": { "required": [ "name", "deployment_strategy" ], "properties": { "name": { "type": "string" }, "deployment_strategy": { "type": "string" }, "test_strategy": { "type": "string" } } } } } } } } ] }, "error": { "type": "object", "required": [ "message" ], "properties": { "code": { "type": "integer", "format": "int64" }, "message": { "type": "string" }, "fields": { "type": "string" } } }, "ChannelInfo" : { "allOf": [ { "$ref": "ce_v0_2_without_data.json#/definitions/event" }, { "type": "object", "properties": { "data": { "properties": { "channelInfo": { "required": [ "token", "channelID" ], "properties": { "token": { "type": "string" }, "channelID": { "type": "string" } } } } } } } ] } } } analysis-0.21.1/fixtures/definitions.yml000066400000000000000000000031571413705513100203330ustar00rootroot00000000000000--- swagger: "2.0" info: version: "0.1.0" title: Definition analysis parameters: someParam: name: someParam in: body schema: type: object responses: someResponse: schema: type: object paths: "/some/where/{id}": parameters: - name: id in: path type: integer format: int32 - name: bodyId in: body schema: type: object get: parameters: - name: limit in: query type: integer format: int32 required: false - name: body in: body schema: type: object responses: default: schema: type: object 200: schema: type: object definitions: tag: type: object properties: id: type: integer format: int64 value: type: string definitions: category: type: object properties: id: type: integer format: int32 value: type: string withAdditionalProps: type: object additionalProperties: type: boolean withAdditionalItems: type: array items: - type: string - type: bool additionalItems: type: integer format: int32 withNot: type: object not: $ref: "#/definitions/tag" withAnyOf: anyOf: - type: object - type: string withOneOf: type: object oneOf: - $ref: "#/definitions/tag" - $ref: "#/definitions/withAdditionalProps" withAllOf: allOf: - type: object - type: string analysis-0.21.1/fixtures/empty-paths.json000066400000000000000000000001731413705513100204360ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "empty-paths", "version": "79.2.1" }, "paths": {} } analysis-0.21.1/fixtures/empty-props.yml000066400000000000000000000006301413705513100203100ustar00rootroot00000000000000--- swagger: '2.0' info: title: "" contact: name: "" license: name: "" schemes: - http basePath: "" consumes: - application/json produces: - application/json externalDocumentation: description: "" x-custom: zorg x-conflict: buzz paths: /common: get: operationId: commonGet summary: here to test path collisons responses: '200': description: OK analysis-0.21.1/fixtures/enums.yml000066400000000000000000000067221413705513100171500ustar00rootroot00000000000000--- swagger: "2.0" info: version: "0.1.0" title: reference analysis parameters: idParam: name: id in: path type: string pattern: 'a[A-Za-Z0-9]+' enum: - aA - b9 - c3 responses: notFound: headers: ContentLength: type: string pattern: '[0-9]+' enum: - '1234' - '123' schema: $ref: "#/definitions/error" paths: "/some/where/{id}": parameters: - $ref: "#/parameters/idParam" - name: name in: query pattern: 'b[A-Za-z0-9]+' enum: - bA - ba - b9 - name: bodyId in: body schema: type: object get: parameters: - name: filter in: query type: string pattern: "[abc][0-9]+" enum: - a0 - b1 - c2 - name: other in: query type: array items: type: string pattern: 'c[A-Za-z0-9]+' enum: - cA - cz - c9 enum: - - cA - cz - c9 - - cA - cz - - cz - c9 - name: body in: body schema: type: object enum: - '{"a": 10, "b": 20}' - '{"a": 11, "d": "zzz"}' responses: default: schema: type: object 404: $ref: "#/responses/notFound" 200: headers: X-Request-Id: type: string pattern: 'd[A-Za-z0-9]+' enum: - dA - d9 schema: $ref: "#/definitions/tag" "/other/place": post: parameters: - name: body in: body schema: type: object properties: value: type: string pattern: 'e[A-Za-z0-9]+' enum: - eA - e9 responses: default: headers: Via: type: array items: type: string pattern: '[A-Za-z]+' enum: - AA - Ab 200: schema: type: object properties: data: type: string pattern: "[0-9]+[abd]" enum: - 123a - 123b - 123d definitions: named: type: string pattern: 'f[A-Za-z0-9]+' enum: - fA - f9 tag: type: object properties: id: type: integer format: int64 value: type: string pattern: 'g[A-Za-z0-9]+' enum: - gA - ga - g9 audit: $ref: "#/definitions/record" record: type: object properties: createdAt: type: string format: date enum: - '{"createdAt": "2018-08-31"}' - '{"createdAt": "2018-09-30"}' error: type: object required: - id - message properties: id: type: integer format: int64 readOnly: true message: type: string readOnly: true withPatternProperties: type: object additionalProperties: true patternProperties: '^prop[0-9]+$': type: string analysis-0.21.1/fixtures/errors.yml000066400000000000000000000000471413705513100173270ustar00rootroot00000000000000error: type: string maxLength: 255 analysis-0.21.1/fixtures/errors/000077500000000000000000000000001413705513100166035ustar00rootroot00000000000000analysis-0.21.1/fixtures/errors/fixture-unexpandable-2.yaml000066400000000000000000000012401413705513100237550ustar00rootroot00000000000000--- swagger: '2.0' info: title: cannot expand schemes: - http basePath: /api consumes: - application/json produces: - application/json parameters: someWhere: name: someWhere in: body required: true schema: type: integer paths: /common: get: operationId: commonGet summary: here to test path collisons responses: '200': description: OK schema: type: array items: $ref: '#/definitions/nowhere' '201': description: OK schema: $ref: '#/thisIs/anAbitrary/jsonPointer/toNowhere' definitions: somePlace: type: string analysis-0.21.1/fixtures/errors/fixture-unexpandable.yaml000066400000000000000000000007261413705513100236260ustar00rootroot00000000000000--- swagger: '2.0' info: title: cannot expand schemes: - http basePath: /api consumes: - application/json produces: - application/json parameters: someWhere: name: someWhere in: body required: true schema: type: integer paths: /common: get: operationId: commonGet summary: here to test path collisons responses: '200': description: OK schema: $ref: "nowhere.yml#/definitions/foo" analysis-0.21.1/fixtures/expected/000077500000000000000000000000001413705513100170705ustar00rootroot00000000000000analysis-0.21.1/fixtures/expected/external-references-1.json000066400000000000000000000057471413705513100240770ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "reference analysis", "version": "0.1.0" }, "paths": { "/other/place": { "$ref": "external/pathItem.yml" }, "/some/where/{id}": { "get": { "parameters": [ { "$ref": "external/parameters.yml#/parameters/limitParam" }, { "type": "array", "items": { "type": "string" }, "name": "other", "in": "query" }, { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/record" } } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/tag" } }, "404": { "$ref": "external/responses.yml#/responses/notFound" }, "default": { "description": "", "schema": { "$ref": "#/definitions/record" } } } }, "parameters": [ { "$ref": "external/parameters.yml#/parameters/idParam" }, { "name": "bodyId", "in": "body", "schema": { "$ref": "#/definitions/record" } } ] } }, "definitions": { "datedRecords": { "type": "array", "items": [ { "type": "string", "format": "date-time" }, { "$ref": "#/definitions/record" } ] }, "datedTag": { "allOf": [ { "type": "string", "format": "date" }, { "$ref": "#/definitions/tag" } ] }, "datedTaggedRecords": { "type": "array", "items": [ { "type": "string", "format": "date-time" }, { "$ref": "#/definitions/record" } ], "additionalItems": { "$ref": "#/definitions/tag" } }, "named": { "type": "string" }, "namedAgain": { "$ref": "#/definitions/named" }, "namedThing": { "type": "object", "properties": { "name": { "$ref": "#/definitions/named" } } }, "otherRecords": { "type": "array", "items": { "$ref": "#/definitions/record" } }, "record": { "type": "object", "properties": { "createdAt": { "type": "string", "format": "date-time" } } }, "records": { "type": "array", "items": [ { "$ref": "#/definitions/record" } ] }, "tag": { "type": "object", "properties": { "audit": { "$ref": "external/definitions.yml#/definitions/record" }, "id": { "type": "integer", "format": "int64" }, "value": { "type": "string" } } }, "tags": { "type": "object", "additionalProperties": { "$ref": "#/definitions/tag" } } }, "parameters": { "someParam": { "name": "someParam", "in": "body", "schema": { "$ref": "#/definitions/record" } } }, "responses": { "someResponse": { "description": "", "schema": { "$ref": "#/definitions/record" } } } } analysis-0.21.1/fixtures/expected/external-references-2.json000066400000000000000000000043741413705513100240730ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "reference analysis", "version": "0.1.0" }, "paths": { "/other/place": { "get": { "description": "Used to see if a codegen can render all the possible parameter variations for a header param", "tags": [ "testcgen" ], "summary": "many model variations", "operationId": "modelOp", "responses": { "default": { "description": "Generic Out" } } } }, "/some/where/{id}": { "get": { "parameters": [ { "type": "integer", "format": "int32", "name": "limit", "in": "query" }, { "type": "array", "items": { "type": "string" }, "name": "other", "in": "query" }, { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/record" } } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/tag" } }, "404": { "description": "", "schema": { "$ref": "#/definitions/error" } }, "default": { "description": "", "schema": { "$ref": "#/definitions/record" } } } }, "parameters": [ { "type": "integer", "format": "int32", "name": "id", "in": "path" }, { "name": "bodyId", "in": "body", "schema": { "$ref": "#/definitions/record" } } ] } }, "definitions": { "error": { "type": "object", "required": [ "id", "message" ], "properties": { "id": { "type": "integer", "format": "int64", "readOnly": true }, "message": { "type": "string", "readOnly": true } } }, "named": { "type": "string" }, "record": { "type": "object", "properties": { "createdAt": { "type": "string", "format": "date-time" } } }, "tag": { "type": "object", "properties": { "audit": { "$ref": "#/definitions/record" }, "id": { "type": "integer", "format": "int64" }, "value": { "type": "string" } } } } } analysis-0.21.1/fixtures/expected/issue-2113.json000066400000000000000000000015121413705513100214760ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "nested $ref fixture", "version": "1" }, "paths": { "/dummy": { "get": { "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/dummy" } } } } }, "/example": { "get": { "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/example" } } } } } }, "definitions": { "dummy": { "required": [ "dummyPayload" ], "properties": { "dummyPayload": { "type": "string" } } }, "example": { "required": [ "payload" ], "properties": { "payload": { "type": "string" } }, "$schema": "http://json-schema.org/draft-07/schema" } } } analysis-0.21.1/fixtures/external/000077500000000000000000000000001413705513100171115ustar00rootroot00000000000000analysis-0.21.1/fixtures/external/definitions.yml000066400000000000000000000021451413705513100221510ustar00rootroot00000000000000definitions: named: type: string tag: type: object properties: id: type: integer format: int64 value: type: string audit: $ref: "#/definitions/record" record: type: object properties: createdAt: type: string format: date-time nestedThing: type: object properties: record: type: array items: - type: string format: date-time - type: object properties: createdAt: type: string format: date-time - allOf: - type: string format: date - type: object additionalProperties: type: object properties: id: type: integer format: int64 value: type: string properties: value: type: string name: $ref: "definitions2.yml#/coordinate"analysis-0.21.1/fixtures/external/definitions2.yml000066400000000000000000000002261413705513100222310ustar00rootroot00000000000000coordinate: type: object properties: id: type: integer format: int64 createdAt: type: string format: date-timeanalysis-0.21.1/fixtures/external/errors.yml000066400000000000000000000003011413705513100211420ustar00rootroot00000000000000error: type: object required: - id - message properties: id: type: integer format: int64 readOnly: true message: type: string readOnly: true analysis-0.21.1/fixtures/external/nestedParams.yml000066400000000000000000000015131413705513100222620ustar00rootroot00000000000000bodyParam: name: body in: body schema: type: object properties: record: type: array items: - type: string format: date-time - type: object properties: createdAt: type: string format: date-time - allOf: - type: string format: date - type: object properties: id: type: integer format: int64 value: type: string name: type: object properties: id: type: integer format: int64 createdAt: type: string format: date-timeanalysis-0.21.1/fixtures/external/nestedResponses.yml000066400000000000000000000013671413705513100230270ustar00rootroot00000000000000genericResponse: type: object properties: record: type: array items: - type: string format: date-time - type: object properties: createdAt: type: string format: date-time - allOf: - type: string format: date - type: object properties: id: type: integer format: int64 value: type: string name: type: object properties: id: type: integer format: int64 createdAt: type: string format: date-timeanalysis-0.21.1/fixtures/external/parameters.yml000066400000000000000000000002701413705513100217760ustar00rootroot00000000000000parameters: idParam: name: id in: path type: integer format: int32 limitParam: name: limit in: query type: integer format: int32 required: falseanalysis-0.21.1/fixtures/external/pathItem.yml000066400000000000000000000003701413705513100214070ustar00rootroot00000000000000get: operationId: modelOp summary: many model variations description: Used to see if a codegen can render all the possible parameter variations for a header param tags: - testcgen responses: default: description: Generic Outanalysis-0.21.1/fixtures/external/responses.yml000066400000000000000000000001021413705513100216460ustar00rootroot00000000000000responses: notFound: schema: $ref: "errors.yml#/error"analysis-0.21.1/fixtures/external_definitions.yml000066400000000000000000000042711413705513100222330ustar00rootroot00000000000000--- swagger: "2.0" info: version: "0.1.0" title: reference analysis parameters: someParam: name: someParam in: body schema: $ref: "external/definitions.yml#/definitions/record" responses: someResponse: schema: $ref: "external/definitions.yml#/definitions/record" paths: "/some/where/{id}": parameters: - $ref: "external/parameters.yml#/parameters/idParam" - name: bodyId in: body schema: $ref: "external/definitions.yml#/definitions/record" get: parameters: - $ref: "external/parameters.yml#/parameters/limitParam" - name: other in: query type: array items: $ref: "external/definitions.yml#/definitions/named" - name: body in: body schema: $ref: "external/definitions.yml#/definitions/record" responses: default: schema: $ref: "external/definitions.yml#/definitions/record" 404: $ref: "external/responses.yml#/responses/notFound" 200: schema: $ref: "external/definitions.yml#/definitions/tag" "/other/place": $ref: "external/pathItem.yml" definitions: namedAgain: $ref: "external/definitions.yml#/definitions/named" datedTag: allOf: - type: string format: date - $ref: "external/definitions.yml#/definitions/tag" records: type: array items: - $ref: "external/definitions.yml#/definitions/record" datedRecords: type: array items: - type: string format: date-time - $ref: "external/definitions.yml#/definitions/record" datedTaggedRecords: type: array items: - type: string format: date-time - $ref: "external/definitions.yml#/definitions/record" additionalItems: $ref: "external/definitions.yml#/definitions/tag" otherRecords: type: array items: $ref: "external/definitions.yml#/definitions/record" tags: type: object additionalProperties: $ref: "external/definitions.yml#/definitions/tag" namedThing: type: object properties: name: $ref: "external/definitions.yml#/definitions/named" analysis-0.21.1/fixtures/external_definitions_valid.yml000066400000000000000000000043271413705513100234140ustar00rootroot00000000000000--- swagger: "2.0" info: version: "0.1.0" title: reference analysis parameters: someParam: name: someParam in: body schema: $ref: "external/definitions.yml#/definitions/record" responses: someResponse: schema: $ref: "external/definitions.yml#/definitions/record" paths: "/some/where/{id}": parameters: - $ref: "external/parameters.yml#/parameters/idParam" - name: bodyId in: body schema: $ref: "external/definitions.yml#/definitions/record" get: parameters: - $ref: "external/parameters.yml#/parameters/limitParam" - name: other in: query type: array # $ref in parameter array items is not swagger 2.0 compliant items: type: string - name: body in: body schema: $ref: "external/definitions.yml#/definitions/record" responses: default: schema: $ref: "external/definitions.yml#/definitions/record" 404: $ref: "external/responses.yml#/responses/notFound" 200: schema: $ref: "external/definitions.yml#/definitions/tag" "/other/place": $ref: "external/pathItem.yml" definitions: namedAgain: $ref: "external/definitions.yml#/definitions/named" datedTag: allOf: - type: string format: date - $ref: "external/definitions.yml#/definitions/tag" records: type: array items: - $ref: "external/definitions.yml#/definitions/record" datedRecords: type: array items: - type: string format: date-time - $ref: "external/definitions.yml#/definitions/record" datedTaggedRecords: type: array items: - type: string format: date-time - $ref: "external/definitions.yml#/definitions/record" additionalItems: $ref: "external/definitions.yml#/definitions/tag" otherRecords: type: array items: $ref: "external/definitions.yml#/definitions/record" tags: type: object additionalProperties: $ref: "external/definitions.yml#/definitions/tag" namedThing: type: object properties: name: $ref: "external/definitions.yml#/definitions/named" analysis-0.21.1/fixtures/fixer/000077500000000000000000000000001413705513100164045ustar00rootroot00000000000000analysis-0.21.1/fixtures/fixer/fixer.yaml000066400000000000000000000064131413705513100204110ustar00rootroot00000000000000--- swagger: '2.0' info: title: spec fixing of empty descriptions version: x80.86 schemes: - http - https basePath: /zorg responses: someResponse: description: '' schema: type: integer anotherRespone: # nil case #description: '' schema: type: integer paths: /noDesc: get: responses: default: description: '' schema: type: integer 200: description: '' schema: type: integer put: responses: default: description: '' schema: type: integer 200: description: '' schema: type: integer delete: responses: default: description: '' schema: type: integer 200: description: '' schema: type: integer post: responses: default: description: '' schema: type: integer 200: description: '' schema: type: integer options: responses: default: description: '' schema: type: integer 200: description: '' schema: type: integer patch: responses: default: description: '' schema: type: integer 200: description: '' schema: type: integer head: responses: default: description: '' schema: type: integer 200: description: '' schema: type: integer /withDesc: get: responses: default: description: 'my description' schema: type: integer 200: description: 'my description' schema: type: integer put: responses: default: description: 'my description' schema: type: integer 200: description: 'my description' schema: type: integer delete: responses: default: description: 'my description' schema: type: integer 200: description: 'my description' schema: type: integer post: responses: default: description: 'my description' schema: type: integer 200: description: 'my description' schema: type: integer options: responses: default: description: 'my description' schema: type: integer 200: description: 'my description' schema: type: integer patch: responses: default: description: 'my description' schema: type: integer 200: description: 'my description' schema: type: integer head: responses: default: description: 'my description' schema: type: integer 200: description: 'my description' schema: type: integer 300: $ref: '#/somewhere/inspace' analysis-0.21.1/fixtures/fixture-1289-param.yaml000066400000000000000000000011271413705513100213410ustar00rootroot00000000000000--- swagger: '2.0' info: title: 'fixture 1289' description: an invalid spec but which passes the analysis stage version: '1.0' produces: - application/json paths: '/fixture': get: operationId: fixtureOp parameters: - $ref: '#/parameters/getSomeIds' responses: '200': parameters: getSomeIds: name: despicableMe in: body description: a bad parameter description schema: type: object properties: someIds: # Wrong now $ref: '#/definitions/someIds' type: array someIds: type: string analysis-0.21.1/fixtures/fixture-342-2.yaml000066400000000000000000000012671413705513100203140ustar00rootroot00000000000000swagger: '2.0' info: title: issue-342-2 description: | A spec which triggers a panic because of invalid ref version: 0.0.1 license: name: MIT host: localhost:8081 basePath: /api/v1 schemes: - http consumes: - application/json produces: - application/json paths: /fixture: get: tags: - maindata operationID: fixtureOp parameters: # Wrong: a whole schema replaces the parameter - name: wrongme in: query required: true $ref: "#/definitions/sample_info/properties/sid" responses: '200': definitions: sample_info: type: object properties: sid: type: string analysis-0.21.1/fixtures/fixture-342-3.yaml000066400000000000000000000012721413705513100203110ustar00rootroot00000000000000swagger: '2.0' info: title: issue-342 description: | A spec which triggers a panic because of invalid type assertion on parameters version: 0.0.1 license: name: MIT host: localhost:8081 basePath: /api/v1 schemes: - http consumes: - application/json produces: - application/json paths: /fixture: get: tags: - maindata operationID: fixtureOp parameters: # Wrong: invalid ref - name: despicableme in: query required: true $ref: "#/definitions/sample_info/properties/sids" responses: '200': definitions: sample_info: type: object properties: sid: type: string analysis-0.21.1/fixtures/fixture-342.yaml000066400000000000000000000015631413705513100201540ustar00rootroot00000000000000swagger: '2.0' info: title: issue-342 description: | A spec which triggers a panic because of invalid type assertion on parameters version: 0.0.1 license: name: MIT host: localhost:8081 basePath: /api/v1 schemes: - http consumes: - application/json produces: - application/json paths: /fixture: get: tags: - maindata operationID: fixtureOp parameters: # Wrong: a whole schema replaces the parameter - name: wrongme in: query required: true $ref: "#/definitions/sample_info/properties/sid" # Wrong: invalid ref - name: despicableme in: query required: true $ref: "#/definitions/sample_info/properties/sids" responses: '200': definitions: sample_info: type: object properties: sid: type: string analysis-0.21.1/fixtures/flatten.yml000066400000000000000000000035211413705513100174500ustar00rootroot00000000000000--- swagger: "2.0" info: version: "0.1.0" title: reference analysis parameters: someParam: name: some in: query type: string responses: notFound: description: "Not Found" schema: $ref: "external/errors.yml#/error" paths: "/some/where/{id}": parameters: - $ref: "external/parameters.yml#/parameters/idParam" get: parameters: - $ref: "external/parameters.yml#/parameters/limitParam" - $ref: "#/parameters/someParam" - name: other in: query type: string - $ref: "external/nestedParams.yml#/bodyParam" responses: default: $ref: "external/nestedResponses.yml#/genericResponse" 404: $ref: "#/responses/notFound" 200: description: "RecordHolder" schema: type: object properties: record: $ref: "external/definitions.yml#/definitions/nestedThing" "/other/place": $ref: "external/pathItem.yml" definitions: namedAgain: $ref: "external/definitions.yml#/definitions/named" datedTag: allOf: - type: string format: date - $ref: "external/definitions.yml#/definitions/tag" records: type: array items: - $ref: "external/definitions.yml#/definitions/record" datedRecords: type: array items: - type: string format: date-time - $ref: "external/definitions.yml#/definitions/record" otherRecords: type: array items: $ref: "external/definitions.yml#/definitions/record" tags: type: object additionalProperties: $ref: "external/definitions.yml#/definitions/tag" namedThing: type: object properties: name: $ref: "external/definitions.yml#/definitions/named" namedAgain: $ref: "#/definitions/namedAgain" analysis-0.21.1/fixtures/foo-crud.yml000066400000000000000000000070501413705513100175320ustar00rootroot00000000000000--- swagger: '2.0' info: title: foo CRUD API version: 4.2.0 schemes: - http basePath: /api consumes: - application/json produces: - application/json paths: /common: get: operationId: commonGet summary: here to test path collisons responses: '200': description: OK schema: $ref: "#/definitions/foo" /foos: post: operationId: create summary: Create a new foo parameters: - name: info in: body schema: $ref: "#/definitions/foo" responses: '201': description: created schema: $ref: "#/definitions/fooId" default: description: error schema: $ref: "#/definitions/error" /foos/{fooid}: get: operationId: get summary: Get a foo by id parameters: - $ref: "#/parameters/fooid" responses: '200': description: OK schema: $ref: "#/definitions/foo" '401': $ref: "#/responses/401" '404': $ref: "#/responses/404" default: description: error schema: $ref: "#/definitions/error" delete: operationId: delete summary: delete a foo by id parameters: - name: fooid in: path required: true type: string responses: '200': description: OK '401': description: unauthorized schema: $ref: "#/definitions/error" '404': description: resource not found schema: $ref: "#/definitions/error" default: description: error schema: $ref: "#/definitions/error" post: operationId: update summary: update a foo by id parameters: - name: fooid in: path required: true type: string - name: info in: body schema: $ref: "#/definitions/foo" responses: '200': description: OK '401': description: unauthorized schema: $ref: "#/definitions/error" '404': description: resource not found schema: $ref: "#/definitions/error" default: description: error schema: $ref: "#/definitions/error" definitions: common: type: object required: - id properties: id: type: string format: string minLength: 1 foo: type: object required: - name - description properties: id: type: string format: string readOnly: true name: type: string format: string minLength: 1 description: type: string format: string minLength: 1 fooId: type: object required: - id properties: id: type: string format: string minLength: 1 error: type: object required: - message properties: code: type: string format: string message: type: string fields: type: string parameters: common: name: common in: query type: string fooid: name: fooid in: path required: true type: string responses: 401: description: foo unauthorized schema: $ref: "#/definitions/error" 404: description: foo resource not found schema: $ref: "#/definitions/error" analysis-0.21.1/fixtures/inline_schemas.yml000066400000000000000000000070521413705513100207770ustar00rootroot00000000000000--- swagger: "2.0" info: version: "0.1.0" title: reference analysis parameters: someParam: name: someParam in: body schema: type: object properties: createdAt: type: string format: date-time responses: someResponse: schema: type: object properties: createdAt: type: string format: date-time paths: "/some/where/{id}": parameters: - name: id in: path type: integer format: int32 - name: bodyId in: body schema: type: object properties: createdAt: type: string format: date-time post: responses: default: description: all good get: parameters: - name: limit in: query type: integer format: int32 required: false - name: other in: query type: array items: type: object properties: id: type: integer format: int64 - name: body in: body schema: type: object properties: createdAt: type: string format: date-time responses: default: schema: type: object properties: createdAt: type: string format: date-time 404: schema: $ref: "errors.yml#/error" 200: schema: type: object properties: id: type: integer format: int64 value: type: string "/other/place": $ref: "external/pathItem.yml" definitions: namedAgain: type: object properties: id: type: integer format: int64 datedTag: allOf: - type: string format: date - type: object properties: id: type: integer format: int64 value: type: string records: type: array items: - type: object properties: createdAt: type: string format: date-time datedRecords: type: array items: - type: string format: date-time - type: object properties: createdAt: type: string format: date-time datedTaggedRecords: type: array items: - type: string format: date-time - type: object properties: createdAt: type: string format: date-time additionalItems: type: object properties: id: type: integer format: int64 value: type: string otherRecords: type: array items: type: object properties: createdAt: type: string format: date-time tags: type: object additionalProperties: type: object properties: id: type: integer format: int64 value: type: string namedThing: type: object properties: name: type: object properties: id: type: integer format: int64 # depth first should have this at the bottom, it's just a very long name pneumonoultramicroscopicsilicovolcanoconiosisAntidisestablishmentarianism: type: object properties: floccinaucinihilipilificationCreatedAt: type: integer format: int64 analysis-0.21.1/fixtures/more_nested_inline_schemas.yml000066400000000000000000000200661413705513100233630ustar00rootroot00000000000000--- swagger: "2.0" info: version: "0.1.0" title: reference analysis parameters: someParam: name: someParam in: body schema: type: object properties: createdAt: type: string format: date-time responses: someResponse: schema: type: object properties: createdAt: type: string format: date-time paths: "/some/where/{id}": parameters: - name: id in: path type: integer format: int32 - name: bodyId in: body schema: type: array items: type: object properties: createdAt: type: string format: date-time post: responses: 200: description: some nested maps schema: type: object additionalProperties: type: object additionalProperties: type: object additionalProperties: type: obect properties: prop1: type: integer prop2: type: string 204: description: some nested maps schema: type: object additionalProperties: type: array items: type: object additionalProperties: type: array items: type: object additionalProperties: type: array items: type: object properties: prop3: type: integer prop4: type: string default: description: all good get: parameters: - name: limit in: query type: integer format: int32 required: false - name: other in: query type: array items: type: object properties: id: type: integer format: int64 - name: body in: body schema: type: object properties: record: type: array items: - type: string format: date-time - type: object properties: createdAt: type: string format: date-time - allOf: - type: string format: date - type: object properties: id: type: integer format: int64 value: type: string name: type: object properties: id: type: integer format: int64 createdAt: type: string format: date-time responses: default: schema: type: object properties: record: type: array items: - type: string format: date-time - type: object properties: createdAt: type: string format: date-time - allOf: - type: string format: date - type: object properties: id: type: integer format: int64 value: type: string name: type: object properties: id: type: integer format: int64 createdAt: type: string format: date-time 404: schema: $ref: "external/errors.yml#/error" 200: schema: type: object properties: record: type: array items: - type: string format: date-time - type: object properties: createdAt: type: string format: date-time - allOf: - type: string format: date - type: object properties: id: type: integer format: int64 value: type: string name: type: object properties: id: type: integer format: int64 createdAt: type: string format: date-time "/other/place": $ref: "external/pathItem.yml" definitions: namedAgain: type: object properties: id: type: integer format: int64 datedTag: allOf: - type: string format: date - type: object properties: id: type: integer format: int64 value: type: string records: type: array items: - type: object properties: createdAt: type: string format: date-time datedRecords: type: array items: - type: string format: date-time - type: object properties: createdAt: type: string format: date-time datedTaggedRecords: type: array items: - type: string format: date-time - type: object properties: createdAt: type: string format: date-time additionalItems: type: object properties: id: type: integer format: int64 value: type: string otherRecords: type: array items: type: object properties: createdAt: type: string format: date-time tags: type: object additionalProperties: type: object properties: id: type: integer format: int64 value: type: string namedThing: type: object properties: name: type: object properties: id: type: integer format: int64 nestedThing: type: object properties: record: type: array items: - type: string format: date-time - type: object properties: createdAt: type: string format: date-time - allOf: - type: string format: date - type: object additionalProperties: type: object properties: id: type: integer format: int64 value: type: string properties: id: type: integer format: int64 value: type: string name: type: object properties: id: type: integer format: int64 createdAt: type: string format: date-time analysis-0.21.1/fixtures/nested_inline_schemas.yml000066400000000000000000000160531413705513100223420ustar00rootroot00000000000000--- swagger: "2.0" info: version: "0.1.0" title: reference analysis parameters: someParam: name: someParam in: body schema: type: object properties: createdAt: type: string format: date-time responses: someResponse: schema: type: object properties: createdAt: type: string format: date-time paths: "/some/where/{id}": parameters: - name: id in: path type: integer format: int32 - name: bodyId in: body schema: type: array items: type: object properties: createdAt: type: string format: date-time post: responses: default: description: all good get: parameters: - name: limit in: query type: integer format: int32 required: false - name: other in: query type: array items: type: object properties: id: type: integer format: int64 - name: body in: body schema: type: object properties: record: type: array items: - type: string format: date-time - type: object properties: createdAt: type: string format: date-time - allOf: - type: string format: date - type: object properties: id: type: integer format: int64 value: type: string name: type: object properties: id: type: integer format: int64 createdAt: type: string format: date-time responses: default: description: ok schema: type: object properties: record: type: array items: - type: string format: date-time - type: object properties: createdAt: type: string format: date-time - allOf: - type: string format: date - type: object properties: id: type: integer format: int64 value: type: string name: type: object properties: id: type: integer format: int64 createdAt: type: string format: date-time 404: description: ok schema: $ref: "errors.yml#/error" 200: description: ok schema: type: object properties: record: type: array items: - type: string format: date-time - type: object properties: createdAt: type: string format: date-time - allOf: - type: string format: date - type: object properties: id: type: integer format: int64 value: type: string name: type: object properties: id: type: integer format: int64 createdAt: type: string format: date-time "/other/place": $ref: "external/pathItem.yml" definitions: namedAgain: type: object properties: id: type: integer format: int64 datedTag: allOf: - type: string format: date - type: object properties: id: type: integer format: int64 value: type: string records: type: array items: - type: object properties: createdAt: type: string format: date-time datedRecords: type: array items: - type: string format: date-time - type: object properties: createdAt: type: string format: date-time datedTaggedRecords: type: array items: - type: string format: date-time - type: object properties: createdAt: type: string format: date-time additionalItems: type: object properties: id: type: integer format: int64 value: type: string otherRecords: type: array items: type: object properties: createdAt: type: string format: date-time tags: type: object additionalProperties: type: object properties: id: type: integer format: int64 value: type: string namedThing: type: object properties: name: type: object properties: id: type: integer format: int64 nestedThing: type: object properties: record: type: array items: - type: string format: date-time - type: object properties: createdAt: type: string format: date-time - allOf: - type: string format: date - type: object additionalProperties: type: object properties: id: type: integer format: int64 value: type: string properties: id: type: integer format: int64 value: type: string name: type: object properties: id: type: integer format: int64 createdAt: type: string format: date-time analysis-0.21.1/fixtures/no-paths.yml000066400000000000000000000011131413705513100175370ustar00rootroot00000000000000--- swagger: '2.0' info: title: no paths API version: 4.1.7 schemes: - http basePath: /wooble consumes: - application/json produces: - application/json paths: definitions: common: type: object required: - id properties: id: type: string format: string minLength: 1 parameters: common: name: common in: query type: string responses: 401: description: bar unauthorized schema: $ref: "#/definitions/error" 404: description: bar resource not found schema: $ref: "#/definitions/error" analysis-0.21.1/fixtures/oaigen/000077500000000000000000000000001413705513100165315ustar00rootroot00000000000000analysis-0.21.1/fixtures/oaigen/fixture-oaigen.yaml000066400000000000000000000102121413705513100223370ustar00rootroot00000000000000--- swagger: '2.0' info: version: '0.1.0' title: reference analysis parameters: someParam: name: some in: query type: string bodyParam: name: some in: body schema: # expect this $ref to be kept $ref: '#/definitions/myBody' responses: notFound: description: 'Not Found' schema: $ref: '#/definitions/notFound' paths: /some/where: parameters: - $ref: '#/parameters/someParam' get: parameters: - $ref: '#/parameters/bodyParam' - name: other in: query type: string responses: default: $ref: '#/responses/notFound' 404: description: ok schema: $ref: '#/definitions/myResponse' 304: description: ok schema: $ref: 'transitive-1.yaml#/definitions/transitive-1.1' 204: description: ok schema: $ref: '#/definitions/uniqueName1' 200: description: 'RecordHolder' schema: type: object properties: prop0: $ref: '#/definitions/myBody' 206: description: ok schema: $ref: 'transitive-1.yaml#/definitions/a' 205: description: ok schema: $ref: 'transitive-1.yaml#/definitions/b' # arbitrary json pointers post: responses: 200: description: ok schema: # this one gets resolved $ref: 'transitive-2.yaml#/definitions/a/properties/b' 204: description: ok schema: # this one gets resolved $ref: 'transitive-1.yaml#/definitions/c/properties/d' default: description: default schema: # this one remains (same file) $ref: '#/definitions/myDefaultResponse/properties/zzz' /some/where/else: get: responses: default: description: default schema: $ref: '#/definitions/notFound' /yet/again/some/where: get: responses: default: description: default schema: $ref: 'transitive-1.yaml#/somewhere' /with/slice/container: get: responses: default: description: default schema: allOf: - $ref: '#/definitions/uniqueName3' - $ref: 'transitive-1.yaml#/definitions/uniqueName3' /with/tuple/container: get: responses: default: description: default schema: type: array items: - $ref: '#/definitions/uniqueName3' - $ref: 'transitive-1.yaml#/definitions/uniqueName3' /with/tuple/conflict: get: responses: default: description: default schema: type: array items: - $ref: 'transitive-1.yaml#/definitions/uniqueName4' - $ref: 'transitive-2.yaml#/definitions/uniqueName4' /with/boolable/container: get: responses: default: description: default schema: type: object additionalProperties: $ref: 'transitive-1.yaml#/definitions/uniqueName5' definitions: myDefaultResponse: type: object properties: zzz: type: integer myBody: type: object properties: prop1: type: integer aA: $ref: '#/definitions/aA' aA: type: string format: date bB: type: string format: date-time myResponse: type: object properties: prop2: type: integer notFound: type: array items: type: integer uniqueName1: # expect this to be expanded after OAIGen stripping $ref: 'transitive-1.yaml#/definitions/uniqueName1' notUniqueName2: # this one prevents OAIGen stripping $ref: 'transitive-1.yaml#/definitions/uniqueName2' uniqueName2: $ref: 'transitive-1.yaml#/definitions/uniqueName2' uniqueName3: type: object properties: prop7: type: integer uniqueName5: type: object properties: prop10: type: integer analysis-0.21.1/fixtures/oaigen/test3-bis-swagger.yaml000066400000000000000000000016001413705513100226640ustar00rootroot00000000000000swagger: '2.0' info: version: 0.1.1 title: test 1 description: recursively following JSON references contact: name: Fred schemes: - http consumes: - application/json produces: - application/json paths: /getAll: get: operationId: getAll parameters: - name: a in: body description: max number of results schema: $ref: '#/definitions/a' responses: '200': description: Success schema: $ref: '#/definitions/b' '201': description: Success schema: $ref: '#/definitions/b' '203': description: Success schema: $ref: '#/definitions/c' definitions: a: type: string b: type: array items: type: string c: type: object additionalProperties: type: integer analysis-0.21.1/fixtures/oaigen/test3-model-schema.json000066400000000000000000000010761413705513100230260ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "id": "./test3-model-schema.json", "title": "test3-model-schema", "description": "Test schema responses", "definitions": { "b": { "type": "object", "required": ["a1"], "additionalProperties": false, "properties": { "a1": { "type": "string" }, "a2": { "type": "integer" } } }, "c": { "type": "object", "additionalProperties": { "type": "integer" } } } } analysis-0.21.1/fixtures/oaigen/test3-swagger.yaml000066400000000000000000000014601413705513100221150ustar00rootroot00000000000000swagger: '2.0' info: version: 0.1.1 title: test 1 description: recursively following JSON references contact: name: Fred schemes: - http consumes: - application/json produces: - application/json paths: /getAll: get: operationId: getAll parameters: - name: a in: body description: max number of results required: false schema: $ref: '#/definitions/a' responses: '200': description: Success schema: $ref: '#/definitions/b' '203': description: Success schema: $ref: '#/definitions/c' definitions: a: type: string b: $ref: 'test3-model-schema.json#/definitions/b' c: $ref: 'test3-model-schema.json#/definitions/c' analysis-0.21.1/fixtures/oaigen/test3-ter-model-schema.json000066400000000000000000000010041413705513100236050ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "test3-model-schema", "description": "Test schema responses", "definitions": { "b1": { "type": "array", "items": { "type": "string" } }, "b2": { "type": "object", "properties": { "x2": { "type": "string" } } }, "b3": { "type": "object", "additionalProperties": { "type": "string" } } } } analysis-0.21.1/fixtures/oaigen/test3-ter-swagger-flat.json000066400000000000000000000032541413705513100236430ustar00rootroot00000000000000{ "consumes": [ "application/json" ], "produces": [ "application/json" ], "schemes": [ "http" ], "swagger": "2.0", "info": { "description": "recursively following JSON references", "title": "test 1", "contact": { "name": "Fred" }, "version": "0.1.1" }, "paths": { "/getAll": { "get": { "operationId": "getAll", "parameters": [ { "description": "max number of results", "name": "a", "in": "body", "schema": { "$ref": "#/definitions/a" } } ], "responses": { "200": { "description": "Success", "schema": { "$ref": "#/definitions/b1" } }, "201": { "description": "Success", "schema": { "$ref": "#/definitions/b2" } }, "203": { "description": "Success", "schema": { "$ref": "#/definitions/b3" } } } } } }, "definitions": { "a": { "type": "string" }, "b1": { "$ref": "#/definitions/b1OAIGen" }, "b1OAIGen": { "type": "array", "items": { "type": "string" } }, "b2": { "$ref": "#/definitions/b2OAIGen" }, "b2OAIGen": { "type": "object", "properties": { "x2": { "type": "string" } } }, "b3": { "$ref": "#/definitions/b3OAIGen" }, "b3OAIGen": { "type": "object", "additionalProperties": { "type": "string" } } } } analysis-0.21.1/fixtures/oaigen/test3-ter-swagger.yaml000066400000000000000000000017501413705513100227070ustar00rootroot00000000000000swagger: '2.0' info: version: 0.1.1 title: test 1 description: recursively following JSON references contact: name: Fred schemes: - http consumes: - application/json produces: - application/json paths: /getAll: get: operationId: getAll parameters: - name: a in: body description: max number of results required: false schema: $ref: '#/definitions/a' responses: '200': description: Success schema: $ref: '#/definitions/b1' '201': description: Success schema: $ref: '#/definitions/b2' '203': description: Success schema: $ref: '#/definitions/b3' definitions: a: type: string b1: $ref: './test3-ter-model-schema.json#/definitions/b1' b2: $ref: './test3-ter-model-schema.json#/definitions/b2' b3: $ref: './test3-ter-model-schema.json#/definitions/b3' analysis-0.21.1/fixtures/oaigen/transitive-1.yaml000066400000000000000000000014501413705513100217430ustar00rootroot00000000000000somewhere: type: array items: type: integer definitions: transitive-1.1: $ref: "#/definitions/transitive-1.2" transitive-1.2: $ref: "transitive-2.yaml#/definitions/transitive-2.1" uniqueName1: $ref: "transitive-2.yaml#/definitions/uniqueName1" uniqueName2: $ref: "transitive-2.yaml#/definitions/uniqueName2" uniqueName3: type: object properties: prop8: type: string uniqueName4: type: object properties: prop9: type: string uniqueName5: type: number a: type: object properties: a: $ref: "transitive-2.yaml#/definitions/a" b: type: array items: $ref: "transitive-2.yaml#/definitions/b" c: type: object properties: d: $ref: "transitive-2.yaml#/definitions/b" analysis-0.21.1/fixtures/oaigen/transitive-2.yaml000066400000000000000000000007461413705513100217530ustar00rootroot00000000000000definitions: transitive-2.1: type: object properties: prop4: type: integer uniqueName1: type: object properties: prop5: type: integer uniqueName2: type: object properties: prop6: type: integer uniqueName4: type: object properties: prop10: type: string a: type: object properties: b: type: integer b: type: object properties: c: type: integer analysis-0.21.1/fixtures/operations/000077500000000000000000000000001413705513100174525ustar00rootroot00000000000000analysis-0.21.1/fixtures/operations/fixture-operations.yaml000066400000000000000000000040541413705513100242100ustar00rootroot00000000000000--- swagger: '2.0' info: version: '0.1.0' title: operations and operationIDs parameters: someParam: name: some in: query type: string bodyParam: name: some in: body schema: $ref: '#/definitions/myBody' responses: notFound: description: 'Not Found' schema: type: string default: "Element no found" defaultResponse: description: 'Default response' schema: type: string maxLength: 255 definitions: myBody: type: integer unused: type: integer paths: /some/where: parameters: - $ref: '#/parameters/someParam' get: operationId: getSomeWhere parameters: - $ref: '#/parameters/bodyParam' - name: other in: query type: string responses: 403: $ref: '#/responses/notFound' post: operationId: postSomeWhere responses: default: $ref: '#/responses/defaultResponse' /some/where/else: parameters: - $ref: '#/parameters/someParam' get: operationId: getSomeWhereElse parameters: - $ref: '#/parameters/someParam' - name: myOtherBodyParam in: body schema: $ref: '#/definitions/myBody' responses: default: $ref: '#/responses/defaultResponse' put: operationId: putSomeWhereElse responses: default: $ref: '#/responses/defaultResponse' post: operationId: postSomeWhereElse responses: default: $ref: '#/responses/defaultResponse' patch: operationId: patchSomeWhereElse responses: default: $ref: '#/responses/defaultResponse' delete: operationId: deleteSomeWhereElse responses: default: $ref: '#/responses/defaultResponse' head: operationId: headSomeWhereElse responses: default: $ref: '#/responses/defaultResponse' options: operationId: optionsSomeWhereElse responses: default: $ref: '#/responses/defaultResponse' analysis-0.21.1/fixtures/other-mixin.yml000066400000000000000000000007241413705513100202600ustar00rootroot00000000000000--- swagger: '2.0' info: title: extension of tags, schemes and consumes/produces version: 4.2.0 schemes: - http - https basePath: /api consumes: - application/json - application/octet-stream produces: - application/json - application/xml tags: - name: ticket description: operations to get and store tickets - name: game description: operations to follow games - name: conflict description: a tag in conflict with primary spec paths: analysis-0.21.1/fixtures/parameters/000077500000000000000000000000001413705513100174325ustar00rootroot00000000000000analysis-0.21.1/fixtures/parameters/fixture-parameters.yaml000066400000000000000000000062771413705513100241610ustar00rootroot00000000000000--- swagger: '2.0' info: version: '0.1.0' title: parameters and responses expansion parameters: someParam: name: some in: query type: string pattern: '^[a-z]$' bodyParam: name: some in: body schema: $ref: '#/definitions/myBody' someHeader: name: headerRefed in: header type: string anotherHeader: name: headerSlice in: header type: array items: type: string arrayQuery: name: arrayInQuery in: query type: array items: type: integer responses: notFound: description: 'Not Found' schema: type: string default: "Element no found" defaultResponse: description: 'Default response' headers: x-yet-another-header: type: array items: type: string schema: type: string maxLength: 255 definitions: myBody: type: integer unused: type: integer schemaWithAllOf: type: object allOf: - type: object properties: prop1: type: integer - type: object properties: prop2: type: string pattern: '^[a-z]$' paths: /some/where: parameters: - $ref: '#/parameters/someParam' - $ref: '#/parameters/arrayQuery' - name: anotherArray in: query type: array items: type: integer get: parameters: - $ref: '#/parameters/bodyParam' - name: other in: query type: string - $ref: '#/parameters/anotherHeader' - name: andAnother in: query type: array items: type: integer responses: 403: $ref: '#/responses/notFound' default: description: default headers: x-pattern-default: type: string pattern: '^[a-z]$' x-array-pattern-default: type: array items: type: string pattern: '^[a-z]$' post: operationId: postSomeWhere parameters: - name: headerParam in: header type: string - $ref: '#/parameters/someHeader' - name: nestedParam in: query type: array items: type: array items: type: string pattern: '^[a-z]$' responses: 200: description: ok headers: x-post-header: type: string pattern: '^[a-z]$' x-response-array-header: type: array items: type: string schema: $ref: '#/definitions/schemaWithAllOf' 201: description: ok schema: type: array items: $ref: '#/definitions/schemaWithAllOf' default: $ref: '#/responses/defaultResponse' /some/where/else: get: parameters: - $ref: '#/parameters/someParam' - name: myOtherBodyParam in: body schema: $ref: '#/definitions/myBody' responses: default: $ref: '#/responses/defaultResponse' /some/remote: $ref: 'other-source.yaml#/pathItems/patchMethod' analysis-0.21.1/fixtures/parameters/other-source.yaml000066400000000000000000000005361413705513100227410ustar00rootroot00000000000000pathItems: patchMethod: parameters: - name: somePatchParam in: query type: string patch: operationId: patchOp parameters: - name: myPatchParam in: query required: false type: integer responses: 200: description: ok schema: type: string analysis-0.21.1/fixtures/patterns.yml000066400000000000000000000047471413705513100176660ustar00rootroot00000000000000--- swagger: "2.0" info: version: "0.1.0" title: reference analysis parameters: idParam: name: id in: path type: string pattern: 'a[A-Za-Z0-9]+' responses: notFound: headers: ContentLength: type: string pattern: '[0-9]+' schema: $ref: "#/definitions/error" paths: "/some/where/{id}": parameters: - $ref: "#/parameters/idParam" - name: name in: query pattern: 'b[A-Za-z0-9]+' - name: bodyId in: body schema: type: object get: parameters: - name: filter in: query type: string pattern: "[abc][0-9]+" - name: other in: query type: array items: type: string pattern: 'c[A-Za-z0-9]+' - name: body in: body schema: type: object responses: default: schema: type: object 404: $ref: "#/responses/notFound" 200: headers: X-Request-Id: type: string pattern: 'd[A-Za-z0-9]+' schema: $ref: "#/definitions/tag" "/other/place": post: parameters: - name: body in: body schema: type: object properties: value: type: string pattern: 'e[A-Za-z0-9]+' responses: default: headers: Via: type: array items: type: string pattern: '[A-Za-z]+' 200: schema: type: object properties: data: type: string pattern: "[0-9]+[abd]" definitions: named: type: string pattern: 'f[A-Za-z0-9]+' tag: type: object properties: id: type: integer format: int64 value: type: string pattern: 'g[A-Za-z0-9]+' audit: $ref: "#/definitions/record" record: type: object properties: createdAt: type: string format: date-time error: type: object required: - id - message properties: id: type: integer format: int64 readOnly: true message: type: string readOnly: true withPatternProperties: type: object additionalProperties: true patternProperties: '^prop[0-9]+$': type: string analysis-0.21.1/fixtures/pointers/000077500000000000000000000000001413705513100171325ustar00rootroot00000000000000analysis-0.21.1/fixtures/pointers/fixture-pointers-loop.yaml000066400000000000000000000010531413705513100243130ustar00rootroot00000000000000--- swagger: '2.0' info: version: '0.1.0' title: JSON pointers paths: /some/where: get: responses: default: schema: $ref: '#/definitions/whiteStone/properties/p1' definitions: whiteStone: type: object properties: p1: $ref: '#/definitions/blackStone/properties/p2' blackStone: type: object properties: p2: $ref: '#/definitions/redStone/properties/p3' redStone: type: object properties: p3: $ref: '#/definitions/whiteStone/properties/p1' analysis-0.21.1/fixtures/pointers/fixture-pointers.yaml000066400000000000000000000110221413705513100233410ustar00rootroot00000000000000--- swagger: '2.0' info: version: '0.1.0' title: JSON pointers parameters: someParam: name: some in: query type: string bodyParam: name: some in: body schema: $ref: '#/responses/notFound/schema' remoteParam: name: some in: body schema: $ref: 'remote.yaml#/remotes/u64' responses: notFound: description: 'Not Found' schema: $ref: '#/definitions/notFound' funnyResponse: description: ok schema: $ref: '#/parameters/bodyParam/schema' remoteResponse: description: ok schema: type: object properties: prop0: $ref: 'remote.yaml#/remotes/u64' paths: /some/where: parameters: - $ref: '#/parameters/someParam' get: parameters: - $ref: '#/parameters/bodyParam' - name: other in: query type: string responses: default: $ref: '#/responses/notFound' 404: description: ok schema: $ref: '#/definitions/myResponse' 200: description: 'RecordHolder' schema: type: object properties: prop0: $ref: '#/definitions/myBody' post: responses: default: description: default schema: $ref: '#/definitions/myDefaultResponse/properties/zzz' 203: description: funny schema: $ref: '#/responses/funnyResponse/schema' 204: $ref: '#/responses/funnyResponse' /some/where/else: get: responses: default: description: default schema: $ref: '#/definitions/notFound' 200: description: ok schema: $ref: '#/definitions/myDefaultResponse' /with/slice/container: get: responses: default: description: default schema: allOf: - $ref: 'remote.yaml#/remotes/u64' - $ref: 'remote.yaml#/remotes/u32' - $ref: '#/definitions/myBody/properties/prop3' /with/tuple/container: get: responses: default: description: default schema: type: array items: - $ref: '#/definitions/myBody/properties/prop2' - $ref: '#/definitions/myBody/properties/prop3' - $ref: 'remote.yaml#/remotes/i32' /with/array/container: get: responses: 200: description: ok schema: $ref: '#/definitions/anArray' default: description: default schema: type: array items: $ref: '#/definitions/anArray/items' /with/boolable/container: get: responses: 200: description: ok schema: type: array items: - type: integer - type: string additionalItems: $ref: '#/definitions/myBody/properties/prop3' default: description: default schema: type: object additionalProperties: $ref: '#/definitions/myBody/properties/prop3' /with/ZcomesFirstInOrder/container: get: responses: 200: description: ok schema: type: array items: - type: integer - type: string additionalItems: $ref: '#/definitions/myBody/properties/prop3' 203: description: ok schema: $ref: '#/definitions/anExtensible/additionalProperties' 204: description: ok schema: type: object additionalProperties: type: object additionalProperties: $ref: '#/definitions/anExtensible/additionalProperties' definitions: anExtensible: type: object additionalProperties: type: object properties: addProp1: type: string anArray: type: array items: type: string format: uuid notFound: type: object properties: prop1: $ref: '#/definitions/myDefaultResponse/properties/zzz' myDefaultResponse: type: object properties: zzz: type: integer myResponse: type: object additionalProperties: $ref: '#/definitions/notFound/properties/prop1' myBody: type: object properties: prop2: type: integer prop3: $ref: '#/definitions/myDefaultResponse/properties/zzz' analysis-0.21.1/fixtures/pointers/remote.yaml000066400000000000000000000002671413705513100213160ustar00rootroot00000000000000remotes: u32: type: integer format: uint32 i32: type: integer format: int32 u64: type: integer format: uint64 i64: type: integer format: int64 analysis-0.21.1/fixtures/references.yml000066400000000000000000000041261413705513100201360ustar00rootroot00000000000000--- swagger: "2.0" info: version: "0.1.0" title: reference analysis parameters: idParam: name: id in: path type: integer format: int32 limitParam: name: limit in: query type: integer format: int32 required: false responses: notFound: schema: $ref: "#/definitions/error" paths: "/some/where/{id}": parameters: - $ref: "#/parameters/idParam" - name: bodyId in: body schema: type: object get: parameters: - $ref: "#/parameters/limitParam" - name: other in: query type: array items: # NOTE: $ref here is forbidden in swagger 2.0 # however, it is possible to analyze this $ref: "#/definitions/named" - name: otherHeader in: header type: array items: # NOTE: $ref here is forbidden in swagger 2.0 # however, it is possible to analyze this $ref: "#/definitions/named" - name: body in: body schema: type: object responses: default: headers: x-array-header: type: array items: # NOTE: $ref here is forbidden in swagger 2.0 # however, it is possible to analyze this $ref: '#/definitions/named' schema: type: object 404: $ref: "#/responses/notFound" 200: schema: $ref: "#/definitions/tag" "/other/place": $ref: "#/x-shared-path/getItems" definitions: named: type: string tag: type: object properties: id: type: integer format: int64 value: type: string audit: $ref: "#/definitions/record" record: type: object properties: createdAt: type: string format: date-time error: type: object required: - id - message properties: id: type: integer format: int64 readOnly: true message: type: string readOnly: true analysis-0.21.1/fixtures/securitydef.yml000066400000000000000000000012301413705513100203340ustar00rootroot00000000000000--- swagger: '2.0' info: title: extension of securityDefinitions version: 4.2.0 schemes: - http basePath: /api consumes: - application/json produces: - application/json securityDefinitions: myOtherRoles: description: definition of scopes as roles type: oauth2 flow: accessCode authorizationUrl: https://foo.bar.com/authorize tokenUrl: https://foo.bar.com/token scopes: otherSellers: group of sellers otherBuyers: group of buyers mySecondaryApiKey: type: apiKey name: X-secondaryApiKey in: header myBasicAuth: type: basic description: basic primary auth security: - myBasicAuth: [] paths: analysis-0.21.1/fixtures/swagger-props.yml000066400000000000000000000013261413705513100206140ustar00rootroot00000000000000--- swagger: '2.0' host: www.example.com basePath: /merged info: title: "Merged title" description: "Merged description" termsOfService: "Merged terms" version: "x" contact: name: "merged contact" URL: "https://www.example.com/contact" Email: "contact@example.com" x-teams: "show this field" license: name: "merged license" URL: "https://www.example.com/license" x-license: "custom term" x-custom-info: custom externalDocumentation: description: "merge doc" URL: "https://www.example.com/doc" x-merger: value x-conflict: buzz paths: /merged: get: operationId: mergedGet summary: here to test merged path responses: '200': description: OK analysis-0.21.1/fixtures/widget-crud.yml000066400000000000000000000103221413705513100202260ustar00rootroot00000000000000--- swagger: '2.0' info: title: widget CRUD API version: 4.2.0 schemes: - http basePath: /api consumes: - application/json produces: - application/json securityDefinitions: myRoles: description: definition of scopes as roles type: oauth2 flow: accessCode authorizationUrl: https://foo.bar.com/authorize tokenUrl: https://foo.bar.com/token scopes: sellers: group of sellers buyers: group of buyers myPrimaryAPIKey: type: apiKey name: X-primaryApiKey in: header myBasicAuth: type: basic description: basic primary auth security: - myPrimaryAPIKey: [] - myBasicAuth: [] myRoles: [ sellers ] - myBasicAuth: [] tags: - name: conflict description: a tag in conflict with primary spec paths: /common: get: operationId: commonGet summary: here to test path collisons responses: '200': description: OK schema: $ref: "#/definitions/widget" /widgets: post: operationId: create summary: Create a new widget parameters: - name: info in: body schema: $ref: "#/definitions/widget" responses: '201': description: created schema: $ref: "#/definitions/widgetId" default: description: error schema: $ref: "#/definitions/error" /widgets/{widgetid}: get: operationId: get summary: Get a widget by id parameters: - $ref: "#/parameters/widgetid" responses: '200': description: OK schema: $ref: "#/definitions/widget" '401': $ref: "#/responses/401" '404': $ref: "#/responses/404" default: description: error schema: $ref: "#/definitions/error" delete: operationId: delete summary: delete a widget by id parameters: - name: widgetid in: path required: true type: string responses: '200': description: OK '401': description: unauthorized schema: $ref: "#/definitions/error" '404': description: resource not found schema: $ref: "#/definitions/error" default: description: error schema: $ref: "#/definitions/error" post: operationId: update summary: update a widget by id parameters: - name: widgetid in: path required: true type: string - name: info in: body schema: $ref: "#/definitions/widget" responses: '200': description: OK '401': description: unauthorized schema: $ref: "#/definitions/error" '404': description: resource not found schema: $ref: "#/definitions/error" default: description: error schema: $ref: "#/definitions/error" definitions: common: type: object required: - id properties: id: type: string format: string minLength: 1 widget: type: object required: - name - description properties: id: type: string format: string readOnly: true name: type: string format: string minLength: 1 description: type: string format: string minLength: 1 widgetId: type: object required: - id properties: id: type: string format: string minLength: 1 error: type: object required: - message properties: code: type: string format: string message: type: string fields: type: string parameters: common: name: common in: query type: string widgetid: name: widgetid in: path required: true type: string responses: 401: description: widget unauthorized schema: $ref: "#/definitions/error" 404: description: widget resource not found schema: $ref: "#/definitions/error" analysis-0.21.1/flatten.go000066400000000000000000000601201413705513100154010ustar00rootroot00000000000000// Copyright 2015 go-swagger maintainers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package analysis import ( "fmt" "log" "path" "sort" "strings" "github.com/go-openapi/analysis/internal/flatten/normalize" "github.com/go-openapi/analysis/internal/flatten/operations" "github.com/go-openapi/analysis/internal/flatten/replace" "github.com/go-openapi/analysis/internal/flatten/schutils" "github.com/go-openapi/analysis/internal/flatten/sortref" "github.com/go-openapi/jsonpointer" "github.com/go-openapi/spec" ) const definitionsPath = "#/definitions" // newRef stores information about refs created during the flattening process type newRef struct { key string newName string path string isOAIGen bool resolved bool schema *spec.Schema parents []string } // context stores intermediary results from flatten type context struct { newRefs map[string]*newRef warnings []string resolved map[string]string } func newContext() *context { return &context{ newRefs: make(map[string]*newRef, 150), warnings: make([]string, 0), resolved: make(map[string]string, 50), } } // Flatten an analyzed spec and produce a self-contained spec bundle. // // There is a minimal and a full flattening mode. // // // Minimally flattening a spec means: // - Expanding parameters, responses, path items, parameter items and header items (references to schemas are left // unscathed) // - Importing external (http, file) references so they become internal to the document // - Moving every JSON pointer to a $ref to a named definition (i.e. the reworked spec does not contain pointers // like "$ref": "#/definitions/myObject/allOfs/1") // // A minimally flattened spec thus guarantees the following properties: // - all $refs point to a local definition (i.e. '#/definitions/...') // - definitions are unique // // NOTE: arbitrary JSON pointers (other than $refs to top level definitions) are rewritten as definitions if they // represent a complex schema or express commonality in the spec. // Otherwise, they are simply expanded. // Self-referencing JSON pointers cannot resolve to a type and trigger an error. // // // Minimal flattening is necessary and sufficient for codegen rendering using go-swagger. // // Fully flattening a spec means: // - Moving every complex inline schema to be a definition with an auto-generated name in a depth-first fashion. // // By complex, we mean every JSON object with some properties. // Arrays, when they do not define a tuple, // or empty objects with or without additionalProperties, are not considered complex and remain inline. // // NOTE: rewritten schemas get a vendor extension x-go-gen-location so we know from which part of the spec definitions // have been created. // // Available flattening options: // - Minimal: stops flattening after minimal $ref processing, leaving schema constructs untouched // - Expand: expand all $ref's in the document (inoperant if Minimal set to true) // - Verbose: croaks about name conflicts detected // - RemoveUnused: removes unused parameters, responses and definitions after expansion/flattening // // NOTE: expansion removes all $ref save circular $ref, which remain in place // // TODO: additional options // - ProgagateNameExtensions: ensure that created entries properly follow naming rules when their parent have set a // x-go-name extension // - LiftAllOfs: // - limit the flattening of allOf members when simple objects // - merge allOf with validation only // - merge allOf with extensions only // - ... // func Flatten(opts FlattenOpts) error { debugLog("FlattenOpts: %#v", opts) opts.flattenContext = newContext() // 1. Recursively expand responses, parameters, path items and items in simple schemas. // // This simplifies the spec and leaves only the $ref's in schema objects. if err := expand(&opts); err != nil { return err } // 2. Strip the current document from absolute $ref's that actually a in the root, // so we can recognize them as proper definitions // // In particular, this works around issue go-openapi/spec#76: leading absolute file in $ref is stripped if err := normalizeRef(&opts); err != nil { return err } // 3. Optionally remove shared parameters and responses already expanded (now unused). // // Operation parameters (i.e. under paths) remain. if opts.RemoveUnused { removeUnusedShared(&opts) } // 4. Import all remote references. if err := importReferences(&opts); err != nil { return err } // 5. full flattening: rewrite inline schemas (schemas that aren't simple types or arrays or maps) if !opts.Minimal && !opts.Expand { if err := nameInlinedSchemas(&opts); err != nil { return err } } // 6. Rewrite JSON pointers other than $ref to named definitions // and attempt to resolve conflicting names whenever possible. if err := stripPointersAndOAIGen(&opts); err != nil { return err } // 7. Strip the spec from unused definitions if opts.RemoveUnused { removeUnused(&opts) } // 8. Issue warning notifications, if any opts.croak() // TODO: simplify known schema patterns to flat objects with properties // examples: // - lift simple allOf object, // - empty allOf with validation only or extensions only // - rework allOf arrays // - rework allOf additionalProperties return nil } func expand(opts *FlattenOpts) error { if err := spec.ExpandSpec(opts.Swagger(), opts.ExpandOpts(!opts.Expand)); err != nil { return err } opts.Spec.reload() // re-analyze return nil } // normalizeRef strips the current file from any absolute file $ref. This works around issue go-openapi/spec#76: // leading absolute file in $ref is stripped func normalizeRef(opts *FlattenOpts) error { debugLog("normalizeRef") altered := false for k, w := range opts.Spec.references.allRefs { if !strings.HasPrefix(w.String(), opts.BasePath+definitionsPath) { // may be a mix of / and \, depending on OS continue } altered = true debugLog("stripping absolute path for: %s", w.String()) // strip the base path from definition if err := replace.UpdateRef(opts.Swagger(), k, spec.MustCreateRef(path.Join(definitionsPath, path.Base(w.String())))); err != nil { return err } } if altered { opts.Spec.reload() // re-analyze } return nil } func removeUnusedShared(opts *FlattenOpts) { opts.Swagger().Parameters = nil opts.Swagger().Responses = nil opts.Spec.reload() // re-analyze } func importReferences(opts *FlattenOpts) error { var ( imported bool err error ) for !imported && err == nil { // iteratively import remote references until none left. // This inlining deals with name conflicts by introducing auto-generated names ("OAIGen") imported, err = importExternalReferences(opts) opts.Spec.reload() // re-analyze } return err } // nameInlinedSchemas replaces every complex inline construct by a named definition. func nameInlinedSchemas(opts *FlattenOpts) error { debugLog("nameInlinedSchemas") namer := &InlineSchemaNamer{ Spec: opts.Swagger(), Operations: operations.AllOpRefsByRef(opts.Spec, nil), flattenContext: opts.flattenContext, opts: opts, } depthFirst := sortref.DepthFirst(opts.Spec.allSchemas) for _, key := range depthFirst { sch := opts.Spec.allSchemas[key] if sch.Schema == nil || sch.Schema.Ref.String() != "" || sch.TopLevel { continue } asch, err := Schema(SchemaOpts{Schema: sch.Schema, Root: opts.Swagger(), BasePath: opts.BasePath}) if err != nil { return fmt.Errorf("schema analysis [%s]: %w", key, err) } if asch.isAnalyzedAsComplex() { // move complex schemas to definitions if err := namer.Name(key, sch.Schema, asch); err != nil { return err } } } opts.Spec.reload() // re-analyze return nil } func removeUnused(opts *FlattenOpts) { expected := make(map[string]struct{}) for k := range opts.Swagger().Definitions { expected[path.Join(definitionsPath, jsonpointer.Escape(k))] = struct{}{} } for _, k := range opts.Spec.AllDefinitionReferences() { delete(expected, k) } for k := range expected { debugLog("removing unused definition %s", path.Base(k)) if opts.Verbose { log.Printf("info: removing unused definition: %s", path.Base(k)) } delete(opts.Swagger().Definitions, path.Base(k)) } opts.Spec.reload() // re-analyze } func importKnownRef(entry sortref.RefRevIdx, refStr, newName string, opts *FlattenOpts) error { // rewrite ref with already resolved external ref (useful for cyclical refs): // rewrite external refs to local ones debugLog("resolving known ref [%s] to %s", refStr, newName) for _, key := range entry.Keys { if err := replace.UpdateRef(opts.Swagger(), key, spec.MustCreateRef(path.Join(definitionsPath, newName))); err != nil { return err } } return nil } func importNewRef(entry sortref.RefRevIdx, refStr string, opts *FlattenOpts) error { var ( isOAIGen bool newName string ) debugLog("resolving schema from remote $ref [%s]", refStr) sch, err := spec.ResolveRefWithBase(opts.Swagger(), &entry.Ref, opts.ExpandOpts(false)) if err != nil { return fmt.Errorf("could not resolve schema: %w", err) } // at this stage only $ref analysis matters partialAnalyzer := &Spec{ references: referenceAnalysis{}, patterns: patternAnalysis{}, enums: enumAnalysis{}, } partialAnalyzer.reset() partialAnalyzer.analyzeSchema("", sch, "/") // now rewrite those refs with rebase for key, ref := range partialAnalyzer.references.allRefs { if err := replace.UpdateRef(sch, key, spec.MustCreateRef(normalize.RebaseRef(entry.Ref.String(), ref.String()))); err != nil { return fmt.Errorf("failed to rewrite ref for key %q at %s: %w", key, entry.Ref.String(), err) } } // generate a unique name - isOAIGen means that a naming conflict was resolved by changing the name newName, isOAIGen = uniqifyName(opts.Swagger().Definitions, nameFromRef(entry.Ref)) debugLog("new name for [%s]: %s - with name conflict:%t", strings.Join(entry.Keys, ", "), newName, isOAIGen) opts.flattenContext.resolved[refStr] = newName // rewrite the external refs to local ones for _, key := range entry.Keys { if err := replace.UpdateRef(opts.Swagger(), key, spec.MustCreateRef(path.Join(definitionsPath, newName))); err != nil { return err } // keep track of created refs resolved := false if _, ok := opts.flattenContext.newRefs[key]; ok { resolved = opts.flattenContext.newRefs[key].resolved } debugLog("keeping track of ref: %s (%s), resolved: %t", key, newName, resolved) opts.flattenContext.newRefs[key] = &newRef{ key: key, newName: newName, path: path.Join(definitionsPath, newName), isOAIGen: isOAIGen, resolved: resolved, schema: sch, } } // add the resolved schema to the definitions schutils.Save(opts.Swagger(), newName, sch) return nil } // importExternalReferences iteratively digs remote references and imports them into the main schema. // // At every iteration, new remotes may be found when digging deeper: they are rebased to the current schema before being imported. // // This returns true when no more remote references can be found. func importExternalReferences(opts *FlattenOpts) (bool, error) { debugLog("importExternalReferences") groupedRefs := sortref.ReverseIndex(opts.Spec.references.schemas, opts.BasePath) sortedRefStr := make([]string, 0, len(groupedRefs)) if opts.flattenContext == nil { opts.flattenContext = newContext() } // sort $ref resolution to ensure deterministic name conflict resolution for refStr := range groupedRefs { sortedRefStr = append(sortedRefStr, refStr) } sort.Strings(sortedRefStr) complete := true for _, refStr := range sortedRefStr { entry := groupedRefs[refStr] if entry.Ref.HasFragmentOnly { continue } complete = false newName := opts.flattenContext.resolved[refStr] if newName != "" { if err := importKnownRef(entry, refStr, newName, opts); err != nil { return false, err } continue } // resolve schemas if err := importNewRef(entry, refStr, opts); err != nil { return false, err } } // maintains ref index entries for k := range opts.flattenContext.newRefs { r := opts.flattenContext.newRefs[k] // update tracking with resolved schemas if r.schema.Ref.String() != "" { ref := spec.MustCreateRef(r.path) sch, err := spec.ResolveRefWithBase(opts.Swagger(), &ref, opts.ExpandOpts(false)) if err != nil { return false, fmt.Errorf("could not resolve schema: %w", err) } r.schema = sch } if r.path == k { continue } // update tracking with renamed keys: got a cascade of refs renamed := *r renamed.key = r.path opts.flattenContext.newRefs[renamed.path] = &renamed // indirect ref r.newName = path.Base(k) r.schema = spec.RefSchema(r.path) r.path = k r.isOAIGen = strings.Contains(k, "OAIGen") } return complete, nil } // stripPointersAndOAIGen removes anonymous JSON pointers from spec and chain with name conflicts handler. // This loops until the spec has no such pointer and all name conflicts have been reduced as much as possible. func stripPointersAndOAIGen(opts *FlattenOpts) error { // name all JSON pointers to anonymous documents if err := namePointers(opts); err != nil { return err } // remove unnecessary OAIGen ref (created when flattening external refs creates name conflicts) hasIntroducedPointerOrInline, ers := stripOAIGen(opts) if ers != nil { return ers } // iterate as pointer or OAIGen resolution may introduce inline schemas or pointers for hasIntroducedPointerOrInline { if !opts.Minimal { opts.Spec.reload() // re-analyze if err := nameInlinedSchemas(opts); err != nil { return err } } if err := namePointers(opts); err != nil { return err } // restrip and re-analyze var err error if hasIntroducedPointerOrInline, err = stripOAIGen(opts); err != nil { return err } } return nil } // stripOAIGen strips the spec from unnecessary OAIGen constructs, initially created to dedupe flattened definitions. // // A dedupe is deemed unnecessary whenever: // - the only conflict is with its (single) parent: OAIGen is merged into its parent (reinlining) // - there is a conflict with multiple parents: merge OAIGen in first parent, the rewrite other parents to point to // the first parent. // // This function returns true whenever it re-inlined a complex schema, so the caller may chose to iterate // pointer and name resolution again. func stripOAIGen(opts *FlattenOpts) (bool, error) { debugLog("stripOAIGen") replacedWithComplex := false // figure out referers of OAIGen definitions (doing it before the ref start mutating) for _, r := range opts.flattenContext.newRefs { updateRefParents(opts.Spec.references.allRefs, r) } for k := range opts.flattenContext.newRefs { r := opts.flattenContext.newRefs[k] debugLog("newRefs[%s]: isOAIGen: %t, resolved: %t, name: %s, path:%s, #parents: %d, parents: %v, ref: %s", k, r.isOAIGen, r.resolved, r.newName, r.path, len(r.parents), r.parents, r.schema.Ref.String()) if !r.isOAIGen || len(r.parents) == 0 { continue } hasReplacedWithComplex, err := stripOAIGenForRef(opts, k, r) if err != nil { return replacedWithComplex, err } replacedWithComplex = replacedWithComplex || hasReplacedWithComplex } debugLog("replacedWithComplex: %t", replacedWithComplex) opts.Spec.reload() // re-analyze return replacedWithComplex, nil } // updateRefParents updates all parents of an updated $ref func updateRefParents(allRefs map[string]spec.Ref, r *newRef) { if !r.isOAIGen || r.resolved { // bail on already resolved entries (avoid looping) return } for k, v := range allRefs { if r.path != v.String() { continue } found := false for _, p := range r.parents { if p == k { found = true break } } if !found { r.parents = append(r.parents, k) } } } func stripOAIGenForRef(opts *FlattenOpts, k string, r *newRef) (bool, error) { replacedWithComplex := false pr := sortref.TopmostFirst(r.parents) // rewrite first parent schema in hierarchical then lexicographical order debugLog("rewrite first parent %s with schema", pr[0]) if err := replace.UpdateRefWithSchema(opts.Swagger(), pr[0], r.schema); err != nil { return false, err } if pa, ok := opts.flattenContext.newRefs[pr[0]]; ok && pa.isOAIGen { // update parent in ref index entry debugLog("update parent entry: %s", pr[0]) pa.schema = r.schema pa.resolved = false replacedWithComplex = true } // rewrite other parents to point to first parent if len(pr) > 1 { for _, p := range pr[1:] { replacingRef := spec.MustCreateRef(pr[0]) // set complex when replacing ref is an anonymous jsonpointer: further processing may be required replacedWithComplex = replacedWithComplex || path.Dir(replacingRef.String()) != definitionsPath debugLog("rewrite parent with ref: %s", replacingRef.String()) // NOTE: it is possible at this stage to introduce json pointers (to non-definitions places). // Those are stripped later on. if err := replace.UpdateRef(opts.Swagger(), p, replacingRef); err != nil { return false, err } if pa, ok := opts.flattenContext.newRefs[p]; ok && pa.isOAIGen { // update parent in ref index debugLog("update parent entry: %s", p) pa.schema = r.schema pa.resolved = false replacedWithComplex = true } } } // remove OAIGen definition debugLog("removing definition %s", path.Base(r.path)) delete(opts.Swagger().Definitions, path.Base(r.path)) // propagate changes in ref index for keys which have this one as a parent for kk, value := range opts.flattenContext.newRefs { if kk == k || !value.isOAIGen || value.resolved { continue } found := false newParents := make([]string, 0, len(value.parents)) for _, parent := range value.parents { switch { case parent == r.path: found = true parent = pr[0] case strings.HasPrefix(parent, r.path+"/"): found = true parent = path.Join(pr[0], strings.TrimPrefix(parent, r.path)) } newParents = append(newParents, parent) } if found { value.parents = newParents } } // mark naming conflict as resolved debugLog("marking naming conflict resolved for key: %s", r.key) opts.flattenContext.newRefs[r.key].isOAIGen = false opts.flattenContext.newRefs[r.key].resolved = true // determine if the previous substitution did inline a complex schema if r.schema != nil && r.schema.Ref.String() == "" { // inline schema asch, err := Schema(SchemaOpts{Schema: r.schema, Root: opts.Swagger(), BasePath: opts.BasePath}) if err != nil { return false, err } debugLog("re-inlined schema: parent: %s, %t", pr[0], asch.isAnalyzedAsComplex()) replacedWithComplex = replacedWithComplex || !(path.Dir(pr[0]) == definitionsPath) && asch.isAnalyzedAsComplex() } return replacedWithComplex, nil } // namePointers replaces all JSON pointers to anonymous documents by a $ref to a new named definitions. // // This is carried on depth-first. Pointers to $refs which are top level definitions are replaced by the $ref itself. // Pointers to simple types are expanded, unless they express commonality (i.e. several such $ref are used). func namePointers(opts *FlattenOpts) error { debugLog("name pointers") refsToReplace := make(map[string]SchemaRef, len(opts.Spec.references.schemas)) for k, ref := range opts.Spec.references.allRefs { if path.Dir(ref.String()) == definitionsPath { // this a ref to a top-level definition: ok continue } result, err := replace.DeepestRef(opts.Swagger(), opts.ExpandOpts(false), ref) if err != nil { return fmt.Errorf("at %s, %w", k, err) } replacingRef := result.Ref sch := result.Schema if opts.flattenContext != nil { opts.flattenContext.warnings = append(opts.flattenContext.warnings, result.Warnings...) } debugLog("planning pointer to replace at %s: %s, resolved to: %s", k, ref.String(), replacingRef.String()) refsToReplace[k] = SchemaRef{ Name: k, // caller Ref: replacingRef, // called Schema: sch, TopLevel: path.Dir(replacingRef.String()) == definitionsPath, } } depthFirst := sortref.DepthFirst(refsToReplace) namer := &InlineSchemaNamer{ Spec: opts.Swagger(), Operations: operations.AllOpRefsByRef(opts.Spec, nil), flattenContext: opts.flattenContext, opts: opts, } for _, key := range depthFirst { v := refsToReplace[key] // update current replacement, which may have been updated by previous changes of deeper elements result, erd := replace.DeepestRef(opts.Swagger(), opts.ExpandOpts(false), v.Ref) if erd != nil { return fmt.Errorf("at %s, %w", key, erd) } if opts.flattenContext != nil { opts.flattenContext.warnings = append(opts.flattenContext.warnings, result.Warnings...) } v.Ref = result.Ref v.Schema = result.Schema v.TopLevel = path.Dir(result.Ref.String()) == definitionsPath debugLog("replacing pointer at %s: resolved to: %s", key, v.Ref.String()) if v.TopLevel { debugLog("replace pointer %s by canonical definition: %s", key, v.Ref.String()) // if the schema is a $ref to a top level definition, just rewrite the pointer to this $ref if err := replace.UpdateRef(opts.Swagger(), key, v.Ref); err != nil { return err } continue } if err := flattenAnonPointer(key, v, refsToReplace, namer, opts); err != nil { return err } } opts.Spec.reload() // re-analyze return nil } func flattenAnonPointer(key string, v SchemaRef, refsToReplace map[string]SchemaRef, namer *InlineSchemaNamer, opts *FlattenOpts) error { // this is a JSON pointer to an anonymous document (internal or external): // create a definition for this schema when: // - it is a complex schema // - or it is pointed by more than one $ref (i.e. expresses commonality) // otherwise, expand the pointer (single reference to a simple type) // // The named definition for this follows the target's key, not the caller's debugLog("namePointers at %s for %s", key, v.Ref.String()) // qualify the expanded schema asch, ers := Schema(SchemaOpts{Schema: v.Schema, Root: opts.Swagger(), BasePath: opts.BasePath}) if ers != nil { return fmt.Errorf("schema analysis [%s]: %w", key, ers) } callers := make([]string, 0, 64) debugLog("looking for callers") an := New(opts.Swagger()) for k, w := range an.references.allRefs { r, err := replace.DeepestRef(opts.Swagger(), opts.ExpandOpts(false), w) if err != nil { return fmt.Errorf("at %s, %w", key, err) } if opts.flattenContext != nil { opts.flattenContext.warnings = append(opts.flattenContext.warnings, r.Warnings...) } if r.Ref.String() == v.Ref.String() { callers = append(callers, k) } } debugLog("callers for %s: %d", v.Ref.String(), len(callers)) if len(callers) == 0 { // has already been updated and resolved return nil } parts := sortref.KeyParts(v.Ref.String()) debugLog("number of callers for %s: %d", v.Ref.String(), len(callers)) // identifying edge case when the namer did nothing because we point to a non-schema object // no definition is created and we expand the $ref for all callers if (!asch.IsSimpleSchema || len(callers) > 1) && !parts.IsSharedParam() && !parts.IsSharedResponse() { debugLog("replace JSON pointer at [%s] by definition: %s", key, v.Ref.String()) if err := namer.Name(v.Ref.String(), v.Schema, asch); err != nil { return err } // regular case: we named the $ref as a definition, and we move all callers to this new $ref for _, caller := range callers { if caller == key { continue } // move $ref for next to resolve debugLog("identified caller of %s at [%s]", v.Ref.String(), caller) c := refsToReplace[caller] c.Ref = v.Ref refsToReplace[caller] = c } return nil } debugLog("expand JSON pointer for key=%s", key) if err := replace.UpdateRefWithSchema(opts.Swagger(), key, v.Schema); err != nil { return err } // NOTE: there is no other caller to update return nil } analysis-0.21.1/flatten_name.go000066400000000000000000000160411413705513100164040ustar00rootroot00000000000000package analysis import ( "fmt" "path" "sort" "strings" "github.com/go-openapi/analysis/internal/flatten/operations" "github.com/go-openapi/analysis/internal/flatten/replace" "github.com/go-openapi/analysis/internal/flatten/schutils" "github.com/go-openapi/analysis/internal/flatten/sortref" "github.com/go-openapi/spec" "github.com/go-openapi/swag" ) // InlineSchemaNamer finds a new name for an inlined type type InlineSchemaNamer struct { Spec *spec.Swagger Operations map[string]operations.OpRef flattenContext *context opts *FlattenOpts } // Name yields a new name for the inline schema func (isn *InlineSchemaNamer) Name(key string, schema *spec.Schema, aschema *AnalyzedSchema) error { debugLog("naming inlined schema at %s", key) parts := sortref.KeyParts(key) for _, name := range namesFromKey(parts, aschema, isn.Operations) { if name == "" { continue } // create unique name newName, isOAIGen := uniqifyName(isn.Spec.Definitions, swag.ToJSONName(name)) // clone schema sch := schutils.Clone(schema) // replace values on schema if err := replace.RewriteSchemaToRef(isn.Spec, key, spec.MustCreateRef(path.Join(definitionsPath, newName))); err != nil { return fmt.Errorf("error while creating definition %q from inline schema: %w", newName, err) } // rewrite any dependent $ref pointing to this place, // when not already pointing to a top-level definition. // // NOTE: this is important if such referers use arbitrary JSON pointers. an := New(isn.Spec) for k, v := range an.references.allRefs { r, erd := replace.DeepestRef(isn.opts.Swagger(), isn.opts.ExpandOpts(false), v) if erd != nil { return fmt.Errorf("at %s, %w", k, erd) } if isn.opts.flattenContext != nil { isn.opts.flattenContext.warnings = append(isn.opts.flattenContext.warnings, r.Warnings...) } if r.Ref.String() != key && (r.Ref.String() != path.Join(definitionsPath, newName) || path.Dir(v.String()) == definitionsPath) { continue } debugLog("found a $ref to a rewritten schema: %s points to %s", k, v.String()) // rewrite $ref to the new target if err := replace.UpdateRef(isn.Spec, k, spec.MustCreateRef(path.Join(definitionsPath, newName))); err != nil { return err } } // NOTE: this extension is currently not used by go-swagger (provided for information only) sch.AddExtension("x-go-gen-location", GenLocation(parts)) // save cloned schema to definitions schutils.Save(isn.Spec, newName, sch) // keep track of created refs if isn.flattenContext == nil { continue } debugLog("track created ref: key=%s, newName=%s, isOAIGen=%t", key, newName, isOAIGen) resolved := false if _, ok := isn.flattenContext.newRefs[key]; ok { resolved = isn.flattenContext.newRefs[key].resolved } isn.flattenContext.newRefs[key] = &newRef{ key: key, newName: newName, path: path.Join(definitionsPath, newName), isOAIGen: isOAIGen, resolved: resolved, schema: sch, } } return nil } // uniqifyName yields a unique name for a definition func uniqifyName(definitions spec.Definitions, name string) (string, bool) { isOAIGen := false if name == "" { name = "oaiGen" isOAIGen = true } if len(definitions) == 0 { return name, isOAIGen } unq := true for k := range definitions { if strings.EqualFold(k, name) { unq = false break } } if unq { return name, isOAIGen } name += "OAIGen" isOAIGen = true var idx int unique := name _, known := definitions[unique] for known { idx++ unique = fmt.Sprintf("%s%d", name, idx) _, known = definitions[unique] } return unique, isOAIGen } func namesFromKey(parts sortref.SplitKey, aschema *AnalyzedSchema, operations map[string]operations.OpRef) []string { var ( baseNames [][]string startIndex int ) if parts.IsOperation() { baseNames, startIndex = namesForOperation(parts, operations) } // definitions if parts.IsDefinition() { baseNames, startIndex = namesForDefinition(parts) } result := make([]string, 0, len(baseNames)) for _, segments := range baseNames { nm := parts.BuildName(segments, startIndex, partAdder(aschema)) if nm == "" { continue } result = append(result, nm) } sort.Strings(result) return result } func namesForParam(parts sortref.SplitKey, operations map[string]operations.OpRef) ([][]string, int) { var ( baseNames [][]string startIndex int ) piref := parts.PathItemRef() if piref.String() != "" && parts.IsOperationParam() { if op, ok := operations[piref.String()]; ok { startIndex = 5 baseNames = append(baseNames, []string{op.ID, "params", "body"}) } } else if parts.IsSharedOperationParam() { pref := parts.PathRef() for k, v := range operations { if strings.HasPrefix(k, pref.String()) { startIndex = 4 baseNames = append(baseNames, []string{v.ID, "params", "body"}) } } } return baseNames, startIndex } func namesForOperation(parts sortref.SplitKey, operations map[string]operations.OpRef) ([][]string, int) { var ( baseNames [][]string startIndex int ) // params if parts.IsOperationParam() || parts.IsSharedOperationParam() { baseNames, startIndex = namesForParam(parts, operations) } // responses if parts.IsOperationResponse() { piref := parts.PathItemRef() if piref.String() != "" { if op, ok := operations[piref.String()]; ok { startIndex = 6 baseNames = append(baseNames, []string{op.ID, parts.ResponseName(), "body"}) } } } return baseNames, startIndex } func namesForDefinition(parts sortref.SplitKey) ([][]string, int) { nm := parts.DefinitionName() if nm != "" { return [][]string{{parts.DefinitionName()}}, 2 } return [][]string{}, 0 } // partAdder knows how to interpret a schema when it comes to build a name from parts func partAdder(aschema *AnalyzedSchema) sortref.PartAdder { return func(part string) []string { segments := make([]string, 0, 2) if part == "items" || part == "additionalItems" { if aschema.IsTuple || aschema.IsTupleWithExtra { segments = append(segments, "tuple") } else { segments = append(segments, "items") } if part == "additionalItems" { segments = append(segments, part) } return segments } segments = append(segments, part) return segments } } func nameFromRef(ref spec.Ref) string { u := ref.GetURL() if u.Fragment != "" { return swag.ToJSONName(path.Base(u.Fragment)) } if u.Path != "" { bn := path.Base(u.Path) if bn != "" && bn != "/" { ext := path.Ext(bn) if ext != "" { return swag.ToJSONName(bn[:len(bn)-len(ext)]) } return swag.ToJSONName(bn) } } return swag.ToJSONName(strings.ReplaceAll(u.Host, ".", " ")) } // GenLocation indicates from which section of the specification (models or operations) a definition has been created. // // This is reflected in the output spec with a "x-go-gen-location" extension. At the moment, this is is provided // for information only. func GenLocation(parts sortref.SplitKey) string { switch { case parts.IsOperation(): return "operations" case parts.IsDefinition(): return "models" default: return "" } } analysis-0.21.1/flatten_name_test.go000066400000000000000000000374471413705513100174600ustar00rootroot00000000000000package analysis import ( "path/filepath" "strings" "testing" "github.com/go-openapi/analysis/internal/antest" "github.com/go-openapi/analysis/internal/flatten/operations" "github.com/go-openapi/analysis/internal/flatten/sortref" "github.com/go-openapi/jsonpointer" "github.com/go-openapi/spec" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestName_FromRef(t *testing.T) { t.Parallel() values := []struct{ Source, Expected string }{ {"#/definitions/errorModel", "errorModel"}, {"http://somewhere.com/definitions/errorModel", "errorModel"}, {"http://somewhere.com/definitions/errorModel.json", "errorModel"}, {"/definitions/errorModel", "errorModel"}, {"/definitions/errorModel.json", "errorModel"}, {"http://somewhere.com", "somewhereCom"}, {"#", ""}, } for _, v := range values { assert.Equal(t, v.Expected, nameFromRef(spec.MustCreateRef(v.Source))) } } func TestName_Definition(t *testing.T) { values := []struct { Source, Expected string Definitions spec.Definitions }{ {"#/definitions/errorModel", "errorModel", map[string]spec.Schema(nil)}, {"http://somewhere.com/definitions/errorModel", "errorModel", map[string]spec.Schema(nil)}, {"#/definitions/errorModel", "errorModel", map[string]spec.Schema{"apples": *spec.StringProperty()}}, {"#/definitions/errorModel", "errorModelOAIGen", map[string]spec.Schema{"errorModel": *spec.StringProperty()}}, {"#/definitions/errorModel", "errorModelOAIGen1", map[string]spec.Schema{"errorModel": *spec.StringProperty(), "errorModelOAIGen": *spec.StringProperty()}}, {"#", "oaiGen", nil}, } for _, v := range values { u, _ := uniqifyName(v.Definitions, nameFromRef(spec.MustCreateRef(v.Source))) assert.Equal(t, v.Expected, u) } } func TestName_SplitKey(t *testing.T) { type KeyFlag uint64 const ( isOperation KeyFlag = 1 << iota isDefinition isSharedOperationParam isOperationParam isOperationResponse isDefaultResponse isStatusCodeResponse ) values := []struct { Key string Flags KeyFlag PathItemRef spec.Ref PathRef spec.Ref Name string }{ { "#/paths/~1some~1where~1{id}/parameters/1/schema", isOperation | isSharedOperationParam, spec.Ref{}, spec.MustCreateRef("#/paths/~1some~1where~1{id}"), "", }, { "#/paths/~1some~1where~1{id}/get/parameters/2/schema", isOperation | isOperationParam, spec.MustCreateRef("#/paths/~1some~1where~1{id}/GET"), spec.MustCreateRef("#/paths/~1some~1where~1{id}"), "", }, { "#/paths/~1some~1where~1{id}/get/responses/default/schema", isOperation | isOperationResponse | isDefaultResponse, spec.MustCreateRef("#/paths/~1some~1where~1{id}/GET"), spec.MustCreateRef("#/paths/~1some~1where~1{id}"), "Default", }, { "#/paths/~1some~1where~1{id}/get/responses/200/schema", isOperation | isOperationResponse | isStatusCodeResponse, spec.MustCreateRef("#/paths/~1some~1where~1{id}/GET"), spec.MustCreateRef("#/paths/~1some~1where~1{id}"), "OK", }, { "#/definitions/namedAgain", isDefinition, spec.Ref{}, spec.Ref{}, "namedAgain", }, { "#/definitions/datedRecords/items/1", isDefinition, spec.Ref{}, spec.Ref{}, "datedRecords", }, { "#/definitions/datedRecords/items/1", isDefinition, spec.Ref{}, spec.Ref{}, "datedRecords", }, { "#/definitions/datedTaggedRecords/items/1", isDefinition, spec.Ref{}, spec.Ref{}, "datedTaggedRecords", }, { "#/definitions/datedTaggedRecords/additionalItems", isDefinition, spec.Ref{}, spec.Ref{}, "datedTaggedRecords", }, { "#/definitions/otherRecords/items", isDefinition, spec.Ref{}, spec.Ref{}, "otherRecords", }, { "#/definitions/tags/additionalProperties", isDefinition, spec.Ref{}, spec.Ref{}, "tags", }, { "#/definitions/namedThing/properties/name", isDefinition, spec.Ref{}, spec.Ref{}, "namedThing", }, } for i, v := range values { parts := sortref.KeyParts(v.Key) pref := parts.PathRef() piref := parts.PathItemRef() assert.Equal(t, v.PathRef.String(), pref.String(), "pathRef: %s at %d", v.Key, i) assert.Equal(t, v.PathItemRef.String(), piref.String(), "pathItemRef: %s at %d", v.Key, i) if v.Flags&isOperation != 0 { assert.True(t, parts.IsOperation(), "isOperation: %s at %d", v.Key, i) } else { assert.False(t, parts.IsOperation(), "isOperation: %s at %d", v.Key, i) } if v.Flags&isDefinition != 0 { assert.True(t, parts.IsDefinition(), "isDefinition: %s at %d", v.Key, i) assert.Equal(t, v.Name, parts.DefinitionName(), "definition name: %s at %d", v.Key, i) } else { assert.False(t, parts.IsDefinition(), "isDefinition: %s at %d", v.Key, i) if v.Name != "" { assert.Equal(t, v.Name, parts.ResponseName(), "response name: %s at %d", v.Key, i) } } if v.Flags&isOperationParam != 0 { assert.True(t, parts.IsOperationParam(), "isOperationParam: %s at %d", v.Key, i) } else { assert.False(t, parts.IsOperationParam(), "isOperationParam: %s at %d", v.Key, i) } if v.Flags&isSharedOperationParam != 0 { assert.True(t, parts.IsSharedOperationParam(), "isSharedOperationParam: %s at %d", v.Key, i) } else { assert.False(t, parts.IsSharedOperationParam(), "isSharedOperationParam: %s at %d", v.Key, i) } if v.Flags&isOperationResponse != 0 { assert.True(t, parts.IsOperationResponse(), "isOperationResponse: %s at %d", v.Key, i) } else { assert.False(t, parts.IsOperationResponse(), "isOperationResponse: %s at %d", v.Key, i) } if v.Flags&isDefaultResponse != 0 { assert.True(t, parts.IsDefaultResponse(), "isDefaultResponse: %s at %d", v.Key, i) } else { assert.False(t, parts.IsDefaultResponse(), "isDefaultResponse: %s at %d", v.Key, i) } if v.Flags&isStatusCodeResponse != 0 { assert.True(t, parts.IsStatusCodeResponse(), "isStatusCodeResponse: %s at %d", v.Key, i) } else { assert.False(t, parts.IsStatusCodeResponse(), "isStatusCodeResponse: %s at %d", v.Key, i) } } } func TestName_NamesFromKey(t *testing.T) { bp := filepath.Join("fixtures", "inline_schemas.yml") sp := antest.LoadOrFail(t, bp) values := []struct { Key string Names []string }{ {"#/paths/~1some~1where~1{id}/parameters/1/schema", []string{"GetSomeWhereID params body", "PostSomeWhereID params body"}}, {"#/paths/~1some~1where~1{id}/get/parameters/2/schema", []string{"GetSomeWhereID params body"}}, {"#/paths/~1some~1where~1{id}/get/responses/default/schema", []string{"GetSomeWhereID Default body"}}, {"#/paths/~1some~1where~1{id}/get/responses/200/schema", []string{"GetSomeWhereID OK body"}}, {"#/definitions/namedAgain", []string{"namedAgain"}}, {"#/definitions/datedTag/allOf/1", []string{"datedTag allOf 1"}}, {"#/definitions/datedRecords/items/1", []string{"datedRecords tuple 1"}}, {"#/definitions/datedTaggedRecords/items/1", []string{"datedTaggedRecords tuple 1"}}, {"#/definitions/datedTaggedRecords/additionalItems", []string{"datedTaggedRecords tuple additionalItems"}}, {"#/definitions/otherRecords/items", []string{"otherRecords items"}}, {"#/definitions/tags/additionalProperties", []string{"tags additionalProperties"}}, {"#/definitions/namedThing/properties/name", []string{"namedThing name"}}, } for i, v := range values { ptr, err := jsonpointer.New(definitionPtr(v.Key)[1:]) require.NoError(t, err) vv, _, err := ptr.Get(sp) require.NoError(t, err) switch tv := vv.(type) { case *spec.Schema: aschema, err := Schema(SchemaOpts{Schema: tv, Root: sp, BasePath: bp}) if assert.NoError(t, err) { names := namesFromKey(sortref.KeyParts(v.Key), aschema, operations.AllOpRefsByRef(New(sp), nil)) assert.Equal(t, v.Names, names, "for %s at %d", v.Key, i) } case spec.Schema: aschema, err := Schema(SchemaOpts{Schema: &tv, Root: sp, BasePath: bp}) if assert.NoError(t, err) { names := namesFromKey(sortref.KeyParts(v.Key), aschema, operations.AllOpRefsByRef(New(sp), nil)) assert.Equal(t, v.Names, names, "for %s at %d", v.Key, i) } default: assert.Fail(t, "unknown type", "got %T", vv) } } } func TestName_BuildNameWithReservedKeyWord(t *testing.T) { s := sortref.SplitKey([]string{"definitions", "fullview", "properties", "properties"}) startIdx := 2 segments := []string{"fullview"} newName := s.BuildName(segments, startIdx, partAdder(nil)) assert.Equal(t, "fullview properties", newName) s = sortref.SplitKey([]string{"definitions", "fullview", "properties", "properties", "properties", "properties", "properties", "properties"}) newName = s.BuildName(segments, startIdx, partAdder(nil)) assert.Equal(t, "fullview properties properties properties", newName) } func TestName_InlinedSchemas(t *testing.T) { values := []struct { Key string Location string Ref spec.Ref }{ {"#/paths/~1some~1where~1{id}/get/parameters/2/schema/properties/record/items/2/properties/name", "#/definitions/getSomeWhereIdParamsBodyRecordItems2/properties/name", spec.MustCreateRef("#/definitions/getSomeWhereIdParamsBodyRecordItems2Name"), }, {"#/paths/~1some~1where~1{id}/get/parameters/2/schema/properties/record/items/1", "#/definitions/getSomeWhereIdParamsBodyRecord/items/1", spec.MustCreateRef("#/definitions/getSomeWhereIdParamsBodyRecordItems1"), }, {"#/paths/~1some~1where~1{id}/get/parameters/2/schema/properties/record/items/2", "#/definitions/getSomeWhereIdParamsBodyRecord/items/2", spec.MustCreateRef("#/definitions/getSomeWhereIdParamsBodyRecordItems2"), }, {"#/paths/~1some~1where~1{id}/get/responses/200/schema/properties/record/items/2/properties/name", "#/definitions/getSomeWhereIdOKBodyRecordItems2/properties/name", spec.MustCreateRef("#/definitions/getSomeWhereIdOKBodyRecordItems2Name"), }, {"#/paths/~1some~1where~1{id}/get/responses/200/schema/properties/record/items/1", "#/definitions/getSomeWhereIdOKBodyRecord/items/1", spec.MustCreateRef("#/definitions/getSomeWhereIdOKBodyRecordItems1"), }, {"#/paths/~1some~1where~1{id}/get/responses/200/schema/properties/record/items/2", "#/definitions/getSomeWhereIdOKBodyRecord/items/2", spec.MustCreateRef("#/definitions/getSomeWhereIdOKBodyRecordItems2"), }, {"#/paths/~1some~1where~1{id}/get/responses/200/schema/properties/record", "#/definitions/getSomeWhereIdOKBody/properties/record", spec.MustCreateRef("#/definitions/getSomeWhereIdOKBodyRecord"), }, {"#/paths/~1some~1where~1{id}/get/responses/200/schema", "#/paths/~1some~1where~1{id}/get/responses/200/schema", spec.MustCreateRef("#/definitions/getSomeWhereIdOKBody"), }, {"#/paths/~1some~1where~1{id}/get/responses/default/schema/properties/record/items/2/properties/name", "#/definitions/getSomeWhereIdDefaultBodyRecordItems2/properties/name", spec.MustCreateRef("#/definitions/getSomeWhereIdDefaultBodyRecordItems2Name"), }, {"#/paths/~1some~1where~1{id}/get/responses/default/schema/properties/record/items/1", "#/definitions/getSomeWhereIdDefaultBodyRecord/items/1", spec.MustCreateRef("#/definitions/getSomeWhereIdDefaultBodyRecordItems1"), }, {"#/paths/~1some~1where~1{id}/get/responses/default/schema/properties/record/items/2", "#/definitions/getSomeWhereIdDefaultBodyRecord/items/2", spec.MustCreateRef("#/definitions/getSomeWhereIdDefaultBodyRecordItems2"), }, {"#/paths/~1some~1where~1{id}/get/responses/default/schema/properties/record", "#/definitions/getSomeWhereIdDefaultBody/properties/record", spec.MustCreateRef("#/definitions/getSomeWhereIdDefaultBodyRecord"), }, {"#/paths/~1some~1where~1{id}/get/responses/default/schema", "#/paths/~1some~1where~1{id}/get/responses/default/schema", spec.MustCreateRef("#/definitions/getSomeWhereIdDefaultBody"), }, // maps: // {"#/definitions/nestedThing/properties/record/items/2/allOf/1/additionalProperties", // "#/definitions/nestedThingRecordItems2AllOf1/additionalProperties", // spec.MustCreateRef("#/definitions/nestedThingRecordItems2AllOf1AdditionalProperties"), // }, // {"#/definitions/nestedThing/properties/record/items/2/allOf/1", // "#/definitions/nestedThingRecordItems2/allOf/1", // spec.MustCreateRef("#/definitions/nestedThingRecordItems2AllOf1"), // }, {"#/definitions/nestedThing/properties/record/items/2/properties/name", "#/definitions/nestedThingRecordItems2/properties/name", spec.MustCreateRef("#/definitions/nestedThingRecordItems2Name"), }, {"#/definitions/nestedThing/properties/record/items/1", "#/definitions/nestedThingRecord/items/1", spec.MustCreateRef("#/definitions/nestedThingRecordItems1"), }, {"#/definitions/nestedThing/properties/record/items/2", "#/definitions/nestedThingRecord/items/2", spec.MustCreateRef("#/definitions/nestedThingRecordItems2"), }, {"#/definitions/datedRecords/items/1", "#/definitions/datedRecords/items/1", spec.MustCreateRef("#/definitions/datedRecordsItems1"), }, {"#/definitions/datedTaggedRecords/items/1", "#/definitions/datedTaggedRecords/items/1", spec.MustCreateRef("#/definitions/datedTaggedRecordsItems1"), }, {"#/definitions/namedThing/properties/name", "#/definitions/namedThing/properties/name", spec.MustCreateRef("#/definitions/namedThingName"), }, {"#/definitions/nestedThing/properties/record", "#/definitions/nestedThing/properties/record", spec.MustCreateRef("#/definitions/nestedThingRecord"), }, {"#/definitions/records/items/0", "#/definitions/records/items/0", spec.MustCreateRef("#/definitions/recordsItems0"), }, {"#/definitions/datedTaggedRecords/additionalItems", "#/definitions/datedTaggedRecords/additionalItems", spec.MustCreateRef("#/definitions/datedTaggedRecordsItemsAdditionalItems"), }, {"#/definitions/otherRecords/items", "#/definitions/otherRecords/items", spec.MustCreateRef("#/definitions/otherRecordsItems"), }, {"#/definitions/tags/additionalProperties", "#/definitions/tags/additionalProperties", spec.MustCreateRef("#/definitions/tagsAdditionalProperties"), }, } bp := filepath.Join("fixtures", "nested_inline_schemas.yml") sp := antest.LoadOrFail(t, bp) require.NoError(t, spec.ExpandSpec(sp, &spec.ExpandOptions{ RelativeBase: bp, SkipSchemas: true, })) require.NoError(t, nameInlinedSchemas(&FlattenOpts{ Spec: New(sp), BasePath: bp, })) for i, v := range values { ptr, err := jsonpointer.New(v.Location[1:]) require.NoErrorf(t, err, "at %d for %s", i, v.Key) vv, _, err := ptr.Get(sp) require.NoErrorf(t, err, "at %d for %s", i, v.Key) switch tv := vv.(type) { case *spec.Schema: assert.Equal(t, v.Ref.String(), tv.Ref.String(), "at %d for %s", i, v.Key) case spec.Schema: assert.Equal(t, v.Ref.String(), tv.Ref.String(), "at %d for %s", i, v.Key) case *spec.SchemaOrBool: var sRef spec.Ref if tv != nil && tv.Schema != nil { sRef = tv.Schema.Ref } assert.Equal(t, v.Ref.String(), sRef.String(), "at %d for %s", i, v.Key) case *spec.SchemaOrArray: var sRef spec.Ref if tv != nil && tv.Schema != nil { sRef = tv.Schema.Ref } assert.Equal(t, v.Ref.String(), sRef.String(), "at %d for %s", i, v.Key) default: assert.Fail(t, "unknown type", "got %T", vv) } } for k, rr := range New(sp).allSchemas { if strings.HasPrefix(k, "#/responses") || strings.HasPrefix(k, "#/parameters") { continue } if rr.Schema == nil || rr.Schema.Ref.String() != "" || rr.TopLevel { continue } asch, err := Schema(SchemaOpts{Schema: rr.Schema, Root: sp, BasePath: bp}) require.NoErrorf(t, err, "for key: %s", k) if !asch.IsSimpleSchema && !asch.IsArray && !asch.IsMap { assert.Fail(t, "not a top level schema", "for key: %s", k) } } } func TestFlattenSchema_UnitGuards(t *testing.T) { t.Parallel() parts := sortref.KeyParts("#/nowhere/arbitrary/pointer") res := GenLocation(parts) assert.Equal(t, "", res) } func definitionPtr(key string) string { if !strings.HasPrefix(key, "#/definitions") { return key } return strings.Join(strings.Split(key, "/")[:3], "/") } analysis-0.21.1/flatten_options.go000066400000000000000000000050061413705513100171560ustar00rootroot00000000000000package analysis import ( "log" "github.com/go-openapi/spec" ) // FlattenOpts configuration for flattening a swagger specification. // // The BasePath parameter is used to locate remote relative $ref found in the specification. // This path is a file: it points to the location of the root document and may be either a local // file path or a URL. // // If none specified, relative references (e.g. "$ref": "folder/schema.yaml#/definitions/...") // found in the spec are searched from the current working directory. type FlattenOpts struct { Spec *Spec // The analyzed spec to work with flattenContext *context // Internal context to track flattening activity BasePath string // The location of the root document for this spec to resolve relative $ref // Flattening options Expand bool // When true, skip flattening the spec and expand it instead (if Minimal is false) Minimal bool // When true, do not decompose complex structures such as allOf Verbose bool // enable some reporting on possible name conflicts detected RemoveUnused bool // When true, remove unused parameters, responses and definitions after expansion/flattening ContinueOnError bool // Continue when spec expansion issues are found /* Extra keys */ _ struct{} // require keys } // ExpandOpts creates a spec.ExpandOptions to configure expanding a specification document. func (f *FlattenOpts) ExpandOpts(skipSchemas bool) *spec.ExpandOptions { return &spec.ExpandOptions{ RelativeBase: f.BasePath, SkipSchemas: skipSchemas, ContinueOnError: f.ContinueOnError, } } // Swagger gets the swagger specification for this flatten operation func (f *FlattenOpts) Swagger() *spec.Swagger { return f.Spec.spec } // croak logs notifications and warnings about valid, but possibly unwanted constructs resulting // from flattening a spec func (f *FlattenOpts) croak() { if !f.Verbose { return } reported := make(map[string]bool, len(f.flattenContext.newRefs)) for _, v := range f.Spec.references.allRefs { // warns about duplicate handling for _, r := range f.flattenContext.newRefs { if r.isOAIGen && r.path == v.String() { reported[r.newName] = true } } } for k := range reported { log.Printf("warning: duplicate flattened definition name resolved as %s", k) } // warns about possible type mismatches uniqueMsg := make(map[string]bool) for _, msg := range f.flattenContext.warnings { if _, ok := uniqueMsg[msg]; ok { continue } log.Printf("warning: %s", msg) uniqueMsg[msg] = true } } analysis-0.21.1/flatten_test.go000066400000000000000000001240171413705513100164460ustar00rootroot00000000000000// Copyright 2015 go-swagger maintainers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package analysis import ( "bytes" "encoding/json" "fmt" "io/ioutil" "log" "os" "path" "path/filepath" "regexp" "strings" "testing" "github.com/go-openapi/analysis/internal/antest" "github.com/go-openapi/analysis/internal/flatten/operations" "github.com/go-openapi/jsonpointer" "github.com/go-openapi/spec" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) var ( rex = regexp.MustCompile(`"\$ref":\s*"(.+)"`) oairex = regexp.MustCompile(`oiagen`) ) type refFixture struct { Key string Ref spec.Ref Location string Expected interface{} } func makeRefFixtures() []refFixture { return []refFixture{ {Key: "#/parameters/someParam/schema", Ref: spec.MustCreateRef("#/definitions/record")}, {Key: "#/paths/~1some~1where~1{id}/parameters/1/schema", Ref: spec.MustCreateRef("#/definitions/record")}, {Key: "#/paths/~1some~1where~1{id}/get/parameters/2/schema", Ref: spec.MustCreateRef("#/definitions/record")}, {Key: "#/responses/someResponse/schema", Ref: spec.MustCreateRef("#/definitions/record")}, {Key: "#/paths/~1some~1where~1{id}/get/responses/default/schema", Ref: spec.MustCreateRef("#/definitions/record")}, {Key: "#/paths/~1some~1where~1{id}/get/responses/200/schema", Ref: spec.MustCreateRef("#/definitions/tag")}, {Key: "#/definitions/namedAgain", Ref: spec.MustCreateRef("#/definitions/named")}, {Key: "#/definitions/datedTag/allOf/1", Ref: spec.MustCreateRef("#/definitions/tag")}, {Key: "#/definitions/datedRecords/items/1", Ref: spec.MustCreateRef("#/definitions/record")}, {Key: "#/definitions/datedTaggedRecords/items/1", Ref: spec.MustCreateRef("#/definitions/record")}, {Key: "#/definitions/datedTaggedRecords/additionalItems", Ref: spec.MustCreateRef("#/definitions/tag")}, {Key: "#/definitions/otherRecords/items", Ref: spec.MustCreateRef("#/definitions/record")}, {Key: "#/definitions/tags/additionalProperties", Ref: spec.MustCreateRef("#/definitions/tag")}, {Key: "#/definitions/namedThing/properties/name", Ref: spec.MustCreateRef("#/definitions/named")}, } } func TestFlatten_ImportExternalReferences(t *testing.T) { log.SetOutput(ioutil.Discard) defer log.SetOutput(os.Stdout) // this fixture is the same as external_definitions.yml, but no more // checks if invalid construct is supported (i.e. $ref in parameters items) bp := filepath.Join(".", "fixtures", "external_definitions_valid.yml") sp := antest.LoadOrFail(t, bp) opts := &FlattenOpts{ Spec: New(sp), BasePath: bp, } // NOTE(fredbi): now we no more expand, but merely resolve and iterate until there is no more ext ref // so calling importExternalReferences is not idempotent _, erx := importExternalReferences(opts) require.NoError(t, erx) require.Len(t, sp.Definitions, 11) require.Contains(t, sp.Definitions, "tag") require.Contains(t, sp.Definitions, "named") require.Contains(t, sp.Definitions, "record") for idx, toPin := range makeRefFixtures() { i := idx v := toPin sp := sp // the pointer passed to Get(node) must be pinned t.Run(fmt.Sprintf("import check ref [%d]: %q", i, v.Key), func(t *testing.T) { t.Parallel() ptr, err := jsonpointer.New(v.Key[1:]) require.NoErrorf(t, err, "error on jsonpointer.New(%q)", v.Key[1:]) vv, _, err := ptr.Get(sp) require.NoErrorf(t, err, "error on ptr.Get(p for key=%s)", v.Key[1:]) switch tv := vv.(type) { case *spec.Schema: require.Equal(t, v.Ref.String(), tv.Ref.String(), "for %s", v.Key) case spec.Schema: require.Equal(t, v.Ref.String(), tv.Ref.String(), "for %s", v.Key) case *spec.SchemaOrBool: require.Equal(t, v.Ref.String(), tv.Schema.Ref.String(), "for %s", v.Key) case *spec.SchemaOrArray: require.Equal(t, v.Ref.String(), tv.Schema.Ref.String(), "for %s", v.Key) default: require.Fail(t, "unknown type", "got %T", vv) } }) } // check the complete result for clarity jazon := antest.AsJSON(t, sp) expected, err := ioutil.ReadFile(filepath.Join("fixtures", "expected", "external-references-1.json")) require.NoError(t, err) assert.JSONEq(t, string(expected), jazon) // iterate again: this time all external schema $ref's should be reinlined opts.Spec.reload() _, err = importExternalReferences(&FlattenOpts{ Spec: New(sp), BasePath: bp, }) require.NoError(t, err) opts.Spec.reload() for _, ref := range opts.Spec.references.schemas { require.True(t, ref.HasFragmentOnly) } // now try complete flatten sp = antest.LoadOrFail(t, bp) an := New(sp) require.NoError(t, Flatten(FlattenOpts{Spec: an, BasePath: bp, Verbose: true, Minimal: true, RemoveUnused: true})) jazon = antest.AsJSON(t, an.spec) expected, err = ioutil.ReadFile(filepath.Join("fixtures", "expected", "external-references-2.json")) require.NoError(t, err) assert.JSONEq(t, string(expected), jazon) } func makeFlattenFixtures() []refFixture { return []refFixture{ { Key: "#/responses/notFound/schema", Location: "#/responses/notFound/schema", Ref: spec.MustCreateRef("#/definitions/error"), Expected: nil, }, { Key: "#/paths/~1some~1where~1{id}/parameters/0", Location: "#/paths/~1some~1where~1{id}/parameters/0/name", Ref: spec.Ref{}, Expected: "id", }, { Key: "#/paths/~1other~1place", Location: "#/paths/~1other~1place/get/operationId", Ref: spec.Ref{}, Expected: "modelOp", }, { Key: "#/paths/~1some~1where~1{id}/get/parameters/0", Location: "#/paths/~1some~1where~1{id}/get/parameters/0/name", Ref: spec.Ref{}, Expected: "limit", }, { Key: "#/paths/~1some~1where~1{id}/get/parameters/1", Location: "#/paths/~1some~1where~1{id}/get/parameters/1/name", Ref: spec.Ref{}, Expected: "some", }, { Key: "#/paths/~1some~1where~1{id}/get/parameters/2", Location: "#/paths/~1some~1where~1{id}/get/parameters/2/name", Ref: spec.Ref{}, Expected: "other", }, { Key: "#/paths/~1some~1where~1{id}/get/parameters/3", Location: "#/paths/~1some~1where~1{id}/get/parameters/3/schema", Ref: spec.MustCreateRef("#/definitions/getSomeWhereIdParamsBody"), Expected: "", }, { Key: "#/paths/~1some~1where~1{id}/get/responses/200", Location: "#/paths/~1some~1where~1{id}/get/responses/200/schema", Ref: spec.MustCreateRef("#/definitions/getSomeWhereIdOKBody"), Expected: "", }, { Key: "#/definitions/namedAgain", Location: "", Ref: spec.MustCreateRef("#/definitions/named"), Expected: "", }, { Key: "#/definitions/namedThing/properties/name", Location: "", Ref: spec.MustCreateRef("#/definitions/named"), Expected: "", }, { Key: "#/definitions/namedThing/properties/namedAgain", Location: "", Ref: spec.MustCreateRef("#/definitions/namedAgain"), Expected: "", }, { Key: "#/definitions/datedRecords/items/1", Location: "", Ref: spec.MustCreateRef("#/definitions/record"), Expected: "", }, { Key: "#/definitions/otherRecords/items", Location: "", Ref: spec.MustCreateRef("#/definitions/record"), Expected: "", }, { Key: "#/definitions/tags/additionalProperties", Location: "", Ref: spec.MustCreateRef("#/definitions/tag"), Expected: "", }, { Key: "#/definitions/datedTag/allOf/1", Location: "", Ref: spec.MustCreateRef("#/definitions/tag"), Expected: "", }, { Key: "#/definitions/nestedThingRecord/items/1", Location: "", Ref: spec.MustCreateRef("#/definitions/nestedThingRecordItems1"), Expected: "", }, { Key: "#/definitions/nestedThingRecord/items/2", Location: "", Ref: spec.MustCreateRef("#/definitions/nestedThingRecordItems2"), Expected: "", }, { Key: "#/definitions/nestedThing/properties/record", Location: "", Ref: spec.MustCreateRef("#/definitions/nestedThingRecord"), Expected: "", }, { Key: "#/definitions/named", Location: "#/definitions/named/type", Ref: spec.Ref{}, Expected: spec.StringOrArray{"string"}, }, { Key: "#/definitions/error", Location: "#/definitions/error/properties/id/type", Ref: spec.Ref{}, Expected: spec.StringOrArray{"integer"}, }, { Key: "#/definitions/record", Location: "#/definitions/record/properties/createdAt/format", Ref: spec.Ref{}, Expected: "date-time", }, { Key: "#/definitions/getSomeWhereIdOKBody", Location: "#/definitions/getSomeWhereIdOKBody/properties/record", Ref: spec.MustCreateRef("#/definitions/nestedThing"), Expected: nil, }, { Key: "#/definitions/getSomeWhereIdParamsBody", Location: "#/definitions/getSomeWhereIdParamsBody/properties/record", Ref: spec.MustCreateRef("#/definitions/getSomeWhereIdParamsBodyRecord"), Expected: nil, }, { Key: "#/definitions/getSomeWhereIdParamsBodyRecord", Location: "#/definitions/getSomeWhereIdParamsBodyRecord/items/1", Ref: spec.MustCreateRef("#/definitions/getSomeWhereIdParamsBodyRecordItems1"), Expected: nil, }, { Key: "#/definitions/getSomeWhereIdParamsBodyRecord", Location: "#/definitions/getSomeWhereIdParamsBodyRecord/items/2", Ref: spec.MustCreateRef("#/definitions/getSomeWhereIdParamsBodyRecordItems2"), Expected: nil, }, { Key: "#/definitions/getSomeWhereIdParamsBodyRecordItems2", Location: "#/definitions/getSomeWhereIdParamsBodyRecordItems2/allOf/0/format", Ref: spec.Ref{}, Expected: "date", }, { Key: "#/definitions/getSomeWhereIdParamsBodyRecordItems2Name", Location: "#/definitions/getSomeWhereIdParamsBodyRecordItems2Name/properties/createdAt/format", Ref: spec.Ref{}, Expected: "date-time", }, { Key: "#/definitions/getSomeWhereIdParamsBodyRecordItems2", Location: "#/definitions/getSomeWhereIdParamsBodyRecordItems2/properties/name", Ref: spec.MustCreateRef("#/definitions/getSomeWhereIdParamsBodyRecordItems2Name"), Expected: "date", }, } } func TestFlatten_CheckRef(t *testing.T) { bp := filepath.Join("fixtures", "flatten.yml") sp := antest.LoadOrFail(t, bp) require.NoError(t, Flatten(FlattenOpts{Spec: New(sp), BasePath: bp})) for idx, toPin := range makeFlattenFixtures() { i := idx v := toPin sp := sp t.Run(fmt.Sprintf("check ref after flatten %q", v.Key), func(t *testing.T) { pk := v.Key[1:] if v.Location != "" { pk = v.Location[1:] } ptr, err := jsonpointer.New(pk) require.NoError(t, err, "at %d for %s", i, v.Key) d, _, err := ptr.Get(sp) require.NoError(t, err) if v.Ref.String() == "" { assert.Equal(t, v.Expected, d) return } switch s := d.(type) { case *spec.Schema: assert.Equal(t, v.Ref.String(), s.Ref.String(), "at %d for %s", i, v.Key) case spec.Schema: assert.Equal(t, v.Ref.String(), s.Ref.String(), "at %d for %s", i, v.Key) case *spec.SchemaOrArray: var sRef spec.Ref if s != nil && s.Schema != nil { sRef = s.Schema.Ref } assert.Equal(t, v.Ref.String(), sRef.String(), "at %d for %s", i, v.Key) case *spec.SchemaOrBool: var sRef spec.Ref if s != nil && s.Schema != nil { sRef = s.Schema.Ref } assert.Equal(t, v.Ref.String(), sRef.String(), "at %d for %s", i, v.Key) default: assert.Fail(t, "unknown type", "got %T at %d for %s", d, i, v.Key) } }) } } func TestFlatten_FullWithOAIGen(t *testing.T) { bp := filepath.Join("fixtures", "oaigen", "fixture-oaigen.yaml") sp := antest.LoadOrFail(t, bp) require.NoError(t, Flatten(FlattenOpts{ Spec: New(sp), BasePath: bp, Verbose: true, Minimal: false, RemoveUnused: false, })) res := getInPath(t, sp, "/some/where", "/get/responses/204/schema") assert.JSONEqf(t, `{"$ref": "#/definitions/uniqueName1"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/post/responses/204/schema") assert.JSONEqf(t, `{"$ref": "#/definitions/d"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/get/responses/206/schema") assert.JSONEqf(t, `{"$ref": "#/definitions/a"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/get/responses/304/schema") assert.JSONEqf(t, `{"$ref": "#/definitions/transitive11"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/get/responses/205/schema") assert.JSONEqf(t, `{"$ref": "#/definitions/b"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/post/responses/200/schema") assert.JSONEqf(t, `{"type": "integer"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/post/responses/default/schema") // pointer expanded assert.JSONEqf(t, `{"type": "integer"}`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "a") assert.JSONEqf(t, `{"type": "object", "properties": { "a": { "$ref": "#/definitions/aAOAIGen" }}}`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "aA") assert.JSONEqf(t, `{"type": "string", "format": "date"}`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "aAOAIGen") assert.JSONEqf(t, ` { "type": "object", "properties": { "b": { "type": "integer" } }, "x-go-gen-location": "models" } `, res, "Expected a simple schema for response") res = getDefinition(t, sp, "bB") assert.JSONEqf(t, `{"type": "string", "format": "date-time"}`, res, "Expected a simple schema for response") _, ok := sp.Definitions["bItems"] assert.Falsef(t, ok, "Did not expect a definition for %s", "bItems") res = getDefinition(t, sp, "d") assert.JSONEqf(t, ` { "type": "object", "properties": { "c": { "type": "integer" } } } `, res, "Expected a simple schema for response") res = getDefinition(t, sp, "b") assert.JSONEqf(t, ` { "type": "array", "items": { "$ref": "#/definitions/d" } } `, res, "Expected a ref in response") res = getDefinition(t, sp, "myBody") assert.JSONEqf(t, ` { "type": "object", "properties": { "aA": { "$ref": "#/definitions/aA" }, "prop1": { "type": "integer" } } } `, res, "Expected a simple schema for response") res = getDefinition(t, sp, "uniqueName2") assert.JSONEqf(t, `{"$ref": "#/definitions/notUniqueName2"}`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "notUniqueName2") assert.JSONEqf(t, ` { "type": "object", "properties": { "prop6": { "type": "integer" } } } `, res, "Expected a simple schema for response") res = getDefinition(t, sp, "uniqueName1") assert.JSONEqf(t, `{ "type": "object", "properties": { "prop5": { "type": "integer" }}}`, res, "Expected a simple schema for response") // allOf container: []spec.Schema res = getDefinition(t, sp, "getWithSliceContainerDefaultBody") assert.JSONEqf(t, `{ "allOf": [ { "$ref": "#/definitions/uniqueName3" }, { "$ref": "#/definitions/getWithSliceContainerDefaultBodyAllOf1" } ], "x-go-gen-location": "operations" }`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "getWithSliceContainerDefaultBodyAllOf1") assert.JSONEqf(t, `{ "type": "object", "properties": { "prop8": { "type": "string" } }, "x-go-gen-location": "models" }`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "getWithTupleContainerDefaultBody") assert.JSONEqf(t, `{ "type": "array", "items": [ { "$ref": "#/definitions/uniqueName3" }, { "$ref": "#/definitions/getWithSliceContainerDefaultBodyAllOf1" } ], "x-go-gen-location": "operations" }`, res, "Expected a simple schema for response") // with container SchemaOrArray res = getDefinition(t, sp, "getWithTupleConflictDefaultBody") assert.JSONEqf(t, `{ "type": "array", "items": [ { "$ref": "#/definitions/uniqueName4" }, { "$ref": "#/definitions/getWithTupleConflictDefaultBodyItems1" } ], "x-go-gen-location": "operations" }`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "getWithTupleConflictDefaultBodyItems1") assert.JSONEqf(t, `{ "type": "object", "properties": { "prop10": { "type": "string" } }, "x-go-gen-location": "models" }`, res, "Expected a simple schema for response") } func TestFlatten_MinimalWithOAIGen(t *testing.T) { var sp *spec.Swagger defer func() { if t.Failed() && sp != nil { t.Log(antest.AsJSON(t, sp)) } }() bp := filepath.Join("fixtures", "oaigen", "fixture-oaigen.yaml") sp = antest.LoadOrFail(t, bp) var logCapture bytes.Buffer log.SetOutput(&logCapture) defer log.SetOutput(os.Stdout) require.NoError(t, Flatten(FlattenOpts{Spec: New(sp), BasePath: bp, Verbose: true, Minimal: true, RemoveUnused: false})) msg := logCapture.String() if !assert.NotContainsf(t, msg, "warning: duplicate flattened definition name resolved as aAOAIGen", "Expected log message") { t.Logf("Captured log: %s", msg) } if !assert.NotContainsf(t, msg, "warning: duplicate flattened definition name resolved as uniqueName2OAIGen", "Expected log message") { t.Logf("Captured log: %s", msg) } res := getInPath(t, sp, "/some/where", "/get/responses/204/schema") assert.JSONEqf(t, `{"$ref": "#/definitions/uniqueName1"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/post/responses/204/schema") assert.JSONEqf(t, `{"$ref": "#/definitions/d"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/get/responses/206/schema") assert.JSONEqf(t, `{"$ref": "#/definitions/a"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/get/responses/304/schema") assert.JSONEqf(t, `{"$ref": "#/definitions/transitive11"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/get/responses/205/schema") assert.JSONEqf(t, `{"$ref": "#/definitions/b"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/post/responses/200/schema") assert.JSONEqf(t, `{"type": "integer"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/post/responses/default/schema") // This JSON pointer is expanded assert.JSONEqf(t, `{"type": "integer"}`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "aA") assert.JSONEqf(t, `{"type": "string", "format": "date"}`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "a") assert.JSONEqf(t, `{ "type": "object", "properties": { "a": { "type": "object", "properties": { "b": { "type": "integer" } } } } }`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "bB") assert.JSONEqf(t, `{"type": "string", "format": "date-time"}`, res, "Expected a simple schema for response") _, ok := sp.Definitions["bItems"] assert.Falsef(t, ok, "Did not expect a definition for %s", "bItems") res = getDefinition(t, sp, "d") assert.JSONEqf(t, `{ "type": "object", "properties": { "c": { "type": "integer" } } }`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "b") assert.JSONEqf(t, `{ "type": "array", "items": { "$ref": "#/definitions/d" } }`, res, "Expected a ref in response") res = getDefinition(t, sp, "myBody") assert.JSONEqf(t, `{ "type": "object", "properties": { "aA": { "$ref": "#/definitions/aA" }, "prop1": { "type": "integer" } } }`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "uniqueName2") assert.JSONEqf(t, `{"$ref": "#/definitions/notUniqueName2"}`, res, "Expected a simple schema for response") // with allOf container: []spec.Schema res = getInPath(t, sp, "/with/slice/container", "/get/responses/default/schema") assert.JSONEqf(t, `{ "allOf": [ { "$ref": "#/definitions/uniqueName3" }, { "$ref": "#/definitions/getWithSliceContainerDefaultBodyAllOf1" } ] }`, res, "Expected a simple schema for response") // with tuple container res = getInPath(t, sp, "/with/tuple/container", "/get/responses/default/schema") assert.JSONEqf(t, `{ "type": "array", "items": [ { "$ref": "#/definitions/uniqueName3" }, { "$ref": "#/definitions/getWithSliceContainerDefaultBodyAllOf1" } ] }`, res, "Expected a simple schema for response") // with SchemaOrArray container res = getInPath(t, sp, "/with/tuple/conflict", "/get/responses/default/schema") assert.JSONEqf(t, `{ "type": "array", "items": [ { "$ref": "#/definitions/uniqueName4" }, { "type": "object", "properties": { "prop10": { "type": "string" } } } ] }`, res, "Expected a simple schema for response") } func assertNoOAIGen(t *testing.T, bp string, sp *spec.Swagger) (success bool) { var logCapture bytes.Buffer log.SetOutput(&logCapture) defer log.SetOutput(os.Stdout) defer func() { success = !t.Failed() }() require.NoError(t, Flatten(FlattenOpts{Spec: New(sp), BasePath: bp, Verbose: true, Minimal: false, RemoveUnused: false})) msg := logCapture.String() assert.NotContains(t, msg, "warning") for k := range sp.Definitions { require.NotContains(t, k, "OAIGen") } return } func TestFlatten_OAIGen(t *testing.T) { for _, fixture := range []string{ filepath.Join("fixtures", "oaigen", "test3-swagger.yaml"), filepath.Join("fixtures", "oaigen", "test3-bis-swagger.yaml"), filepath.Join("fixtures", "oaigen", "test3-ter-swagger.yaml"), } { t.Run(fmt.Sprintf("flatten_oiagen_1260_%s", fixture), func(t *testing.T) { t.Parallel() bp := filepath.Join("fixtures", "oaigen", "test3-swagger.yaml") sp := antest.LoadOrFail(t, bp) require.Truef(t, assertNoOAIGen(t, bp, sp), "did not expect an OAIGen definition here") }) } } func TestMoreNameInlinedSchemas(t *testing.T) { bp := filepath.Join("fixtures", "more_nested_inline_schemas.yml") sp := antest.LoadOrFail(t, bp) require.NoError(t, Flatten(FlattenOpts{Spec: New(sp), BasePath: bp, Verbose: true, Minimal: false, RemoveUnused: false})) res := getInPath(t, sp, "/some/where/{id}", "/post/responses/200/schema") assert.JSONEqf(t, ` { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "$ref": "#/definitions/postSomeWhereIdOKBodyAdditionalPropertiesAdditionalPropertiesAdditionalProperties" } } } }`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where/{id}", "/post/responses/204/schema") assert.JSONEqf(t, ` { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "object", "additionalProperties": { "type": "array", "items": { "$ref": "#/definitions/postSomeWhereIdNoContentBodyAdditionalPropertiesItemsAdditionalPropertiesItemsAdditionalPropertiesItems" } } } } } } } `, res, "Expected a simple schema for response") } func TestRemoveUnused(t *testing.T) { log.SetOutput(ioutil.Discard) defer log.SetOutput(os.Stdout) bp := filepath.Join("fixtures", "oaigen", "fixture-oaigen.yaml") sp := antest.LoadOrFail(t, bp) require.NoError(t, Flatten(FlattenOpts{Spec: New(sp), BasePath: bp, Verbose: false, Minimal: true, RemoveUnused: true})) assert.Nil(t, sp.Parameters) assert.Nil(t, sp.Responses) bp = filepath.Join("fixtures", "parameters", "fixture-parameters.yaml") sp = antest.LoadOrFail(t, bp) an := New(sp) require.NoError(t, Flatten(FlattenOpts{Spec: an, BasePath: bp, Verbose: false, Minimal: true, RemoveUnused: true})) assert.Nil(t, sp.Parameters) assert.Nil(t, sp.Responses) op, ok := an.OperationFor("GET", "/some/where") assert.True(t, ok) assert.Lenf(t, op.Parameters, 4, "Expected 4 parameters expanded for this operation") assert.Lenf(t, an.ParamsFor("GET", "/some/where"), 7, "Expected 7 parameters (with default) expanded for this operation") op, ok = an.OperationFor("PATCH", "/some/remote") assert.True(t, ok) assert.Lenf(t, op.Parameters, 1, "Expected 1 parameter expanded for this operation") assert.Lenf(t, an.ParamsFor("PATCH", "/some/remote"), 2, "Expected 2 parameters (with default) expanded for this operation") _, ok = sp.Definitions["unused"] assert.False(t, ok, "Did not expect to find #/definitions/unused") bp = filepath.Join("fixtures", "parameters", "fixture-parameters.yaml") sp = antest.LoadOrFail(t, bp) require.NoError(t, Flatten(FlattenOpts{Spec: New(sp), BasePath: bp, Verbose: true, Minimal: false, RemoveUnused: true})) assert.Nil(t, sp.Parameters) assert.Nil(t, sp.Responses) _, ok = sp.Definitions["unused"] assert.Falsef(t, ok, "Did not expect to find #/definitions/unused") } func TestOperationIDs(t *testing.T) { bp := filepath.Join("fixtures", "operations", "fixture-operations.yaml") sp := antest.LoadOrFail(t, bp) an := New(sp) require.NoError(t, Flatten(FlattenOpts{Spec: an, BasePath: bp, Verbose: false, Minimal: false, RemoveUnused: false})) res := operations.GatherOperations(New(sp), []string{"getSomeWhere", "getSomeWhereElse"}) _, ok := res["getSomeWhere"] assert.Truef(t, ok, "Expected to find operation") _, ok = res["getSomeWhereElse"] assert.Truef(t, ok, "Expected to find operation") _, ok = res["postSomeWhere"] assert.Falsef(t, ok, "Did not expect to find operation") op, ok := an.OperationFor("GET", "/some/where/else") assert.True(t, ok) assert.NotNil(t, op) assert.Len(t, an.ParametersFor("getSomeWhereElse"), 2) op, ok = an.OperationFor("POST", "/some/where/else") assert.True(t, ok) assert.NotNil(t, op) assert.Len(t, an.ParametersFor("postSomeWhereElse"), 1) op, ok = an.OperationFor("PUT", "/some/where/else") assert.True(t, ok) assert.NotNil(t, op) assert.Len(t, an.ParametersFor("putSomeWhereElse"), 1) op, ok = an.OperationFor("PATCH", "/some/where/else") assert.True(t, ok) assert.NotNil(t, op) assert.Len(t, an.ParametersFor("patchSomeWhereElse"), 1) op, ok = an.OperationFor("DELETE", "/some/where/else") assert.True(t, ok) assert.NotNil(t, op) assert.Len(t, an.ParametersFor("deleteSomeWhereElse"), 1) op, ok = an.OperationFor("HEAD", "/some/where/else") assert.True(t, ok) assert.NotNil(t, op) assert.Len(t, an.ParametersFor("headSomeWhereElse"), 1) op, ok = an.OperationFor("OPTIONS", "/some/where/else") assert.True(t, ok) assert.NotNil(t, op) assert.Len(t, an.ParametersFor("optionsSomeWhereElse"), 1) assert.Len(t, an.ParametersFor("outOfThisWorld"), 0) } func TestFlatten_Pointers(t *testing.T) { log.SetOutput(ioutil.Discard) defer log.SetOutput(os.Stdout) bp := filepath.Join("fixtures", "pointers", "fixture-pointers.yaml") sp := antest.LoadOrFail(t, bp) an := New(sp) require.NoError(t, Flatten(FlattenOpts{Spec: an, BasePath: bp, Verbose: true, Minimal: true, RemoveUnused: false})) // re-analyse and check all $ref's point to #/definitions bn := New(sp) for _, r := range bn.AllRefs() { assert.True(t, path.Dir(r.String()) == definitionsPath) } } // unit test guards in flatten not easily testable with actual specs func TestFlatten_ErrorHandling(t *testing.T) { log.SetOutput(ioutil.Discard) defer log.SetOutput(os.Stdout) const wantedFailure = "Expected a failure" bp := filepath.Join("fixtures", "errors", "fixture-unexpandable.yaml") // invalid spec expansion sp := antest.LoadOrFail(t, bp) require.Errorf(t, Flatten(FlattenOpts{Spec: New(sp), BasePath: bp, Expand: true}), wantedFailure) // reload original spec sp = antest.LoadOrFail(t, bp) require.Errorf(t, Flatten(FlattenOpts{Spec: New(sp), BasePath: bp, Expand: false}), wantedFailure) bp = filepath.Join("fixtures", "errors", "fixture-unexpandable-2.yaml") sp = antest.LoadOrFail(t, bp) require.Errorf(t, Flatten(FlattenOpts{Spec: New(sp), BasePath: bp, Expand: false}), wantedFailure) // reload original spec sp = antest.LoadOrFail(t, bp) require.Errorf(t, Flatten(FlattenOpts{Spec: New(sp), BasePath: bp, Minimal: true, Expand: false}), wantedFailure) } func TestFlatten_PointersLoop(t *testing.T) { log.SetOutput(ioutil.Discard) defer log.SetOutput(os.Stdout) bp := filepath.Join("fixtures", "pointers", "fixture-pointers-loop.yaml") sp := antest.LoadOrFail(t, bp) an := New(sp) require.Error(t, Flatten(FlattenOpts{Spec: an, BasePath: bp, Verbose: true, Minimal: true, RemoveUnused: false})) } func TestFlatten_Bitbucket(t *testing.T) { log.SetOutput(ioutil.Discard) defer log.SetOutput(os.Stdout) bp := filepath.Join("fixtures", "bugs", "bitbucket.json") sp := antest.LoadOrFail(t, bp) an := New(sp) require.NoError(t, Flatten(FlattenOpts{Spec: an, BasePath: bp, Verbose: true, Minimal: true, RemoveUnused: false})) // reload original spec sp = antest.LoadOrFail(t, bp) an = New(sp) require.NoError(t, Flatten(FlattenOpts{Spec: an, BasePath: bp, Verbose: true, Minimal: false, RemoveUnused: false})) // reload original spec sp = antest.LoadOrFail(t, bp) an = New(sp) require.NoError(t, Flatten(FlattenOpts{Spec: an, BasePath: bp, Verbose: true, Expand: true, RemoveUnused: false})) // reload original spec sp = antest.LoadOrFail(t, bp) an = New(sp) require.NoError(t, Flatten(FlattenOpts{Spec: an, BasePath: bp, Verbose: true, Expand: true, RemoveUnused: true})) assert.Len(t, sp.Definitions, 2) // only 2 remaining refs after expansion: circular $ref _, ok := sp.Definitions["base_commit"] assert.True(t, ok) _, ok = sp.Definitions["repository"] assert.True(t, ok) } func TestFlatten_Issue_1602(t *testing.T) { log.SetOutput(ioutil.Discard) defer log.SetOutput(os.Stdout) // $ref as schema to #/responses or #/parameters // minimal repro test case bp := filepath.Join("fixtures", "bugs", "1602", "fixture-1602-1.yaml") sp := antest.LoadOrFail(t, bp) an := New(sp) require.NoError(t, Flatten(FlattenOpts{ Spec: an, BasePath: bp, Verbose: true, Minimal: true, Expand: false, RemoveUnused: false, })) // reload spec sp = antest.LoadOrFail(t, bp) an = New(sp) require.NoError(t, Flatten(FlattenOpts{ Spec: an, BasePath: bp, Verbose: false, Minimal: false, Expand: false, RemoveUnused: false, })) // reload spec // with prior expansion, a pseudo schema is produced sp = antest.LoadOrFail(t, bp) an = New(sp) require.NoError(t, Flatten(FlattenOpts{ Spec: an, BasePath: bp, Verbose: false, Minimal: false, Expand: true, RemoveUnused: false, })) } func TestFlatten_Issue_1602_All(t *testing.T) { for _, fixture := range []string{ filepath.Join("fixtures", "bugs", "1602", "fixture-1602-full.yaml"), filepath.Join("fixtures", "bugs", "1602", "fixture-1602-1.yaml"), filepath.Join("fixtures", "bugs", "1602", "fixture-1602-2.yaml"), filepath.Join("fixtures", "bugs", "1602", "fixture-1602-3.yaml"), filepath.Join("fixtures", "bugs", "1602", "fixture-1602-4.yaml"), filepath.Join("fixtures", "bugs", "1602", "fixture-1602-5.yaml"), filepath.Join("fixtures", "bugs", "1602", "fixture-1602-6.yaml"), } { t.Run(fmt.Sprintf("issue_1602_all_%s", fixture), func(t *testing.T) { t.Parallel() sp := antest.LoadOrFail(t, fixture) an := New(sp) require.NoError(t, Flatten(FlattenOpts{ Spec: an, BasePath: fixture, Verbose: false, Minimal: true, Expand: false, RemoveUnused: false, })) }) } } func TestFlatten_Issue_1614(t *testing.T) { log.SetOutput(ioutil.Discard) defer log.SetOutput(os.Stdout) // $ref as schema to #/responses or #/parameters // test warnings bp := filepath.Join("fixtures", "bugs", "1614", "gitea.yaml") sp := antest.LoadOrFail(t, bp) an := New(sp) require.NoError(t, Flatten(FlattenOpts{Spec: an, BasePath: bp, Verbose: true, Minimal: true, Expand: false, RemoveUnused: false})) // check that responses subject to warning have been expanded jazon := antest.AsJSON(t, sp) assert.NotContains(t, jazon, `#/responses/forbidden`) assert.NotContains(t, jazon, `#/responses/empty`) } func TestFlatten_Issue_1621(t *testing.T) { // repeated remote refs // minimal repro test case bp := filepath.Join("fixtures", "bugs", "1621", "fixture-1621.yaml") sp := antest.LoadOrFail(t, bp) an := New(sp) require.NoError(t, Flatten(FlattenOpts{ Spec: an, BasePath: bp, Verbose: true, Minimal: true, Expand: false, RemoveUnused: false, })) sch1 := sp.Paths.Paths["/v4/users/"].Get.Responses.StatusCodeResponses[200].Schema jazon := antest.AsJSON(t, sch1) assert.JSONEq(t, `{"type": "array", "items": {"$ref": "#/definitions/v4UserListItem" }}`, jazon) sch2 := sp.Paths.Paths["/v4/user/"].Get.Responses.StatusCodeResponses[200].Schema jazon = antest.AsJSON(t, sch2) assert.JSONEq(t, `{"$ref": "#/definitions/v4UserListItem"}`, jazon) sch3 := sp.Paths.Paths["/v4/users/{email}/"].Get.Responses.StatusCodeResponses[200].Schema jazon = antest.AsJSON(t, sch3) assert.JSONEq(t, `{"$ref": "#/definitions/v4UserListItem"}`, jazon) } func TestFlatten_Issue_1796(t *testing.T) { // remote cyclic ref bp := filepath.Join("fixtures", "bugs", "1796", "queryIssue.json") sp := antest.LoadOrFail(t, bp) an := New(sp) require.NoError(t, Flatten(FlattenOpts{ Spec: an, BasePath: bp, Verbose: true, Minimal: true, Expand: false, RemoveUnused: false, })) // assert all $ref match "$ref": "#/definitions/something" for _, ref := range an.AllReferences() { assert.True(t, strings.HasPrefix(ref, "#/definitions")) } } func TestFlatten_Issue_1767(t *testing.T) { // remote cyclic ref again bp := filepath.Join("fixtures", "bugs", "1767", "fixture-1767.yaml") sp := antest.LoadOrFail(t, bp) an := New(sp) require.NoError(t, Flatten(FlattenOpts{ Spec: an, BasePath: bp, Verbose: true, Minimal: true, Expand: false, RemoveUnused: false, })) // assert all $ref match "$ref": "#/definitions/something" for _, ref := range an.AllReferences() { assert.True(t, strings.HasPrefix(ref, "#/definitions")) } } func TestFlatten_Issue_1774(t *testing.T) { // remote cyclic ref again bp := filepath.Join("fixtures", "bugs", "1774", "def_api.yaml") sp := antest.LoadOrFail(t, bp) an := New(sp) require.NoError(t, Flatten(FlattenOpts{ Spec: an, BasePath: bp, Verbose: true, Minimal: false, Expand: false, RemoveUnused: false, })) // assert all $ref match "$ref": "#/definitions/something" for _, ref := range an.AllReferences() { assert.True(t, strings.HasPrefix(ref, "#/definitions")) } } func TestFlatten_1429(t *testing.T) { // nested / remote $ref in response / param schemas // issue go-swagger/go-swagger#1429 bp := filepath.Join("fixtures", "bugs", "1429", "swagger.yaml") sp := antest.LoadOrFail(t, bp) an := New(sp) require.NoError(t, Flatten(FlattenOpts{ Spec: an, BasePath: bp, Verbose: true, Minimal: true, RemoveUnused: false, })) } func TestFlatten_1851(t *testing.T) { // nested / remote $ref in response / param schemas // issue go-swagger/go-swagger#1851 bp := filepath.Join("fixtures", "bugs", "1851", "fixture-1851.yaml") sp := antest.LoadOrFail(t, bp) an := New(sp) require.NoError(t, Flatten(FlattenOpts{ Spec: an, BasePath: bp, Verbose: true, Minimal: true, RemoveUnused: false, })) serverDefinition, ok := an.spec.Definitions["server"] assert.True(t, ok) serverStatusDefinition, ok := an.spec.Definitions["serverStatus"] assert.True(t, ok) serverStatusProperty, ok := serverDefinition.Properties["Status"] assert.True(t, ok) jazon := antest.AsJSON(t, serverStatusProperty) assert.JSONEq(t, `{"$ref": "#/definitions/serverStatus"}`, jazon) jazon = antest.AsJSON(t, serverStatusDefinition) assert.JSONEq(t, `{"type": "string", "enum": [ "OK", "Not OK" ]}`, jazon) // additional test case: this one used to work bp = filepath.Join("fixtures", "bugs", "1851", "fixture-1851-2.yaml") sp = antest.LoadOrFail(t, bp) an = New(sp) require.NoError(t, Flatten(FlattenOpts{Spec: an, BasePath: bp, Verbose: true, Minimal: true, RemoveUnused: false})) serverDefinition, ok = an.spec.Definitions["Server"] assert.True(t, ok) serverStatusDefinition, ok = an.spec.Definitions["ServerStatus"] assert.True(t, ok) serverStatusProperty, ok = serverDefinition.Properties["Status"] assert.True(t, ok) jazon = antest.AsJSON(t, serverStatusProperty) assert.JSONEq(t, `{"$ref": "#/definitions/ServerStatus"}`, jazon) jazon = antest.AsJSON(t, serverStatusDefinition) assert.JSONEq(t, `{"type": "string", "enum": [ "OK", "Not OK" ]}`, jazon) } func TestFlatten_RemoteAbsolute(t *testing.T) { for _, fixture := range []string{ // this one has simple remote ref pattern filepath.Join("fixtures", "bugs", "remote-absolute", "swagger-mini.json"), // this has no remote ref filepath.Join("fixtures", "bugs", "remote-absolute", "swagger.json"), // this one has local ref, no naming conflict (same as previous but with external ref imported) filepath.Join("fixtures", "bugs", "remote-absolute", "swagger-with-local-ref.json"), // this one has remote ref, no naming conflict (same as previous but with external ref imported) filepath.Join("fixtures", "bugs", "remote-absolute", "swagger-with-remote-only-ref.json"), } { t.Run(fmt.Sprintf("remote_absolute_%s", fixture), func(t *testing.T) { t.Parallel() an := testFlattenWithDefaults(t, fixture) checkRefs(t, an.spec, true) }) } // This one has both remote and local ref with naming conflict. // This creates some "oiagen" definitions to address naming conflict, // which are removed by the oaigen pruning process (reinlined / merged with parents). an := testFlattenWithDefaults(t, filepath.Join("fixtures", "bugs", "remote-absolute", "swagger-with-ref.json")) checkRefs(t, an.spec, false) } func TestFlatten_2092(t *testing.T) { log.SetOutput(ioutil.Discard) defer log.SetOutput(os.Stdout) bp := filepath.Join("fixtures", "bugs", "2092", "swagger.yaml") rexOAIGen := regexp.MustCompile(`(?i)("\$ref":\s*")(.?oaigen.?)"`) // #2092 exhibits a stability issue: repeat 100 times the process to make sure it is stable sp := antest.LoadOrFail(t, bp) an := New(sp) require.NoError(t, Flatten(FlattenOpts{Spec: an, BasePath: bp, Verbose: true, Minimal: true, RemoveUnused: false})) firstJSONMinimal := antest.AsJSON(t, an.spec) // verify we don't have dangling oaigen refs require.Falsef(t, rexOAIGen.MatchString(firstJSONMinimal), "unmatched regexp for: %s", firstJSONMinimal) sp = antest.LoadOrFail(t, bp) an = New(sp) require.NoError(t, Flatten(FlattenOpts{Spec: an, BasePath: bp, Verbose: true, Minimal: false, RemoveUnused: false})) firstJSONFull := antest.AsJSON(t, an.spec) // verify we don't have dangling oaigen refs require.Falsef(t, rexOAIGen.MatchString(firstJSONFull), "unmatched regexp for: %s", firstJSONFull) for i := 0; i < 10; i++ { t.Run(fmt.Sprintf("issue_2092_%d", i), func(t *testing.T) { t.Parallel() // verify that we produce a stable result sp := antest.LoadOrFail(t, bp) an := New(sp) require.NoError(t, Flatten(FlattenOpts{Spec: an, BasePath: bp, Verbose: true, Minimal: true, RemoveUnused: false})) jazon := antest.AsJSON(t, an.spec) assert.JSONEq(t, firstJSONMinimal, jazon) require.NoError(t, Flatten(FlattenOpts{Spec: an, BasePath: bp, Verbose: true, Minimal: true, RemoveUnused: true})) sp = antest.LoadOrFail(t, bp) an = New(sp) require.NoError(t, Flatten(FlattenOpts{Spec: an, BasePath: bp, Verbose: true, Minimal: false, RemoveUnused: false})) jazon = antest.AsJSON(t, an.spec) assert.JSONEq(t, firstJSONFull, jazon) }) } } func TestFlatten_2113(t *testing.T) { // flatten $ref under path log.SetOutput(ioutil.Discard) defer log.SetOutput(os.Stdout) bp := filepath.Join("fixtures", "bugs", "2113", "base.yaml") sp := antest.LoadOrFail(t, bp) an := New(sp) require.NoError(t, Flatten(FlattenOpts{ Spec: an, BasePath: bp, Verbose: true, Expand: true, RemoveUnused: false, })) sp = antest.LoadOrFail(t, bp) an = New(sp) require.NoError(t, Flatten(FlattenOpts{ Spec: an, BasePath: bp, Verbose: true, Minimal: true, RemoveUnused: false, })) jazon := antest.AsJSON(t, sp) expected, err := ioutil.ReadFile(filepath.Join("fixtures", "expected", "issue-2113.json")) require.NoError(t, err) require.JSONEq(t, string(expected), jazon) } func getDefinition(t testing.TB, sp *spec.Swagger, key string) string { d, ok := sp.Definitions[key] require.Truef(t, ok, "Expected definition for %s", key) res, _ := json.Marshal(d) return string(res) } func getInPath(t testing.TB, sp *spec.Swagger, path, key string) string { ptr, erp := jsonpointer.New(key) require.NoError(t, erp, "at %s no key", key) d, _, erg := ptr.Get(sp.Paths.Paths[path]) require.NoError(t, erg, "at %s no value for %s", path, key) res, _ := json.Marshal(d) return string(res) } func checkRefs(t testing.TB, spec *spec.Swagger, expectNoConflict bool) { // all $ref resolve locally jazon := antest.AsJSON(t, spec) m := rex.FindAllStringSubmatch(jazon, -1) require.NotNil(t, m) for _, matched := range m { subMatch := matched[1] assert.True(t, strings.HasPrefix(subMatch, "#/definitions/"), "expected $ref to be inlined, got: %s", matched[0]) } if expectNoConflict { // no naming conflict m := oairex.FindAllStringSubmatch(jazon, -1) assert.Empty(t, m) } } func testFlattenWithDefaults(t *testing.T, bp string) *Spec { sp := antest.LoadOrFail(t, bp) an := New(sp) require.NoError(t, Flatten(FlattenOpts{ Spec: an, BasePath: bp, Verbose: true, Minimal: true, RemoveUnused: false, })) return an } analysis-0.21.1/go.mod000066400000000000000000000006431413705513100145270ustar00rootroot00000000000000module github.com/go-openapi/analysis require ( github.com/go-openapi/errors v0.19.9 // indirect github.com/go-openapi/jsonpointer v0.19.5 github.com/go-openapi/spec v0.20.4 github.com/go-openapi/strfmt v0.21.0 github.com/go-openapi/swag v0.19.15 github.com/mitchellh/mapstructure v1.4.1 // indirect github.com/stretchr/testify v1.7.0 gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) go 1.13 analysis-0.21.1/go.sum000066400000000000000000000362371413705513100145640ustar00rootroot00000000000000github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef h1:46PFijGLmAjMPwCCCo7Jf0W6f9slllCkkv7vyc1yOSg= github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/errors v0.19.9 h1:9SnKdGhiPZHF3ttwFMiCBEb8jQ4IDdrK+5+a0oTygA4= github.com/go-openapi/errors v0.19.9/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs= github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= github.com/go-openapi/spec v0.20.4 h1:O8hJrt0UMnhHcluhIdUgCLRWyM2x7QkBXRvOs7m+O1M= github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= github.com/go-openapi/strfmt v0.21.0 h1:hX2qEZKmYks+t0hKeb4VTJpUm2UYsdL3+DCid5swxIs= github.com/go-openapi/strfmt v0.21.0/go.mod h1:ZRQ409bWMj+SOgXofQAGTIo2Ebu72Gs+WaRADcS5iNg= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM= github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY= github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg= github.com/gobuffalo/envy v1.6.15/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= github.com/gobuffalo/flect v0.1.0/go.mod h1:d2ehjJqGOH/Kjqcoz+F7jHTBbmDb38yXA598Hb50EGs= github.com/gobuffalo/flect v0.1.1/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= github.com/gobuffalo/flect v0.1.3/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= github.com/gobuffalo/genny v0.0.0-20190329151137-27723ad26ef9/go.mod h1:rWs4Z12d1Zbf19rlsn0nurr75KqhYp52EAGGxTbBhNk= github.com/gobuffalo/genny v0.0.0-20190403191548-3ca520ef0d9e/go.mod h1:80lIj3kVJWwOrXWWMRzzdhW3DsrdjILVil/SFKBzF28= github.com/gobuffalo/genny v0.1.0/go.mod h1:XidbUqzak3lHdS//TPu2OgiFB+51Ur5f7CSnXZ/JDvo= github.com/gobuffalo/genny v0.1.1/go.mod h1:5TExbEyY48pfunL4QSXxlDOmdsD44RRq4mVZ0Ex28Xk= github.com/gobuffalo/gitgen v0.0.0-20190315122116-cc086187d211/go.mod h1:vEHJk/E9DmhejeLeNt7UVvlSGv3ziL+djtTr3yyzcOw= github.com/gobuffalo/gogen v0.0.0-20190315121717-8f38393713f5/go.mod h1:V9QVDIxsgKNZs6L2IYiGR8datgMhB577vzTDqypH360= github.com/gobuffalo/gogen v0.1.0/go.mod h1:8NTelM5qd8RZ15VjQTFkAW6qOMx5wBbW4dSCS3BY8gg= github.com/gobuffalo/gogen v0.1.1/go.mod h1:y8iBtmHmGc4qa3urIyo1shvOD8JftTtfcKi+71xfDNE= github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2/go.mod h1:QdxcLw541hSGtBnhUc4gaNIXRjiDppFGaDqzbrBd3v8= github.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= github.com/gobuffalo/mapi v1.0.2/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ= github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0= github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA= github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= go.mongodb.org/mongo-driver v1.7.3 h1:G4l/eYY9VrQAK/AUgkV0koQKzQnyddnWxrd/Etf0jIs= go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20210421230115-4e50805a0758 h1:aEpZnXcAmXkd6AvLb2OPt+EN1Zu/8Ne3pCqPjja5PXY= golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190419153524-e8e3143a4f4a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190329151228-23e29df326fe/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= analysis-0.21.1/internal/000077500000000000000000000000001413705513100152325ustar00rootroot00000000000000analysis-0.21.1/internal/antest/000077500000000000000000000000001413705513100165305ustar00rootroot00000000000000analysis-0.21.1/internal/antest/helpers.go000066400000000000000000000030641413705513100205240ustar00rootroot00000000000000package antest import ( "encoding/json" "flag" "os" "path/filepath" "sync" "testing" "github.com/go-openapi/spec" "github.com/go-openapi/swag" "github.com/stretchr/testify/require" ) var ( oncePathLoader sync.Once enableLongTests bool ) func init() { if flag.Lookup("enable-long") == nil { flag.BoolVar(&enableLongTests, "enable-long", false, "enable long runnning tests") } } // LongTestsEnabled returns the CLI flag func LongTestsEnabled() bool { return enableLongTests } func initPathLoader() { spec.PathLoader = func(path string) (json.RawMessage, error) { ext := filepath.Ext(path) if ext == ".yml" || ext == ".yaml" { return swag.YAMLDoc(path) } data, err := swag.LoadFromFileOrHTTP(path) if err != nil { return nil, err } return json.RawMessage(data), nil } } // LoadSpec loads a json a yaml spec func LoadSpec(path string) (*spec.Swagger, error) { oncePathLoader.Do(initPathLoader) data, err := swag.YAMLDoc(path) if err != nil { return nil, err } var sw spec.Swagger if err := json.Unmarshal(data, &sw); err != nil { return nil, err } return &sw, nil } // LoadOrFail fetches a spec from a relative path or dies if the spec cannot be loaded properly func LoadOrFail(t testing.TB, relative string) *spec.Swagger { cwd, _ := os.Getwd() sp, err := LoadSpec(filepath.Join(cwd, relative)) require.NoError(t, err) return sp } // AsJSON unmarshals anything as JSON or dies func AsJSON(t testing.TB, in interface{}) string { bbb, err := json.MarshalIndent(in, "", " ") require.NoError(t, err) return string(bbb) } analysis-0.21.1/internal/debug/000077500000000000000000000000001413705513100163205ustar00rootroot00000000000000analysis-0.21.1/internal/debug/debug.go000066400000000000000000000021631413705513100177370ustar00rootroot00000000000000// Copyright 2015 go-swagger maintainers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package debug import ( "fmt" "log" "os" "path/filepath" "runtime" ) var ( output = os.Stdout ) // GetLogger provides a prefix debug logger func GetLogger(prefix string, debug bool) func(string, ...interface{}) { if debug { logger := log.New(output, fmt.Sprintf("%s:", prefix), log.LstdFlags) return func(msg string, args ...interface{}) { _, file1, pos1, _ := runtime.Caller(1) logger.Printf("%s:%d: %s", filepath.Base(file1), pos1, fmt.Sprintf(msg, args...)) } } return func(msg string, args ...interface{}) {} } analysis-0.21.1/internal/debug/debug_test.go000066400000000000000000000027511413705513100210010ustar00rootroot00000000000000// Copyright 2015 go-swagger maintainers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package debug import ( "io/ioutil" "os" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestDebug(t *testing.T) { tmpFile, err := ioutil.TempFile("", "debug-test") require.NoError(t, err) output = tmpFile tmpName := tmpFile.Name() defer func() { _ = os.Remove(tmpName) }() testLogger := GetLogger("test", true) testLogger("A debug: %s", "a string") tmpFile.Close() flushed, err := ioutil.ReadFile(tmpName) require.NoError(t, err) assert.Contains(t, string(flushed), "A debug: a string") tmpEmptyFile, err := ioutil.TempFile("", "debug-test") require.NoError(t, err) tmpEmpty := tmpEmptyFile.Name() defer func() { _ = os.Remove(tmpEmpty) }() testLogger = GetLogger("test", false) testLogger("A debug: %s", "a string") tmpFile.Close() flushed, err = ioutil.ReadFile(tmpEmpty) require.NoError(t, err) assert.Empty(t, flushed) } analysis-0.21.1/internal/flatten/000077500000000000000000000000001413705513100166675ustar00rootroot00000000000000analysis-0.21.1/internal/flatten/normalize/000077500000000000000000000000001413705513100206675ustar00rootroot00000000000000analysis-0.21.1/internal/flatten/normalize/normalize.go000066400000000000000000000044571413705513100232300ustar00rootroot00000000000000package normalize import ( "net/url" "path" "path/filepath" "strings" "github.com/go-openapi/spec" ) // RebaseRef rebases a remote ref relative to a base ref. // // NOTE: does not support JSONschema ID for $ref (we assume we are working with swagger specs here). // // NOTE(windows): // * refs are assumed to have been normalized with drive letter lower cased (from go-openapi/spec) // * "/ in paths may appear as escape sequences func RebaseRef(baseRef string, ref string) string { baseRef, _ = url.PathUnescape(baseRef) ref, _ = url.PathUnescape(ref) if baseRef == "" || baseRef == "." || strings.HasPrefix(baseRef, "#") { return ref } parts := strings.Split(ref, "#") baseParts := strings.Split(baseRef, "#") baseURL, _ := url.Parse(baseParts[0]) if strings.HasPrefix(ref, "#") { if baseURL.Host == "" { return strings.Join([]string{baseParts[0], parts[1]}, "#") } return strings.Join([]string{baseParts[0], parts[1]}, "#") } refURL, _ := url.Parse(parts[0]) if refURL.Host != "" || filepath.IsAbs(parts[0]) { // not rebasing an absolute path return ref } // there is a relative path var basePath string if baseURL.Host != "" { // when there is a host, standard URI rules apply (with "/") baseURL.Path = path.Dir(baseURL.Path) baseURL.Path = path.Join(baseURL.Path, "/"+parts[0]) return baseURL.String() } // this is a local relative path // basePart[0] and parts[0] are local filesystem directories/files basePath = filepath.Dir(baseParts[0]) relPath := filepath.Join(basePath, string(filepath.Separator)+parts[0]) if len(parts) > 1 { return strings.Join([]string{relPath, parts[1]}, "#") } return relPath } // Path renders absolute path on remote file refs // // NOTE(windows): // * refs are assumed to have been normalized with drive letter lower cased (from go-openapi/spec) // * "/ in paths may appear as escape sequences func Path(ref spec.Ref, basePath string) string { uri, _ := url.PathUnescape(ref.String()) if ref.HasFragmentOnly || filepath.IsAbs(uri) { return uri } refURL, _ := url.Parse(uri) if refURL.Host != "" { return uri } parts := strings.Split(uri, "#") // BasePath, parts[0] are local filesystem directories, guaranteed to be absolute at this stage parts[0] = filepath.Join(filepath.Dir(basePath), parts[0]) return strings.Join(parts, "#") } analysis-0.21.1/internal/flatten/normalize/normalize_test.go000066400000000000000000000065771413705513100242740ustar00rootroot00000000000000package normalize import ( "net/url" "path/filepath" "runtime" "testing" _ "github.com/go-openapi/analysis/internal/antest" "github.com/go-openapi/spec" "github.com/stretchr/testify/assert" ) func TestNormalize_Path(t *testing.T) { t.Parallel() values := []struct{ Source, Expected string }{ {"#/definitions/A", "#/definitions/A"}, {"http://somewhere.com/definitions/A", "http://somewhere.com/definitions/A"}, {wrapWindowsPath("/definitions/A"), wrapWindowsPath("/definitions/A")}, // considered absolute on unix but not on windows {wrapWindowsPath("/definitions/errorModel.json") + "#/definitions/A", wrapWindowsPath("/definitions/errorModel.json") + "#/definitions/A"}, {"http://somewhere.com", "http://somewhere.com"}, {wrapWindowsPath("./definitions/definitions.yaml") + "#/definitions/A", wrapWindowsPath("/abs/to/spec/definitions/definitions.yaml") + "#/definitions/A"}, {"#", wrapWindowsPath("/abs/to/spec")}, } for _, v := range values { assert.Equal(t, v.Expected, Path(spec.MustCreateRef(v.Source), wrapWindowsPath("/abs/to/spec/spec.json"))) } } func TestNormalize_RebaseRef(t *testing.T) { t.Parallel() assert.Equal(t, "#/definitions/abc", RebaseRef("#/definitions/base", "#/definitions/abc")) assert.Equal(t, "#/definitions/abc", RebaseRef("", "#/definitions/abc")) assert.Equal(t, "#/definitions/abc", RebaseRef(".", "#/definitions/abc")) assert.Equal(t, "otherfile#/definitions/abc", RebaseRef("file#/definitions/base", "otherfile#/definitions/abc")) assert.Equal(t, wrapWindowsPath("../otherfile")+"#/definitions/abc", RebaseRef(wrapWindowsPath("../file")+"#/definitions/base", wrapWindowsPath("./otherfile")+"#/definitions/abc")) assert.Equal(t, wrapWindowsPath("../otherfile")+"#/definitions/abc", RebaseRef(wrapWindowsPath("../file")+"#/definitions/base", wrapWindowsPath("otherfile")+"#/definitions/abc")) assert.Equal(t, wrapWindowsPath("local/remote/otherfile")+"#/definitions/abc", RebaseRef(wrapWindowsPath("local/file")+"#/definitions/base", wrapWindowsPath("remote/otherfile")+"#/definitions/abc")) assert.Equal(t, wrapWindowsPath("local/remote/otherfile.yaml"), RebaseRef(wrapWindowsPath("local/file.yaml"), wrapWindowsPath("remote/otherfile.yaml"))) assert.Equal(t, "file#/definitions/abc", RebaseRef("file#/definitions/base", "#/definitions/abc")) // with remote assert.Equal(t, "https://example.com/base#/definitions/abc", RebaseRef("https://example.com/base", "https://example.com/base#/definitions/abc")) assert.Equal(t, "https://example.com/base#/definitions/abc", RebaseRef("https://example.com/base", "#/definitions/abc")) assert.Equal(t, "https://example.com/base#/dir/definitions/abc", RebaseRef("https://example.com/base", "#/dir/definitions/abc")) assert.Equal(t, "https://example.com/base/dir/definitions/abc", RebaseRef("https://example.com/base/spec.yaml", "dir/definitions/abc")) assert.Equal(t, "https://example.com/base/dir/definitions/abc", RebaseRef("https://example.com/base/", "dir/definitions/abc")) assert.Equal(t, "https://example.com/dir/definitions/abc", RebaseRef("https://example.com/base", "dir/definitions/abc")) } // wrapWindowsPath adapts path expectations for tests running on windows func wrapWindowsPath(p string) string { if runtime.GOOS != "windows" { return p } pp := filepath.FromSlash(p) if !filepath.IsAbs(p) && []rune(pp)[0] == '\\' { pp, _ = filepath.Abs(p) u, _ := url.Parse(pp) return u.String() } return pp } analysis-0.21.1/internal/flatten/operations/000077500000000000000000000000001413705513100210525ustar00rootroot00000000000000analysis-0.21.1/internal/flatten/operations/operations.go000066400000000000000000000042021413705513100235620ustar00rootroot00000000000000package operations import ( "path" "sort" "strings" "github.com/go-openapi/jsonpointer" "github.com/go-openapi/spec" "github.com/go-openapi/swag" ) // AllOpRefsByRef returns an index of sortable operations func AllOpRefsByRef(specDoc Provider, operationIDs []string) map[string]OpRef { return OpRefsByRef(GatherOperations(specDoc, operationIDs)) } // OpRefsByRef indexes a map of sortable operations func OpRefsByRef(oprefs map[string]OpRef) map[string]OpRef { result := make(map[string]OpRef, len(oprefs)) for _, v := range oprefs { result[v.Ref.String()] = v } return result } // OpRef is an indexable, sortable operation type OpRef struct { Method string Path string Key string ID string Op *spec.Operation Ref spec.Ref } // OpRefs is a sortable collection of operations type OpRefs []OpRef func (o OpRefs) Len() int { return len(o) } func (o OpRefs) Swap(i, j int) { o[i], o[j] = o[j], o[i] } func (o OpRefs) Less(i, j int) bool { return o[i].Key < o[j].Key } // Provider knows how to collect operations from a spec type Provider interface { Operations() map[string]map[string]*spec.Operation } // GatherOperations builds a map of sorted operations from a spec func GatherOperations(specDoc Provider, operationIDs []string) map[string]OpRef { var oprefs OpRefs for method, pathItem := range specDoc.Operations() { for pth, operation := range pathItem { vv := *operation oprefs = append(oprefs, OpRef{ Key: swag.ToGoName(strings.ToLower(method) + " " + pth), Method: method, Path: pth, ID: vv.ID, Op: &vv, Ref: spec.MustCreateRef("#" + path.Join("/paths", jsonpointer.Escape(pth), method)), }) } } sort.Sort(oprefs) operations := make(map[string]OpRef) for _, opr := range oprefs { nm := opr.ID if nm == "" { nm = opr.Key } oo, found := operations[nm] if found && oo.Method != opr.Method && oo.Path != opr.Path { nm = opr.Key } if len(operationIDs) == 0 || swag.ContainsStrings(operationIDs, opr.ID) || swag.ContainsStrings(operationIDs, nm) { opr.ID = nm opr.Op.ID = nm operations[nm] = opr } } return operations } analysis-0.21.1/internal/flatten/operations/operations_test.go000066400000000000000000000001231413705513100246170ustar00rootroot00000000000000package operations import ( _ "github.com/go-openapi/analysis/internal/antest" ) analysis-0.21.1/internal/flatten/replace/000077500000000000000000000000001413705513100203025ustar00rootroot00000000000000analysis-0.21.1/internal/flatten/replace/replace.go000066400000000000000000000276171413705513100222610ustar00rootroot00000000000000package replace import ( "fmt" "net/url" "os" "path" "strconv" "github.com/go-openapi/analysis/internal/debug" "github.com/go-openapi/jsonpointer" "github.com/go-openapi/spec" ) const definitionsPath = "#/definitions" var debugLog = debug.GetLogger("analysis/flatten/replace", os.Getenv("SWAGGER_DEBUG") != "") // RewriteSchemaToRef replaces a schema with a Ref func RewriteSchemaToRef(sp *spec.Swagger, key string, ref spec.Ref) error { debugLog("rewriting schema to ref for %s with %s", key, ref.String()) _, value, err := getPointerFromKey(sp, key) if err != nil { return err } switch refable := value.(type) { case *spec.Schema: return rewriteParentRef(sp, key, ref) case spec.Schema: return rewriteParentRef(sp, key, ref) case *spec.SchemaOrArray: if refable.Schema != nil { refable.Schema = &spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} } case *spec.SchemaOrBool: if refable.Schema != nil { refable.Schema = &spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} } default: return fmt.Errorf("no schema with ref found at %s for %T", key, value) } return nil } func rewriteParentRef(sp *spec.Swagger, key string, ref spec.Ref) error { parent, entry, pvalue, err := getParentFromKey(sp, key) if err != nil { return err } debugLog("rewriting holder for %T", pvalue) switch container := pvalue.(type) { case spec.Response: if err := rewriteParentRef(sp, "#"+parent, ref); err != nil { return err } case *spec.Response: container.Schema = &spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} case *spec.Responses: statusCode, err := strconv.Atoi(entry) if err != nil { return fmt.Errorf("%s not a number: %w", key[1:], err) } resp := container.StatusCodeResponses[statusCode] resp.Schema = &spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} container.StatusCodeResponses[statusCode] = resp case map[string]spec.Response: resp := container[entry] resp.Schema = &spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} container[entry] = resp case spec.Parameter: if err := rewriteParentRef(sp, "#"+parent, ref); err != nil { return err } case map[string]spec.Parameter: param := container[entry] param.Schema = &spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} container[entry] = param case []spec.Parameter: idx, err := strconv.Atoi(entry) if err != nil { return fmt.Errorf("%s not a number: %w", key[1:], err) } param := container[idx] param.Schema = &spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} container[idx] = param case spec.Definitions: container[entry] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} case map[string]spec.Schema: container[entry] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} case []spec.Schema: idx, err := strconv.Atoi(entry) if err != nil { return fmt.Errorf("%s not a number: %w", key[1:], err) } container[idx] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} case *spec.SchemaOrArray: // NOTE: this is necessarily an array - otherwise, the parent would be *Schema idx, err := strconv.Atoi(entry) if err != nil { return fmt.Errorf("%s not a number: %w", key[1:], err) } container.Schemas[idx] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} case spec.SchemaProperties: container[entry] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} // NOTE: can't have case *spec.SchemaOrBool = parent in this case is *Schema default: return fmt.Errorf("unhandled parent schema rewrite %s (%T)", key, pvalue) } return nil } // getPointerFromKey retrieves the content of the JSON pointer "key" func getPointerFromKey(sp interface{}, key string) (string, interface{}, error) { switch sp.(type) { case *spec.Schema: case *spec.Swagger: default: panic("unexpected type used in getPointerFromKey") } if key == "#/" { return "", sp, nil } // unescape chars in key, e.g. "{}" from path params pth, _ := url.PathUnescape(key[1:]) ptr, err := jsonpointer.New(pth) if err != nil { return "", nil, err } value, _, err := ptr.Get(sp) if err != nil { debugLog("error when getting key: %s with path: %s", key, pth) return "", nil, err } return pth, value, nil } // getParentFromKey retrieves the container of the JSON pointer "key" func getParentFromKey(sp interface{}, key string) (string, string, interface{}, error) { switch sp.(type) { case *spec.Schema: case *spec.Swagger: default: panic("unexpected type used in getPointerFromKey") } // unescape chars in key, e.g. "{}" from path params pth, _ := url.PathUnescape(key[1:]) parent, entry := path.Dir(pth), path.Base(pth) debugLog("getting schema holder at: %s, with entry: %s", parent, entry) pptr, err := jsonpointer.New(parent) if err != nil { return "", "", nil, err } pvalue, _, err := pptr.Get(sp) if err != nil { return "", "", nil, fmt.Errorf("can't get parent for %s: %w", parent, err) } return parent, entry, pvalue, nil } // UpdateRef replaces a ref by another one func UpdateRef(sp interface{}, key string, ref spec.Ref) error { switch sp.(type) { case *spec.Schema: case *spec.Swagger: default: panic("unexpected type used in getPointerFromKey") } debugLog("updating ref for %s with %s", key, ref.String()) pth, value, err := getPointerFromKey(sp, key) if err != nil { return err } switch refable := value.(type) { case *spec.Schema: refable.Ref = ref case *spec.SchemaOrArray: if refable.Schema != nil { refable.Schema.Ref = ref } case *spec.SchemaOrBool: if refable.Schema != nil { refable.Schema.Ref = ref } case spec.Schema: debugLog("rewriting holder for %T", refable) _, entry, pvalue, erp := getParentFromKey(sp, key) if erp != nil { return err } switch container := pvalue.(type) { case spec.Definitions: container[entry] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} case map[string]spec.Schema: container[entry] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} case []spec.Schema: idx, err := strconv.Atoi(entry) if err != nil { return fmt.Errorf("%s not a number: %w", pth, err) } container[idx] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} case *spec.SchemaOrArray: // NOTE: this is necessarily an array - otherwise, the parent would be *Schema idx, err := strconv.Atoi(entry) if err != nil { return fmt.Errorf("%s not a number: %w", pth, err) } container.Schemas[idx] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} case spec.SchemaProperties: container[entry] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} // NOTE: can't have case *spec.SchemaOrBool = parent in this case is *Schema default: return fmt.Errorf("unhandled container type at %s: %T", key, value) } default: return fmt.Errorf("no schema with ref found at %s for %T", key, value) } return nil } // UpdateRefWithSchema replaces a ref with a schema (i.e. re-inline schema) func UpdateRefWithSchema(sp *spec.Swagger, key string, sch *spec.Schema) error { debugLog("updating ref for %s with schema", key) pth, value, err := getPointerFromKey(sp, key) if err != nil { return err } switch refable := value.(type) { case *spec.Schema: *refable = *sch case spec.Schema: _, entry, pvalue, erp := getParentFromKey(sp, key) if erp != nil { return err } switch container := pvalue.(type) { case spec.Definitions: container[entry] = *sch case map[string]spec.Schema: container[entry] = *sch case []spec.Schema: idx, err := strconv.Atoi(entry) if err != nil { return fmt.Errorf("%s not a number: %w", pth, err) } container[idx] = *sch case *spec.SchemaOrArray: // NOTE: this is necessarily an array - otherwise, the parent would be *Schema idx, err := strconv.Atoi(entry) if err != nil { return fmt.Errorf("%s not a number: %w", pth, err) } container.Schemas[idx] = *sch case spec.SchemaProperties: container[entry] = *sch // NOTE: can't have case *spec.SchemaOrBool = parent in this case is *Schema default: return fmt.Errorf("unhandled type for parent of [%s]: %T", key, value) } case *spec.SchemaOrArray: *refable.Schema = *sch // NOTE: can't have case *spec.SchemaOrBool = parent in this case is *Schema case *spec.SchemaOrBool: *refable.Schema = *sch default: return fmt.Errorf("no schema with ref found at %s for %T", key, value) } return nil } // DeepestRefResult holds the results from DeepestRef analysis type DeepestRefResult struct { Ref spec.Ref Schema *spec.Schema Warnings []string } // DeepestRef finds the first definition ref, from a cascade of nested refs which are not definitions. // - if no definition is found, returns the deepest ref. // - pointers to external files are expanded // // NOTE: all external $ref's are assumed to be already expanded at this stage. func DeepestRef(sp *spec.Swagger, opts *spec.ExpandOptions, ref spec.Ref) (*DeepestRefResult, error) { if !ref.HasFragmentOnly { // we found an external $ref, which is odd at this stage: // do nothing on external $refs return &DeepestRefResult{Ref: ref}, nil } currentRef := ref visited := make(map[string]bool, 64) warnings := make([]string, 0, 2) DOWNREF: for currentRef.String() != "" { if path.Dir(currentRef.String()) == definitionsPath { // this is a top-level definition: stop here and return this ref return &DeepestRefResult{Ref: currentRef}, nil } if _, beenThere := visited[currentRef.String()]; beenThere { return nil, fmt.Errorf("cannot resolve cyclic chain of pointers under %s", currentRef.String()) } visited[currentRef.String()] = true value, _, err := currentRef.GetPointer().Get(sp) if err != nil { return nil, err } switch refable := value.(type) { case *spec.Schema: if refable.Ref.String() == "" { break DOWNREF } currentRef = refable.Ref case spec.Schema: if refable.Ref.String() == "" { break DOWNREF } currentRef = refable.Ref case *spec.SchemaOrArray: if refable.Schema == nil || refable.Schema != nil && refable.Schema.Ref.String() == "" { break DOWNREF } currentRef = refable.Schema.Ref case *spec.SchemaOrBool: if refable.Schema == nil || refable.Schema != nil && refable.Schema.Ref.String() == "" { break DOWNREF } currentRef = refable.Schema.Ref case spec.Response: // a pointer points to a schema initially marshalled in responses section... // Attempt to convert this to a schema. If this fails, the spec is invalid asJSON, _ := refable.MarshalJSON() var asSchema spec.Schema err := asSchema.UnmarshalJSON(asJSON) if err != nil { return nil, fmt.Errorf("invalid type for resolved JSON pointer %s. Expected a schema a, got: %T", currentRef.String(), value) } warnings = append(warnings, fmt.Sprintf("found $ref %q (response) interpreted as schema", currentRef.String())) if asSchema.Ref.String() == "" { break DOWNREF } currentRef = asSchema.Ref case spec.Parameter: // a pointer points to a schema initially marshalled in parameters section... // Attempt to convert this to a schema. If this fails, the spec is invalid asJSON, _ := refable.MarshalJSON() var asSchema spec.Schema if err := asSchema.UnmarshalJSON(asJSON); err != nil { return nil, fmt.Errorf("invalid type for resolved JSON pointer %s. Expected a schema a, got: %T", currentRef.String(), value) } warnings = append(warnings, fmt.Sprintf("found $ref %q (parameter) interpreted as schema", currentRef.String())) if asSchema.Ref.String() == "" { break DOWNREF } currentRef = asSchema.Ref default: return nil, fmt.Errorf("unhandled type to resolve JSON pointer %s. Expected a Schema, got: %T", currentRef.String(), value) } } // assess what schema we're ending with sch, erv := spec.ResolveRefWithBase(sp, ¤tRef, opts) if erv != nil { return nil, erv } if sch == nil { return nil, fmt.Errorf("no schema found at %s", currentRef.String()) } return &DeepestRefResult{Ref: currentRef, Schema: sch, Warnings: warnings}, nil } analysis-0.21.1/internal/flatten/replace/replace_test.go000066400000000000000000000103341413705513100233040ustar00rootroot00000000000000package replace import ( "path/filepath" "testing" "github.com/go-openapi/analysis/internal/antest" "github.com/go-openapi/jsonpointer" "github.com/go-openapi/spec" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) var refFixtures = []struct { Key string Ref spec.Ref }{ {"#/parameters/someParam/schema", spec.MustCreateRef("#/definitions/record")}, {"#/paths/~1some~1where~1{id}/parameters/1/schema", spec.MustCreateRef("#/definitions/record")}, {"#/paths/~1some~1where~1{id}/get/parameters/2/schema", spec.MustCreateRef("#/definitions/record")}, {"#/responses/someResponse/schema", spec.MustCreateRef("#/definitions/record")}, {"#/paths/~1some~1where~1{id}/get/responses/default/schema", spec.MustCreateRef("#/definitions/record")}, {"#/paths/~1some~1where~1{id}/get/responses/200/schema", spec.MustCreateRef("#/definitions/record")}, {"#/definitions/namedAgain", spec.MustCreateRef("#/definitions/named")}, {"#/definitions/datedTag/allOf/1", spec.MustCreateRef("#/definitions/tag")}, {"#/definitions/datedRecords/items/1", spec.MustCreateRef("#/definitions/record")}, {"#/definitions/datedTaggedRecords/items/1", spec.MustCreateRef("#/definitions/record")}, {"#/definitions/datedTaggedRecords/additionalItems", spec.MustCreateRef("#/definitions/tag")}, {"#/definitions/otherRecords/items", spec.MustCreateRef("#/definitions/record")}, {"#/definitions/tags/additionalProperties", spec.MustCreateRef("#/definitions/tag")}, {"#/definitions/namedThing/properties/name", spec.MustCreateRef("#/definitions/named")}, } func TestUpdateRef(t *testing.T) { t.Parallel() bp := filepath.Join("..", "..", "..", "fixtures", "external_definitions.yml") sp := antest.LoadOrFail(t, bp) for _, v := range refFixtures { err := UpdateRef(sp, v.Key, v.Ref) require.NoError(t, err) ptr, err := jsonpointer.New(v.Key[1:]) require.NoError(t, err) vv, _, err := ptr.Get(sp) require.NoError(t, err) switch tv := vv.(type) { case *spec.Schema: assert.Equal(t, v.Ref.String(), tv.Ref.String()) case spec.Schema: assert.Equal(t, v.Ref.String(), tv.Ref.String()) case *spec.SchemaOrBool: assert.Equal(t, v.Ref.String(), tv.Schema.Ref.String()) case *spec.SchemaOrArray: assert.Equal(t, v.Ref.String(), tv.Schema.Ref.String()) default: assert.Fail(t, "unknown type", "got %T", vv) } } } func TestRewriteSchemaRef(t *testing.T) { t.Parallel() bp := filepath.Join("..", "..", "..", "fixtures", "inline_schemas.yml") sp := antest.LoadOrFail(t, bp) for i, v := range refFixtures { err := RewriteSchemaToRef(sp, v.Key, v.Ref) require.NoError(t, err) ptr, err := jsonpointer.New(v.Key[1:]) require.NoError(t, err) vv, _, err := ptr.Get(sp) require.NoError(t, err) switch tv := vv.(type) { case *spec.Schema: assert.Equal(t, v.Ref.String(), tv.Ref.String(), "at %d for %s", i, v.Key) case spec.Schema: assert.Equal(t, v.Ref.String(), tv.Ref.String(), "at %d for %s", i, v.Key) case *spec.SchemaOrBool: assert.Equal(t, v.Ref.String(), tv.Schema.Ref.String(), "at %d for %s", i, v.Key) case *spec.SchemaOrArray: assert.Equal(t, v.Ref.String(), tv.Schema.Ref.String(), "at %d for %s", i, v.Key) default: assert.Fail(t, "unknown type", "got %T", vv) } } } func TestReplace_ErrorHandling(t *testing.T) { t.Parallel() const wantedFailure = "Expected a failure" bp := filepath.Join("..", "..", "..", "fixtures", "errors", "fixture-unexpandable-2.yaml") // reload original spec sp := antest.LoadOrFail(t, bp) require.Errorf(t, RewriteSchemaToRef(sp, "#/invalidPointer/key", spec.Ref{}), wantedFailure) require.Errorf(t, rewriteParentRef(sp, "#/invalidPointer/key", spec.Ref{}), wantedFailure) require.Errorf(t, UpdateRef(sp, "#/invalidPointer/key", spec.Ref{}), wantedFailure) require.Errorf(t, UpdateRefWithSchema(sp, "#/invalidPointer/key", &spec.Schema{}), wantedFailure) _, _, err := getPointerFromKey(sp, "#/invalidPointer/key") require.Errorf(t, err, wantedFailure) _, _, err = getPointerFromKey(sp, "--->#/invalidJsonPointer") require.Errorf(t, err, wantedFailure) _, _, _, err = getParentFromKey(sp, "#/invalidPointer/key") require.Errorf(t, err, wantedFailure) _, _, _, err = getParentFromKey(sp, "--->#/invalidJsonPointer") require.Errorf(t, err, wantedFailure) } analysis-0.21.1/internal/flatten/schutils/000077500000000000000000000000001413705513100205255ustar00rootroot00000000000000analysis-0.21.1/internal/flatten/schutils/flatten_schema.go000066400000000000000000000011421413705513100240270ustar00rootroot00000000000000// Package schutils provides tools to save or clone a schema // when flattening a spec. package schutils import ( "github.com/go-openapi/spec" "github.com/go-openapi/swag" ) // Save registers a schema as an entry in spec #/definitions func Save(sp *spec.Swagger, name string, schema *spec.Schema) { if schema == nil { return } if sp.Definitions == nil { sp.Definitions = make(map[string]spec.Schema, 150) } sp.Definitions[name] = *schema } // Clone deep-clones a schema func Clone(schema *spec.Schema) *spec.Schema { var sch spec.Schema _ = swag.FromDynamicJSON(schema, &sch) return &sch } analysis-0.21.1/internal/flatten/schutils/flatten_schema_test.go000066400000000000000000000010671413705513100250740ustar00rootroot00000000000000package schutils import ( "testing" _ "github.com/go-openapi/analysis/internal/antest" "github.com/go-openapi/spec" "github.com/stretchr/testify/assert" ) func TestFlattenSchema_Save(t *testing.T) { t.Parallel() sp := &spec.Swagger{} Save(sp, "theName", spec.StringProperty()) assert.Contains(t, sp.Definitions, "theName") saveNilSchema := func() { Save(sp, "ThisNilSchema", nil) } assert.NotPanics(t, saveNilSchema) } func TestFlattenSchema_Clone(t *testing.T) { sch := spec.RefSchema("#/definitions/x") assert.EqualValues(t, sch, Clone(sch)) } analysis-0.21.1/internal/flatten/sortref/000077500000000000000000000000001413705513100203535ustar00rootroot00000000000000analysis-0.21.1/internal/flatten/sortref/keys.go000066400000000000000000000116561413705513100216660ustar00rootroot00000000000000package sortref import ( "net/http" "path" "strconv" "strings" "github.com/go-openapi/jsonpointer" "github.com/go-openapi/spec" ) const ( paths = "paths" responses = "responses" parameters = "parameters" definitions = "definitions" ) var ( ignoredKeys map[string]struct{} validMethods map[string]struct{} ) func init() { ignoredKeys = map[string]struct{}{ "schema": {}, "properties": {}, "not": {}, "anyOf": {}, "oneOf": {}, } validMethods = map[string]struct{}{ "GET": {}, "HEAD": {}, "OPTIONS": {}, "PATCH": {}, "POST": {}, "PUT": {}, "DELETE": {}, } } // Key represent a key item constructed from /-separated segments type Key struct { Segments int Key string } // Keys is a sortable collable collection of Keys type Keys []Key func (k Keys) Len() int { return len(k) } func (k Keys) Swap(i, j int) { k[i], k[j] = k[j], k[i] } func (k Keys) Less(i, j int) bool { return k[i].Segments > k[j].Segments || (k[i].Segments == k[j].Segments && k[i].Key < k[j].Key) } // KeyParts construct a SplitKey with all its /-separated segments decomposed. It is sortable. func KeyParts(key string) SplitKey { var res []string for _, part := range strings.Split(key[1:], "/") { if part != "" { res = append(res, jsonpointer.Unescape(part)) } } return res } // SplitKey holds of the parts of a /-separated key, soi that their location may be determined. type SplitKey []string // IsDefinition is true when the split key is in the #/definitions section of a spec func (s SplitKey) IsDefinition() bool { return len(s) > 1 && s[0] == definitions } // DefinitionName yields the name of the definition func (s SplitKey) DefinitionName() string { if !s.IsDefinition() { return "" } return s[1] } func (s SplitKey) isKeyName(i int) bool { if i <= 0 { return false } count := 0 for idx := i - 1; idx > 0; idx-- { if s[idx] != "properties" { break } count++ } return count%2 != 0 } // PartAdder know how to construct the components of a new name type PartAdder func(string) []string // BuildName builds a name from segments func (s SplitKey) BuildName(segments []string, startIndex int, adder PartAdder) string { for i, part := range s[startIndex:] { if _, ignored := ignoredKeys[part]; !ignored || s.isKeyName(startIndex+i) { segments = append(segments, adder(part)...) } } return strings.Join(segments, " ") } // IsOperation is true when the split key is in the operations section func (s SplitKey) IsOperation() bool { return len(s) > 1 && s[0] == paths } // IsSharedOperationParam is true when the split key is in the parameters section of a path func (s SplitKey) IsSharedOperationParam() bool { return len(s) > 2 && s[0] == paths && s[2] == parameters } // IsSharedParam is true when the split key is in the #/parameters section of a spec func (s SplitKey) IsSharedParam() bool { return len(s) > 1 && s[0] == parameters } // IsOperationParam is true when the split key is in the parameters section of an operation func (s SplitKey) IsOperationParam() bool { return len(s) > 3 && s[0] == paths && s[3] == parameters } // IsOperationResponse is true when the split key is in the responses section of an operation func (s SplitKey) IsOperationResponse() bool { return len(s) > 3 && s[0] == paths && s[3] == responses } // IsSharedResponse is true when the split key is in the #/responses section of a spec func (s SplitKey) IsSharedResponse() bool { return len(s) > 1 && s[0] == responses } // IsDefaultResponse is true when the split key is the default response for an operation func (s SplitKey) IsDefaultResponse() bool { return len(s) > 4 && s[0] == paths && s[3] == responses && s[4] == "default" } // IsStatusCodeResponse is true when the split key is an operation response with a status code func (s SplitKey) IsStatusCodeResponse() bool { isInt := func() bool { _, err := strconv.Atoi(s[4]) return err == nil } return len(s) > 4 && s[0] == paths && s[3] == responses && isInt() } // ResponseName yields either the status code or "Default" for a response func (s SplitKey) ResponseName() string { if s.IsStatusCodeResponse() { code, _ := strconv.Atoi(s[4]) return http.StatusText(code) } if s.IsDefaultResponse() { return "Default" } return "" } // PathItemRef constructs a $ref object from a split key of the form /{path}/{method} func (s SplitKey) PathItemRef() spec.Ref { if len(s) < 3 { return spec.Ref{} } pth, method := s[1], s[2] if _, isValidMethod := validMethods[strings.ToUpper(method)]; !isValidMethod && !strings.HasPrefix(method, "x-") { return spec.Ref{} } return spec.MustCreateRef("#" + path.Join("/", paths, jsonpointer.Escape(pth), strings.ToUpper(method))) } // PathRef constructs a $ref object from a split key of the form /paths/{reference} func (s SplitKey) PathRef() spec.Ref { if !s.IsOperation() { return spec.Ref{} } return spec.MustCreateRef("#" + path.Join("/", paths, jsonpointer.Escape(s[1]))) } analysis-0.21.1/internal/flatten/sortref/keys_test.go000066400000000000000000000005331413705513100227150ustar00rootroot00000000000000package sortref import ( "testing" "github.com/stretchr/testify/assert" ) func TestName_UnitGuards(t *testing.T) { t.Parallel() parts := KeyParts("#/nowhere/arbitrary/pointer") res := parts.DefinitionName() assert.Equal(t, "", res) res = parts.ResponseName() assert.Equal(t, "", res) b := parts.isKeyName(-1) assert.False(t, b) } analysis-0.21.1/internal/flatten/sortref/sort_ref.go000066400000000000000000000062121413705513100225260ustar00rootroot00000000000000package sortref import ( "reflect" "sort" "strings" "github.com/go-openapi/analysis/internal/flatten/normalize" "github.com/go-openapi/spec" ) var depthGroupOrder = []string{ "sharedParam", "sharedResponse", "sharedOpParam", "opParam", "codeResponse", "defaultResponse", "definition", } type mapIterator struct { len int mapIter *reflect.MapIter } func (i *mapIterator) Next() bool { return i.mapIter.Next() } func (i *mapIterator) Len() int { return i.len } func (i *mapIterator) Key() string { return i.mapIter.Key().String() } func mustMapIterator(anyMap interface{}) *mapIterator { val := reflect.ValueOf(anyMap) return &mapIterator{mapIter: val.MapRange(), len: val.Len()} } // DepthFirst sorts a map of anything. It groups keys by category // (shared params, op param, statuscode response, default response, definitions) // sort groups internally by number of parts in the key and lexical names // flatten groups into a single list of keys func DepthFirst(in interface{}) []string { iterator := mustMapIterator(in) sorted := make([]string, 0, iterator.Len()) grouped := make(map[string]Keys, iterator.Len()) for iterator.Next() { k := iterator.Key() split := KeyParts(k) var pk string if split.IsSharedOperationParam() { pk = "sharedOpParam" } if split.IsOperationParam() { pk = "opParam" } if split.IsStatusCodeResponse() { pk = "codeResponse" } if split.IsDefaultResponse() { pk = "defaultResponse" } if split.IsDefinition() { pk = "definition" } if split.IsSharedParam() { pk = "sharedParam" } if split.IsSharedResponse() { pk = "sharedResponse" } grouped[pk] = append(grouped[pk], Key{Segments: len(split), Key: k}) } for _, pk := range depthGroupOrder { res := grouped[pk] sort.Sort(res) for _, v := range res { sorted = append(sorted, v.Key) } } return sorted } // topMostRefs is able to sort refs by hierarchical then lexicographic order, // yielding refs ordered breadth-first. type topmostRefs []string func (k topmostRefs) Len() int { return len(k) } func (k topmostRefs) Swap(i, j int) { k[i], k[j] = k[j], k[i] } func (k topmostRefs) Less(i, j int) bool { li, lj := len(strings.Split(k[i], "/")), len(strings.Split(k[j], "/")) if li == lj { return k[i] < k[j] } return li < lj } // TopmostFirst sorts references by depth func TopmostFirst(refs []string) []string { res := topmostRefs(refs) sort.Sort(res) return res } // RefRevIdx is a reverse index for references type RefRevIdx struct { Ref spec.Ref Keys []string } // ReverseIndex builds a reverse index for references in schemas func ReverseIndex(schemas map[string]spec.Ref, basePath string) map[string]RefRevIdx { collected := make(map[string]RefRevIdx) for key, schRef := range schemas { // normalize paths before sorting, // so we get together keys that are from the same external file normalizedPath := normalize.Path(schRef, basePath) entry, ok := collected[normalizedPath] if ok { entry.Keys = append(entry.Keys, key) collected[normalizedPath] = entry continue } collected[normalizedPath] = RefRevIdx{ Ref: schRef, Keys: []string{key}, } } return collected } analysis-0.21.1/internal/flatten/sortref/sort_ref_test.go000066400000000000000000000133051413705513100235660ustar00rootroot00000000000000package sortref import ( "testing" _ "github.com/go-openapi/analysis/internal/antest" "github.com/stretchr/testify/assert" ) func TestSortRef_DepthFirstSort(t *testing.T) { values := []string{ "#/definitions/datedTag/allOf/0", "#/definitions/pneumonoultramicroscopicsilicovolcanoconiosisAntidisestablishmentarianism", "#/definitions/namedThing", "#/definitions/datedTag/properties/id", "#/paths/~1some~1where~1{id}/get/responses/200/schema", "#/definitions/tags/additionalProperties/properties/id", "#/parameters/someParam/schema", "#/definitions/records/items/0/properties/createdAt", "#/definitions/datedTaggedRecords", "#/paths/~1some~1where~1{id}/get/responses/default/schema/properties/createdAt", "#/definitions/namedAgain", "#/definitions/tags", "#/paths/~1some~1where~1{id}/get/responses/404/schema", "#/definitions/datedRecords/items/1", "#/definitions/records/items/0", "#/definitions/datedTaggedRecords/items/0", "#/definitions/datedTag/allOf/1", "#/definitions/otherRecords/items/properties/createdAt", "#/responses/someResponse/schema/properties/createdAt", "#/definitions/namedAgain/properties/id", "#/definitions/datedTag", "#/paths/~1some~1where~1{id}/parameters/1/schema", "#/parameters/someParam/schema/properties/createdAt", "#/paths/~1some~1where~1{id}/get/parameters/2/schema/properties/createdAt", "#/definitions/otherRecords", "#/definitions/datedTaggedRecords/items/1", "#/definitions/datedTaggedRecords/items/1/properties/createdAt", "#/definitions/otherRecords/items", "#/definitions/datedRecords/items/0", "#/paths/~1some~1where~1{id}/get/responses/200/schema/properties/id", "#/paths/~1some~1where~1{id}/get/responses/200/schema/properties/value", "#/definitions/records", "#/definitions/namedThing/properties/name/properties/id", "#/definitions/datedTaggedRecords/additionalItems/properties/id", "#/definitions/datedTaggedRecords/additionalItems/properties/value", "#/definitions/datedRecords", "#/definitions/datedTag/properties/value", "#/definitions/pneumonoultramicroscopicsilicovolcanoconiosisAntidisestablishmentarianism/properties/floccinaucinihilipilificationCreatedAt", "#/definitions/datedRecords/items/1/properties/createdAt", "#/definitions/tags/additionalProperties", "#/paths/~1some~1where~1{id}/parameters/1/schema/properties/createdAt", "#/definitions/namedThing/properties/name", "#/paths/~1some~1where~1{id}/get/responses/default/schema", "#/definitions/tags/additionalProperties/properties/value", "#/responses/someResponse/schema", "#/definitions/datedTaggedRecords/additionalItems", "#/paths/~1some~1where~1{id}/get/parameters/2/schema", } valuesMap := make(map[string]struct{}, len(values)) for _, v := range values { valuesMap[v] = struct{}{} } expected := []string{ // Added shared parameters and responses "#/parameters/someParam/schema/properties/createdAt", "#/parameters/someParam/schema", "#/responses/someResponse/schema/properties/createdAt", "#/responses/someResponse/schema", "#/paths/~1some~1where~1{id}/parameters/1/schema/properties/createdAt", "#/paths/~1some~1where~1{id}/parameters/1/schema", "#/paths/~1some~1where~1{id}/get/parameters/2/schema/properties/createdAt", "#/paths/~1some~1where~1{id}/get/parameters/2/schema", "#/paths/~1some~1where~1{id}/get/responses/200/schema/properties/id", "#/paths/~1some~1where~1{id}/get/responses/200/schema/properties/value", "#/paths/~1some~1where~1{id}/get/responses/200/schema", "#/paths/~1some~1where~1{id}/get/responses/404/schema", "#/paths/~1some~1where~1{id}/get/responses/default/schema/properties/createdAt", "#/paths/~1some~1where~1{id}/get/responses/default/schema", "#/definitions/datedRecords/items/1/properties/createdAt", "#/definitions/datedTaggedRecords/items/1/properties/createdAt", "#/definitions/namedThing/properties/name/properties/id", "#/definitions/records/items/0/properties/createdAt", "#/definitions/datedTaggedRecords/additionalItems/properties/id", "#/definitions/datedTaggedRecords/additionalItems/properties/value", "#/definitions/otherRecords/items/properties/createdAt", "#/definitions/tags/additionalProperties/properties/id", "#/definitions/tags/additionalProperties/properties/value", "#/definitions/datedRecords/items/0", "#/definitions/datedRecords/items/1", "#/definitions/datedTag/allOf/0", "#/definitions/datedTag/allOf/1", "#/definitions/datedTag/properties/id", "#/definitions/datedTag/properties/value", "#/definitions/datedTaggedRecords/items/0", "#/definitions/datedTaggedRecords/items/1", "#/definitions/namedAgain/properties/id", "#/definitions/namedThing/properties/name", "#/definitions/pneumonoultramicroscopicsilicovolcanoconiosisAntidisestablishmentarianism/properties/" + "floccinaucinihilipilificationCreatedAt", "#/definitions/records/items/0", "#/definitions/datedTaggedRecords/additionalItems", "#/definitions/otherRecords/items", "#/definitions/tags/additionalProperties", "#/definitions/datedRecords", "#/definitions/datedTag", "#/definitions/datedTaggedRecords", "#/definitions/namedAgain", "#/definitions/namedThing", "#/definitions/otherRecords", "#/definitions/pneumonoultramicroscopicsilicovolcanoconiosisAntidisestablishmentarianism", "#/definitions/records", "#/definitions/tags", } assert.Equal(t, expected, DepthFirst(valuesMap)) } func TestSortRef_TopmostFirst(t *testing.T) { t.Parallel() assert.Equal(t, []string{"/a/b", "/a/b/c"}, TopmostFirst([]string{"/a/b/c", "/a/b"}), ) assert.Equal(t, []string{"/a/b", "/a/c"}, TopmostFirst([]string{"/a/c", "/a/b"}), ) assert.Equal(t, []string{"/a/b", "/a/c", "/a/b/c", "/a/b/d", "/a/a/b/d"}, TopmostFirst([]string{"/a/a/b/d", "/a/b", "/a/b/c", "/a/b/d", "/a/c"}), ) } analysis-0.21.1/mixin.go000066400000000000000000000300401413705513100150660ustar00rootroot00000000000000// Copyright 2015 go-swagger maintainers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package analysis import ( "fmt" "reflect" "github.com/go-openapi/spec" ) // Mixin modifies the primary swagger spec by adding the paths and // definitions from the mixin specs. Top level parameters and // responses from the mixins are also carried over. Operation id // collisions are avoided by appending "Mixin" but only if // needed. // // The following parts of primary are subject to merge, filling empty details // - Info // - BasePath // - Host // - ExternalDocs // // Consider calling FixEmptyResponseDescriptions() on the modified primary // if you read them from storage and they are valid to start with. // // Entries in "paths", "definitions", "parameters" and "responses" are // added to the primary in the order of the given mixins. If the entry // already exists in primary it is skipped with a warning message. // // The count of skipped entries (from collisions) is returned so any // deviation from the number expected can flag a warning in your build // scripts. Carefully review the collisions before accepting them; // consider renaming things if possible. // // No key normalization takes place (paths, type defs, // etc). Ensure they are canonical if your downstream tools do // key normalization of any form. // // Merging schemes (http, https), and consumers/producers do not account for // collisions. func Mixin(primary *spec.Swagger, mixins ...*spec.Swagger) []string { skipped := make([]string, 0, len(mixins)) opIds := getOpIds(primary) initPrimary(primary) for i, m := range mixins { skipped = append(skipped, mergeSwaggerProps(primary, m)...) skipped = append(skipped, mergeConsumes(primary, m)...) skipped = append(skipped, mergeProduces(primary, m)...) skipped = append(skipped, mergeTags(primary, m)...) skipped = append(skipped, mergeSchemes(primary, m)...) skipped = append(skipped, mergeSecurityDefinitions(primary, m)...) skipped = append(skipped, mergeSecurityRequirements(primary, m)...) skipped = append(skipped, mergeDefinitions(primary, m)...) // merging paths requires a map of operationIDs to work with skipped = append(skipped, mergePaths(primary, m, opIds, i)...) skipped = append(skipped, mergeParameters(primary, m)...) skipped = append(skipped, mergeResponses(primary, m)...) } return skipped } // getOpIds extracts all the paths..operationIds from the given // spec and returns them as the keys in a map with 'true' values. func getOpIds(s *spec.Swagger) map[string]bool { rv := make(map[string]bool) if s.Paths == nil { return rv } for _, v := range s.Paths.Paths { piops := pathItemOps(v) for _, op := range piops { rv[op.ID] = true } } return rv } func pathItemOps(p spec.PathItem) []*spec.Operation { var rv []*spec.Operation rv = appendOp(rv, p.Get) rv = appendOp(rv, p.Put) rv = appendOp(rv, p.Post) rv = appendOp(rv, p.Delete) rv = appendOp(rv, p.Head) rv = appendOp(rv, p.Patch) return rv } func appendOp(ops []*spec.Operation, op *spec.Operation) []*spec.Operation { if op == nil { return ops } return append(ops, op) } func mergeSecurityDefinitions(primary *spec.Swagger, m *spec.Swagger) (skipped []string) { for k, v := range m.SecurityDefinitions { if _, exists := primary.SecurityDefinitions[k]; exists { warn := fmt.Sprintf( "SecurityDefinitions entry '%v' already exists in primary or higher priority mixin, skipping\n", k) skipped = append(skipped, warn) continue } primary.SecurityDefinitions[k] = v } return } func mergeSecurityRequirements(primary *spec.Swagger, m *spec.Swagger) (skipped []string) { for _, v := range m.Security { found := false for _, vv := range primary.Security { if reflect.DeepEqual(v, vv) { found = true break } } if found { warn := fmt.Sprintf( "Security requirement: '%v' already exists in primary or higher priority mixin, skipping\n", v) skipped = append(skipped, warn) continue } primary.Security = append(primary.Security, v) } return } func mergeDefinitions(primary *spec.Swagger, m *spec.Swagger) (skipped []string) { for k, v := range m.Definitions { // assume name collisions represent IDENTICAL type. careful. if _, exists := primary.Definitions[k]; exists { warn := fmt.Sprintf( "definitions entry '%v' already exists in primary or higher priority mixin, skipping\n", k) skipped = append(skipped, warn) continue } primary.Definitions[k] = v } return } func mergePaths(primary *spec.Swagger, m *spec.Swagger, opIds map[string]bool, mixIndex int) (skipped []string) { if m.Paths != nil { for k, v := range m.Paths.Paths { if _, exists := primary.Paths.Paths[k]; exists { warn := fmt.Sprintf( "paths entry '%v' already exists in primary or higher priority mixin, skipping\n", k) skipped = append(skipped, warn) continue } // Swagger requires that operationIds be // unique within a spec. If we find a // collision we append "Mixin0" to the // operatoinId we are adding, where 0 is mixin // index. We assume that operationIds with // all the proivded specs are already unique. piops := pathItemOps(v) for _, piop := range piops { if opIds[piop.ID] { piop.ID = fmt.Sprintf("%v%v%v", piop.ID, "Mixin", mixIndex) } opIds[piop.ID] = true } primary.Paths.Paths[k] = v } } return } func mergeParameters(primary *spec.Swagger, m *spec.Swagger) (skipped []string) { for k, v := range m.Parameters { // could try to rename on conflict but would // have to fix $refs in the mixin. Complain // for now if _, exists := primary.Parameters[k]; exists { warn := fmt.Sprintf( "top level parameters entry '%v' already exists in primary or higher priority mixin, skipping\n", k) skipped = append(skipped, warn) continue } primary.Parameters[k] = v } return } func mergeResponses(primary *spec.Swagger, m *spec.Swagger) (skipped []string) { for k, v := range m.Responses { // could try to rename on conflict but would // have to fix $refs in the mixin. Complain // for now if _, exists := primary.Responses[k]; exists { warn := fmt.Sprintf( "top level responses entry '%v' already exists in primary or higher priority mixin, skipping\n", k) skipped = append(skipped, warn) continue } primary.Responses[k] = v } return skipped } func mergeConsumes(primary *spec.Swagger, m *spec.Swagger) []string { for _, v := range m.Consumes { found := false for _, vv := range primary.Consumes { if v == vv { found = true break } } if found { // no warning here: we just skip it continue } primary.Consumes = append(primary.Consumes, v) } return []string{} } func mergeProduces(primary *spec.Swagger, m *spec.Swagger) []string { for _, v := range m.Produces { found := false for _, vv := range primary.Produces { if v == vv { found = true break } } if found { // no warning here: we just skip it continue } primary.Produces = append(primary.Produces, v) } return []string{} } func mergeTags(primary *spec.Swagger, m *spec.Swagger) (skipped []string) { for _, v := range m.Tags { found := false for _, vv := range primary.Tags { if v.Name == vv.Name { found = true break } } if found { warn := fmt.Sprintf( "top level tags entry with name '%v' already exists in primary or higher priority mixin, skipping\n", v.Name, ) skipped = append(skipped, warn) continue } primary.Tags = append(primary.Tags, v) } return } func mergeSchemes(primary *spec.Swagger, m *spec.Swagger) []string { for _, v := range m.Schemes { found := false for _, vv := range primary.Schemes { if v == vv { found = true break } } if found { // no warning here: we just skip it continue } primary.Schemes = append(primary.Schemes, v) } return []string{} } func mergeSwaggerProps(primary *spec.Swagger, m *spec.Swagger) []string { var skipped, skippedInfo, skippedDocs []string primary.Extensions, skipped = mergeExtensions(primary.Extensions, m.Extensions) // merging details in swagger top properties if primary.Host == "" { primary.Host = m.Host } if primary.BasePath == "" { primary.BasePath = m.BasePath } if primary.Info == nil { primary.Info = m.Info } else if m.Info != nil { skippedInfo = mergeInfo(primary.Info, m.Info) skipped = append(skipped, skippedInfo...) } if primary.ExternalDocs == nil { primary.ExternalDocs = m.ExternalDocs } else if m != nil { skippedDocs = mergeExternalDocs(primary.ExternalDocs, m.ExternalDocs) skipped = append(skipped, skippedDocs...) } return skipped } // nolint: unparam func mergeExternalDocs(primary *spec.ExternalDocumentation, m *spec.ExternalDocumentation) []string { if primary.Description == "" { primary.Description = m.Description } if primary.URL == "" { primary.URL = m.URL } return nil } func mergeInfo(primary *spec.Info, m *spec.Info) []string { var sk, skipped []string primary.Extensions, sk = mergeExtensions(primary.Extensions, m.Extensions) skipped = append(skipped, sk...) if primary.Description == "" { primary.Description = m.Description } if primary.Title == "" { primary.Description = m.Description } if primary.TermsOfService == "" { primary.TermsOfService = m.TermsOfService } if primary.Version == "" { primary.Version = m.Version } if primary.Contact == nil { primary.Contact = m.Contact } else if m.Contact != nil { var csk []string primary.Contact.Extensions, csk = mergeExtensions(primary.Contact.Extensions, m.Contact.Extensions) skipped = append(skipped, csk...) if primary.Contact.Name == "" { primary.Contact.Name = m.Contact.Name } if primary.Contact.URL == "" { primary.Contact.URL = m.Contact.URL } if primary.Contact.Email == "" { primary.Contact.Email = m.Contact.Email } } if primary.License == nil { primary.License = m.License } else if m.License != nil { var lsk []string primary.License.Extensions, lsk = mergeExtensions(primary.License.Extensions, m.License.Extensions) skipped = append(skipped, lsk...) if primary.License.Name == "" { primary.License.Name = m.License.Name } if primary.License.URL == "" { primary.License.URL = m.License.URL } } return skipped } func mergeExtensions(primary spec.Extensions, m spec.Extensions) (result spec.Extensions, skipped []string) { if primary == nil { result = m return } if m == nil { result = primary return } result = primary for k, v := range m { if _, found := primary[k]; found { skipped = append(skipped, k) continue } primary[k] = v } return } func initPrimary(primary *spec.Swagger) { if primary.SecurityDefinitions == nil { primary.SecurityDefinitions = make(map[string]*spec.SecurityScheme) } if primary.Security == nil { primary.Security = make([]map[string][]string, 0, 10) } if primary.Produces == nil { primary.Produces = make([]string, 0, 10) } if primary.Consumes == nil { primary.Consumes = make([]string, 0, 10) } if primary.Tags == nil { primary.Tags = make([]spec.Tag, 0, 10) } if primary.Schemes == nil { primary.Schemes = make([]string, 0, 10) } if primary.Paths == nil { primary.Paths = &spec.Paths{Paths: make(map[string]spec.PathItem)} } if primary.Paths.Paths == nil { primary.Paths.Paths = make(map[string]spec.PathItem) } if primary.Definitions == nil { primary.Definitions = make(spec.Definitions) } if primary.Parameters == nil { primary.Parameters = make(map[string]spec.Parameter) } if primary.Responses == nil { primary.Responses = make(map[string]spec.Response) } } analysis-0.21.1/mixin_test.go000066400000000000000000000076521413705513100161420ustar00rootroot00000000000000// Copyright 2015 go-swagger maintainers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package analysis import ( "testing" "github.com/go-openapi/analysis/internal/antest" "github.com/stretchr/testify/require" ) const ( widgetFile = "fixtures/widget-crud.yml" fooFile = "fixtures/foo-crud.yml" barFile = "fixtures/bar-crud.yml" noPathsFile = "fixtures/no-paths.yml" emptyPathsFile = "fixtures/empty-paths.json" securityFile = "fixtures/securitydef.yml" otherMixin = "fixtures/other-mixin.yml" emptyProps = "fixtures/empty-props.yml" swaggerProps = "fixtures/swagger-props.yml" ) func TestMixin_All(t *testing.T) { t.Parallel() primary := antest.LoadOrFail(t, widgetFile) mixin1 := antest.LoadOrFail(t, fooFile) mixin2 := antest.LoadOrFail(t, barFile) mixin3 := antest.LoadOrFail(t, noPathsFile) mixin4 := antest.LoadOrFail(t, securityFile) mixin5 := antest.LoadOrFail(t, otherMixin) collisions := Mixin(primary, mixin1, mixin2, mixin3, mixin4, mixin5) require.Lenf(t, collisions, 19, "TestMixin: Expected 19 collisions, got %v\n%v", len(collisions), collisions) require.Lenf(t, primary.Paths.Paths, 7, "TestMixin: Expected 7 paths in merged, got %v\n", len(primary.Paths.Paths)) require.Lenf(t, primary.Definitions, 8, "TestMixin: Expected 8 definitions in merged, got %v\n", len(primary.Definitions)) require.Lenf(t, primary.Parameters, 4, "TestMixin: Expected 4 top level parameters in merged, got %v\n", len(primary.Parameters)) require.Lenf(t, primary.Responses, 2, "TestMixin: Expected 2 top level responses in merged, got %v\n", len(primary.Responses)) require.Lenf(t, primary.SecurityDefinitions, 5, "TestMixin: Expected 5 top level SecurityDefinitions in merged, got %v\n", len(primary.SecurityDefinitions)) require.Lenf(t, primary.Security, 3, "TestMixin: Expected 3 top level Security requirements in merged, got %v\n", len(primary.Security)) require.Lenf(t, primary.Tags, 3, "TestMixin: Expected 3 top level tags merged, got %v\n", len(primary.Security)) require.Lenf(t, primary.Schemes, 2, "TestMixin: Expected 2 top level schemes merged, got %v\n", len(primary.Security)) require.Lenf(t, primary.Consumes, 2, "TestMixin: Expected 2 top level Consumers merged, got %v\n", len(primary.Security)) require.Lenf(t, primary.Produces, 2, "TestMixin: Expected 2 top level Producers merged, got %v\n", len(primary.Security)) } func TestMixin_EmptyPath(t *testing.T) { t.Parallel() // test that adding paths to a primary with no paths works (was NPE) primary := antest.LoadOrFail(t, widgetFile) emptyPaths := antest.LoadOrFail(t, emptyPathsFile) collisions := Mixin(emptyPaths, primary) require.Lenf(t, collisions, 0, "TestMixin: Expected 0 collisions, got %v\n%v", len(collisions), collisions) } func TestMixin_FromNilPath(t *testing.T) { t.Parallel() primary := antest.LoadOrFail(t, otherMixin) mixin1 := antest.LoadOrFail(t, widgetFile) collisions := Mixin(primary, mixin1) require.Lenf(t, collisions, 1, "TestMixin: Expected 1 collisions, got %v\n%v", len(collisions), collisions) require.Lenf(t, primary.Paths.Paths, 3, "TestMixin: Expected 3 paths in merged, got %v\n", len(primary.Paths.Paths)) } func TestMixin_SwaggerProps(t *testing.T) { t.Parallel() primary := antest.LoadOrFail(t, emptyProps) mixin := antest.LoadOrFail(t, swaggerProps) collisions := Mixin(primary, mixin) require.Lenf(t, collisions, 1, "TestMixin: Expected 1 collisions, got %v\n%v", len(collisions), collisions) } analysis-0.21.1/schema.go000066400000000000000000000147771413705513100152250ustar00rootroot00000000000000package analysis import ( "fmt" "github.com/go-openapi/spec" "github.com/go-openapi/strfmt" ) // SchemaOpts configures the schema analyzer type SchemaOpts struct { Schema *spec.Schema Root interface{} BasePath string _ struct{} } // Schema analysis, will classify the schema according to known // patterns. func Schema(opts SchemaOpts) (*AnalyzedSchema, error) { if opts.Schema == nil { return nil, fmt.Errorf("no schema to analyze") } a := &AnalyzedSchema{ schema: opts.Schema, root: opts.Root, basePath: opts.BasePath, } a.initializeFlags() a.inferKnownType() a.inferEnum() a.inferBaseType() if err := a.inferMap(); err != nil { return nil, err } if err := a.inferArray(); err != nil { return nil, err } a.inferTuple() if err := a.inferFromRef(); err != nil { return nil, err } a.inferSimpleSchema() return a, nil } // AnalyzedSchema indicates what the schema represents type AnalyzedSchema struct { schema *spec.Schema root interface{} basePath string hasProps bool hasAllOf bool hasItems bool hasAdditionalProps bool hasAdditionalItems bool hasRef bool IsKnownType bool IsSimpleSchema bool IsArray bool IsSimpleArray bool IsMap bool IsSimpleMap bool IsExtendedObject bool IsTuple bool IsTupleWithExtra bool IsBaseType bool IsEnum bool } // Inherits copies value fields from other onto this schema func (a *AnalyzedSchema) inherits(other *AnalyzedSchema) { if other == nil { return } a.hasProps = other.hasProps a.hasAllOf = other.hasAllOf a.hasItems = other.hasItems a.hasAdditionalItems = other.hasAdditionalItems a.hasAdditionalProps = other.hasAdditionalProps a.hasRef = other.hasRef a.IsKnownType = other.IsKnownType a.IsSimpleSchema = other.IsSimpleSchema a.IsArray = other.IsArray a.IsSimpleArray = other.IsSimpleArray a.IsMap = other.IsMap a.IsSimpleMap = other.IsSimpleMap a.IsExtendedObject = other.IsExtendedObject a.IsTuple = other.IsTuple a.IsTupleWithExtra = other.IsTupleWithExtra a.IsBaseType = other.IsBaseType a.IsEnum = other.IsEnum } func (a *AnalyzedSchema) inferFromRef() error { if a.hasRef { sch := new(spec.Schema) sch.Ref = a.schema.Ref err := spec.ExpandSchema(sch, a.root, nil) if err != nil { return err } rsch, err := Schema(SchemaOpts{ Schema: sch, Root: a.root, BasePath: a.basePath, }) if err != nil { // NOTE(fredbi): currently the only cause for errors is // unresolved ref. Since spec.ExpandSchema() expands the // schema recursively, there is no chance to get there, // until we add more causes for error in this schema analysis. return err } a.inherits(rsch) } return nil } func (a *AnalyzedSchema) inferSimpleSchema() { a.IsSimpleSchema = a.IsKnownType || a.IsSimpleArray || a.IsSimpleMap } func (a *AnalyzedSchema) inferKnownType() { tpe := a.schema.Type format := a.schema.Format a.IsKnownType = tpe.Contains("boolean") || tpe.Contains("integer") || tpe.Contains("number") || tpe.Contains("string") || (format != "" && strfmt.Default.ContainsName(format)) || (a.isObjectType() && !a.hasProps && !a.hasAllOf && !a.hasAdditionalProps && !a.hasAdditionalItems) } func (a *AnalyzedSchema) inferMap() error { if !a.isObjectType() { return nil } hasExtra := a.hasProps || a.hasAllOf a.IsMap = a.hasAdditionalProps && !hasExtra a.IsExtendedObject = a.hasAdditionalProps && hasExtra if !a.IsMap { return nil } // maps if a.schema.AdditionalProperties.Schema != nil { msch, err := Schema(SchemaOpts{ Schema: a.schema.AdditionalProperties.Schema, Root: a.root, BasePath: a.basePath, }) if err != nil { return err } a.IsSimpleMap = msch.IsSimpleSchema } else if a.schema.AdditionalProperties.Allows { a.IsSimpleMap = true } return nil } func (a *AnalyzedSchema) inferArray() error { // an array has Items defined as an object schema, otherwise we qualify this JSON array as a tuple // (yes, even if the Items array contains only one element). // arrays in JSON schema may be unrestricted (i.e no Items specified). // Note that arrays in Swagger MUST have Items. Nonetheless, we analyze unrestricted arrays. // // NOTE: the spec package misses the distinction between: // items: [] and items: {}, so we consider both arrays here. a.IsArray = a.isArrayType() && (a.schema.Items == nil || a.schema.Items.Schemas == nil) if a.IsArray && a.hasItems { if a.schema.Items.Schema != nil { itsch, err := Schema(SchemaOpts{ Schema: a.schema.Items.Schema, Root: a.root, BasePath: a.basePath, }) if err != nil { return err } a.IsSimpleArray = itsch.IsSimpleSchema } } if a.IsArray && !a.hasItems { a.IsSimpleArray = true } return nil } func (a *AnalyzedSchema) inferTuple() { tuple := a.hasItems && a.schema.Items.Schemas != nil a.IsTuple = tuple && !a.hasAdditionalItems a.IsTupleWithExtra = tuple && a.hasAdditionalItems } func (a *AnalyzedSchema) inferBaseType() { if a.isObjectType() { a.IsBaseType = a.schema.Discriminator != "" } } func (a *AnalyzedSchema) inferEnum() { a.IsEnum = len(a.schema.Enum) > 0 } func (a *AnalyzedSchema) initializeFlags() { a.hasProps = len(a.schema.Properties) > 0 a.hasAllOf = len(a.schema.AllOf) > 0 a.hasRef = a.schema.Ref.String() != "" a.hasItems = a.schema.Items != nil && (a.schema.Items.Schema != nil || len(a.schema.Items.Schemas) > 0) a.hasAdditionalProps = a.schema.AdditionalProperties != nil && (a.schema.AdditionalProperties.Schema != nil || a.schema.AdditionalProperties.Allows) a.hasAdditionalItems = a.schema.AdditionalItems != nil && (a.schema.AdditionalItems.Schema != nil || a.schema.AdditionalItems.Allows) } func (a *AnalyzedSchema) isObjectType() bool { return !a.hasRef && (a.schema.Type == nil || a.schema.Type.Contains("") || a.schema.Type.Contains("object")) } func (a *AnalyzedSchema) isArrayType() bool { return !a.hasRef && (a.schema.Type != nil && a.schema.Type.Contains("array")) } // isAnalyzedAsComplex determines if an analyzed schema is eligible to flattening (i.e. it is "complex"). // // Complex means the schema is any of: // - a simple type (primitive) // - an array of something (items are possibly complex ; if this is the case, items will generate a definition) // - a map of something (additionalProperties are possibly complex ; if this is the case, additionalProperties will // generate a definition) func (a *AnalyzedSchema) isAnalyzedAsComplex() bool { return !a.IsSimpleSchema && !a.IsArray && !a.IsMap } analysis-0.21.1/schema_test.go000066400000000000000000000271201413705513100162460ustar00rootroot00000000000000package analysis import ( "encoding/json" "fmt" "net/http" "net/http/httptest" "path" "path/filepath" "testing" "github.com/go-openapi/analysis/internal/antest" "github.com/go-openapi/spec" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) var knownSchemas = []*spec.Schema{ spec.BoolProperty(), // 0 spec.StringProperty(), // 1 spec.Int8Property(), // 2 spec.Int16Property(), // 3 spec.Int32Property(), // 4 spec.Int64Property(), // 5 spec.Float32Property(), // 6 spec.Float64Property(), // 7 spec.DateProperty(), // 8 spec.DateTimeProperty(), // 9 (&spec.Schema{}), // 10 (&spec.Schema{}).Typed("object", ""), // 11 (&spec.Schema{}).Typed("", ""), // 12 (&spec.Schema{}).Typed("", "uuid"), // 13 } func TestSchemaAnalysis_KnownTypes(t *testing.T) { for i, v := range knownSchemas { sch, err := Schema(SchemaOpts{Schema: v}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) assert.Truef(t, sch.IsKnownType, "item at %d should be a known type", i) } for i, v := range complexSchemas { sch, err := Schema(SchemaOpts{Schema: v}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) assert.Falsef(t, sch.IsKnownType, "item at %d should not be a known type", i) } serv := refServer() defer serv.Close() for i, ref := range knownRefs(serv.URL) { sch, err := Schema(SchemaOpts{Schema: refSchema(ref)}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) assert.Truef(t, sch.IsKnownType, "item at %d should be a known type", i) } for i, ref := range complexRefs(serv.URL) { sch, err := Schema(SchemaOpts{Schema: refSchema(ref)}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) assert.Falsef(t, sch.IsKnownType, "item at %d should not be a known type", i) } } func TestSchemaAnalysis_Array(t *testing.T) { for i, v := range append(knownSchemas, (&spec.Schema{}).Typed("array", "")) { sch, err := Schema(SchemaOpts{Schema: spec.ArrayProperty(v)}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) assert.Truef(t, sch.IsArray, "item at %d should be an array type", i) assert.Truef(t, sch.IsSimpleArray, "item at %d should be a simple array type", i) } for i, v := range complexSchemas { sch, err := Schema(SchemaOpts{Schema: spec.ArrayProperty(v)}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) assert.Truef(t, sch.IsArray, "item at %d should be an array type", i) assert.Falsef(t, sch.IsSimpleArray, "item at %d should not be a simple array type", i) } serv := refServer() defer serv.Close() for i, ref := range knownRefs(serv.URL) { sch, err := Schema(SchemaOpts{Schema: spec.ArrayProperty(refSchema(ref))}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) assert.Truef(t, sch.IsArray, "item at %d should be an array type", i) assert.Truef(t, sch.IsSimpleArray, "item at %d should be a simple array type", i) } for i, ref := range complexRefs(serv.URL) { sch, err := Schema(SchemaOpts{Schema: spec.ArrayProperty(refSchema(ref))}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) assert.Falsef(t, sch.IsKnownType, "item at %d should not be a known type", i) assert.Truef(t, sch.IsArray, "item at %d should be an array type", i) assert.Falsef(t, sch.IsSimpleArray, "item at %d should not be a simple array type", i) } // edge case: unrestricted array (beyond Swagger) at := spec.ArrayProperty(nil) at.Items = nil sch, err := Schema(SchemaOpts{Schema: at}) require.NoError(t, err) assert.True(t, sch.IsArray) assert.False(t, sch.IsTuple) assert.False(t, sch.IsKnownType) assert.True(t, sch.IsSimpleSchema) // unrestricted array with explicit empty schema at = spec.ArrayProperty(nil) at.Items = &spec.SchemaOrArray{} sch, err = Schema(SchemaOpts{Schema: at}) require.NoError(t, err) assert.True(t, sch.IsArray) assert.False(t, sch.IsTuple) assert.False(t, sch.IsKnownType) assert.True(t, sch.IsSimpleSchema) } func TestSchemaAnalysis_Map(t *testing.T) { for i, v := range append(knownSchemas, spec.MapProperty(nil)) { sch, err := Schema(SchemaOpts{Schema: spec.MapProperty(v)}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) assert.Truef(t, sch.IsMap, "item at %d should be a map type", i) assert.Truef(t, sch.IsSimpleMap, "item at %d should be a simple map type", i) } for i, v := range complexSchemas { sch, err := Schema(SchemaOpts{Schema: spec.MapProperty(v)}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) assert.Truef(t, sch.IsMap, "item at %d should be a map type", i) assert.Falsef(t, sch.IsSimpleMap, "item at %d should not be a simple map type", i) } } func TestSchemaAnalysis_ExtendedObject(t *testing.T) { for i, v := range knownSchemas { wex := spec.MapProperty(v).SetProperty("name", *spec.StringProperty()) sch, err := Schema(SchemaOpts{Schema: wex}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) assert.Truef(t, sch.IsExtendedObject, "item at %d should be an extended map object type", i) assert.Falsef(t, sch.IsMap, "item at %d should not be a map type", i) assert.Falsef(t, sch.IsSimpleMap, "item at %d should not be a simple map type", i) } } func TestSchemaAnalysis_Tuple(t *testing.T) { at := spec.ArrayProperty(nil) at.Items = &spec.SchemaOrArray{} at.Items.Schemas = append(at.Items.Schemas, *spec.StringProperty(), *spec.Int64Property()) sch, err := Schema(SchemaOpts{Schema: at}) require.NoError(t, err) assert.True(t, sch.IsTuple) assert.False(t, sch.IsTupleWithExtra) assert.False(t, sch.IsKnownType) assert.False(t, sch.IsSimpleSchema) // edge case: tuple with a single element at.Items = &spec.SchemaOrArray{} at.Items.Schemas = append(at.Items.Schemas, *spec.StringProperty()) sch, err = Schema(SchemaOpts{Schema: at}) require.NoError(t, err) assert.True(t, sch.IsTuple) assert.False(t, sch.IsTupleWithExtra) assert.False(t, sch.IsKnownType) assert.False(t, sch.IsSimpleSchema) } func TestSchemaAnalysis_TupleWithExtra(t *testing.T) { at := spec.ArrayProperty(nil) at.Items = &spec.SchemaOrArray{} at.Items.Schemas = append(at.Items.Schemas, *spec.StringProperty(), *spec.Int64Property()) at.AdditionalItems = &spec.SchemaOrBool{Allows: true} at.AdditionalItems.Schema = spec.Int32Property() sch, err := Schema(SchemaOpts{Schema: at}) require.NoError(t, err) assert.False(t, sch.IsTuple) assert.True(t, sch.IsTupleWithExtra) assert.False(t, sch.IsKnownType) assert.False(t, sch.IsSimpleSchema) } func TestSchemaAnalysis_BaseType(t *testing.T) { cl := (&spec.Schema{}).Typed("object", "").SetProperty("type", *spec.StringProperty()).WithDiscriminator("type") sch, err := Schema(SchemaOpts{Schema: cl}) require.NoError(t, err) assert.True(t, sch.IsBaseType) assert.False(t, sch.IsKnownType) assert.False(t, sch.IsSimpleSchema) } func TestSchemaAnalysis_SimpleSchema(t *testing.T) { for i, v := range append(knownSchemas, spec.ArrayProperty(nil), spec.MapProperty(nil)) { sch, err := Schema(SchemaOpts{Schema: v}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) assert.Truef(t, sch.IsSimpleSchema, "item at %d should be a simple schema", i) asch, err := Schema(SchemaOpts{Schema: spec.ArrayProperty(v)}) require.NoErrorf(t, err, "failed to analyze array schema at %d: %v", i, err) assert.Truef(t, asch.IsSimpleSchema, "array item at %d should be a simple schema", i) msch, err := Schema(SchemaOpts{Schema: spec.MapProperty(v)}) require.NoErrorf(t, err, "failed to analyze map schema at %d: %v", i, err) assert.Truef(t, msch.IsSimpleSchema, "map item at %d should be a simple schema", i) } for i, v := range complexSchemas { sch, err := Schema(SchemaOpts{Schema: v}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) assert.Falsef(t, sch.IsSimpleSchema, "item at %d should not be a simple schema", i) } } func TestSchemaAnalys_InvalidSchema(t *testing.T) { // explore error cases in schema analysis: // the only cause for failure is a wrong $ref at some place bp := filepath.Join("fixtures", "bugs", "1602", "other-invalid-pointers.yaml") sp := antest.LoadOrFail(t, bp) // invalid ref not detected (no digging further) def := sp.Definitions["invalidRefInObject"] _, err := Schema(SchemaOpts{Schema: &def, Root: sp, BasePath: bp}) assert.NoError(t, err, "did not expect an error here, in spite of the underlying invalid $ref") def = sp.Definitions["invalidRefInTuple"] _, err = Schema(SchemaOpts{Schema: &def, Root: sp, BasePath: bp}) assert.NoError(t, err, "did not expect an error here, in spite of the underlying invalid $ref") // invalid ref detected (digging) schema := refSchema(spec.MustCreateRef("#/definitions/noWhere")) _, err = Schema(SchemaOpts{Schema: schema, Root: sp, BasePath: bp}) assert.Error(t, err, "expected an error here") def = sp.Definitions["invalidRefInMap"] _, err = Schema(SchemaOpts{Schema: &def, Root: sp, BasePath: bp}) assert.Error(t, err, "expected an error here") def = sp.Definitions["invalidRefInArray"] _, err = Schema(SchemaOpts{Schema: &def, Root: sp, BasePath: bp}) assert.Error(t, err, "expected an error here") def = sp.Definitions["indirectToInvalidRef"] _, err = Schema(SchemaOpts{Schema: &def, Root: sp, BasePath: bp}) assert.Error(t, err, "expected an error here") } func TestSchemaAnalysis_EdgeCases(t *testing.T) { t.Parallel() _, err := Schema(SchemaOpts{Schema: nil}) assert.Error(t, err) } /* helpers for the Schema test suite */ func newCObj() *spec.Schema { return (&spec.Schema{}).Typed("object", "").SetProperty("id", *spec.Int64Property()) } var complexObject = newCObj() var complexSchemas = []*spec.Schema{ complexObject, spec.ArrayProperty(complexObject), spec.MapProperty(complexObject), } func knownRefs(base string) []spec.Ref { urls := []string{"bool", "string", "integer", "float", "date", "object", "format"} result := make([]spec.Ref, 0, len(urls)) for _, u := range urls { result = append(result, spec.MustCreateRef(fmt.Sprintf("%s/%s", base, path.Join("known", u)))) } return result } func complexRefs(base string) []spec.Ref { urls := []string{"object", "array", "map"} result := make([]spec.Ref, 0, len(urls)) for _, u := range urls { result = append(result, spec.MustCreateRef(fmt.Sprintf("%s/%s", base, path.Join("complex", u)))) } return result } func refServer() *httptest.Server { mux := http.NewServeMux() mux.Handle("/known/bool", schemaHandler(knownSchemas[0])) mux.Handle("/known/string", schemaHandler(knownSchemas[1])) mux.Handle("/known/integer", schemaHandler(knownSchemas[5])) mux.Handle("/known/float", schemaHandler(knownSchemas[6])) mux.Handle("/known/date", schemaHandler(knownSchemas[8])) mux.Handle("/known/object", schemaHandler(knownSchemas[11])) mux.Handle("/known/format", schemaHandler(knownSchemas[13])) mux.Handle("/complex/object", schemaHandler(complexSchemas[0])) mux.Handle("/complex/array", schemaHandler(complexSchemas[1])) mux.Handle("/complex/map", schemaHandler(complexSchemas[2])) return httptest.NewServer(mux) } func refSchema(ref spec.Ref) *spec.Schema { return &spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} } func schemaHandler(schema *spec.Schema) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { writeJSON(w, schema) }) } func writeJSON(w http.ResponseWriter, data interface{}) { w.Header().Add("Content-Type", "application/json") w.WriteHeader(http.StatusOK) enc := json.NewEncoder(w) if err := enc.Encode(data); err != nil { panic(err) } }