From 2842422bb04d176b7f41888e6eed10cd4b81bbac Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 18 Sep 2018 11:12:47 -0700 Subject: first attempt at auth in API spec --- rust/fatcat-api-spec/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rust/fatcat-api-spec/README.md') diff --git a/rust/fatcat-api-spec/README.md b/rust/fatcat-api-spec/README.md index d6f09b7a..41f4ae5e 100644 --- a/rust/fatcat-api-spec/README.md +++ b/rust/fatcat-api-spec/README.md @@ -13,7 +13,7 @@ To see how to make this your own, look here: [README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md) - API version: 0.1.0 -- Build date: 2018-12-27T07:23:47.225Z +- Build date: 2018-12-27T07:31:49.807Z This autogenerated project defines an API crate `fatcat` which contains: * An `Api` trait defining the API in Rust. -- cgit v1.2.3 From 230032ec1a13dd3830bcffed6112c2fddabc4b6e Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 31 Dec 2018 14:57:03 -0800 Subject: codegen --- rust/fatcat-api-spec/README.md | 2 +- rust/fatcat-api-spec/api.yaml | 52 +- rust/fatcat-api-spec/api/swagger.yaml | 904 ++++++++++++---------------- rust/fatcat-api-spec/src/client.rs | 959 +++++++++--------------------- rust/fatcat-api-spec/src/lib.rs | 166 +++--- rust/fatcat-api-spec/src/mimetypes.rs | 332 +++++------ rust/fatcat-api-spec/src/server.rs | 1046 +++++++++++++++------------------ 7 files changed, 1403 insertions(+), 2058 deletions(-) (limited to 'rust/fatcat-api-spec/README.md') diff --git a/rust/fatcat-api-spec/README.md b/rust/fatcat-api-spec/README.md index 41f4ae5e..bed47c45 100644 --- a/rust/fatcat-api-spec/README.md +++ b/rust/fatcat-api-spec/README.md @@ -13,7 +13,7 @@ To see how to make this your own, look here: [README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md) - API version: 0.1.0 -- Build date: 2018-12-27T07:31:49.807Z +- Build date: 2018-12-31T22:21:53.785Z This autogenerated project defines an API crate `fatcat` which contains: * An `Api` trait defining the API in Rust. diff --git a/rust/fatcat-api-spec/api.yaml b/rust/fatcat-api-spec/api.yaml index 713cb116..98b9e4b0 100644 --- a/rust/fatcat-api-spec/api.yaml +++ b/rust/fatcat-api-spec/api.yaml @@ -549,11 +549,7 @@ definitions: role: type: string -x-entity-responses: &ENTITYRESPONSES - 400: - description: Bad Request - schema: - $ref: "#/definitions/error_response" +x-auth-responses: &AUTHRESPONSES 401: description: Not Authorized # "Authentication information is missing or invalid" schema: @@ -561,6 +557,15 @@ x-entity-responses: &ENTITYRESPONSES headers: WWW_Authenticate: type: string + 403: + description: Forbidden + schema: + $ref: "#/definitions/error_response" +x-entity-responses: &ENTITYRESPONSES + 400: + description: Bad Request + schema: + $ref: "#/definitions/error_response" 404: description: Not Found schema: @@ -594,6 +599,7 @@ paths: schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /container/batch: post: operationId: "create_container_batch" @@ -627,6 +633,7 @@ paths: items: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /container/{ident}: parameters: - name: ident @@ -676,6 +683,7 @@ paths: schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES delete: operationId: "delete_container" tags: # TAGLINE @@ -693,6 +701,7 @@ paths: schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /container/rev/{rev_id}: parameters: - name: rev_id @@ -822,6 +831,7 @@ paths: schema: $ref: "#/definitions/success" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /creator: post: operationId: "create_creator" @@ -845,6 +855,7 @@ paths: schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /creator/batch: post: operationId: "create_creator_batch" @@ -878,6 +889,7 @@ paths: items: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /creator/{ident}: parameters: - name: ident @@ -927,6 +939,7 @@ paths: schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES delete: operationId: "delete_creator" tags: # TAGLINE @@ -944,6 +957,7 @@ paths: schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /creator/rev/{rev_id}: parameters: - name: rev_id @@ -1096,6 +1110,7 @@ paths: schema: $ref: "#/definitions/success" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /file: post: operationId: "create_file" @@ -1119,6 +1134,7 @@ paths: schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /file/batch: post: operationId: "create_file_batch" @@ -1152,6 +1168,7 @@ paths: items: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /file/{ident}: parameters: - name: ident @@ -1201,6 +1218,7 @@ paths: schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES delete: operationId: "delete_file" tags: # TAGLINE @@ -1218,6 +1236,7 @@ paths: schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /file/rev/{rev_id}: parameters: - name: rev_id @@ -1352,6 +1371,7 @@ paths: schema: $ref: "#/definitions/success" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /fileset: post: operationId: "create_fileset" @@ -1373,6 +1393,7 @@ paths: schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /fileset/batch: post: operationId: "create_fileset_batch" @@ -1404,6 +1425,7 @@ paths: items: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /fileset/{ident}: parameters: - name: ident @@ -1451,6 +1473,7 @@ paths: schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES delete: operationId: "delete_fileset" tags: # TAGLINE @@ -1466,6 +1489,7 @@ paths: schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /fileset/rev/{rev_id}: parameters: - name: rev_id @@ -1566,6 +1590,7 @@ paths: schema: $ref: "#/definitions/success" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /webcapture: post: operationId: "create_webcapture" @@ -1587,6 +1612,7 @@ paths: schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /webcapture/batch: post: operationId: "create_webcapture_batch" @@ -1618,6 +1644,7 @@ paths: items: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /webcapture/{ident}: parameters: - name: ident @@ -1665,6 +1692,7 @@ paths: schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES delete: operationId: "delete_webcapture" tags: # TAGLINE @@ -1680,6 +1708,7 @@ paths: schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /webcapture/rev/{rev_id}: parameters: - name: rev_id @@ -1780,6 +1809,7 @@ paths: schema: $ref: "#/definitions/success" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /release: post: operationId: "create_release" @@ -1801,6 +1831,7 @@ paths: schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /release/batch: post: operationId: "create_release_batch" @@ -1832,6 +1863,7 @@ paths: items: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /release/{ident}: parameters: - name: ident @@ -1879,6 +1911,7 @@ paths: schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES delete: operationId: "delete_release" tags: # TAGLINE @@ -1894,6 +1927,7 @@ paths: schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /release/rev/{rev_id}: parameters: - name: rev_id @@ -2109,6 +2143,7 @@ paths: schema: $ref: "#/definitions/success" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /work: post: operationId: "create_work" @@ -2130,6 +2165,7 @@ paths: schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /work/batch: post: operationId: "create_work_batch" @@ -2161,6 +2197,7 @@ paths: items: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /work/{ident}: parameters: - name: ident @@ -2208,6 +2245,7 @@ paths: schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES delete: operationId: "delete_work" tags: # TAGLINE @@ -2223,6 +2261,7 @@ paths: schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /work/rev/{rev_id}: parameters: - name: rev_id @@ -2346,6 +2385,7 @@ paths: schema: $ref: "#/definitions/success" <<: *ENTITYRESPONSES + <<: *AUTHRESPONSES /editor/{editor_id}: parameters: - name: editor_id @@ -2422,6 +2462,7 @@ paths: description: Generic Error schema: $ref: "#/definitions/error_response" + <<: *AUTHRESPONSES /editgroup/{editgroup_id}: parameters: - name: editgroup_id @@ -2480,6 +2521,7 @@ paths: description: Generic Error schema: $ref: "#/definitions/error_response" + <<: *AUTHRESPONSES /changelog: parameters: - name: limit diff --git a/rust/fatcat-api-spec/api/swagger.yaml b/rust/fatcat-api-spec/api/swagger.yaml index 7e5508b9..670d3551 100644 --- a/rust/fatcat-api-spec/api/swagger.yaml +++ b/rust/fatcat-api-spec/api/swagger.yaml @@ -76,6 +76,15 @@ paths: uppercase_operation_id: "CREATE_CONTAINER" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "CREATE_CONTAINER" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -169,6 +178,15 @@ paths: uppercase_operation_id: "CREATE_CONTAINER_BATCH" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "CREATE_CONTAINER_BATCH" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -241,18 +259,6 @@ paths: uppercase_operation_id: "GET_CONTAINER" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_CONTAINER" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -336,6 +342,15 @@ paths: uppercase_operation_id: "UPDATE_CONTAINER" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "UPDATE_CONTAINER" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -410,6 +425,15 @@ paths: uppercase_operation_id: "DELETE_CONTAINER" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "DELETE_CONTAINER" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -486,18 +510,6 @@ paths: uppercase_operation_id: "GET_CONTAINER_REVISION" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_CONTAINER_REVISION" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -561,18 +573,6 @@ paths: uppercase_operation_id: "GET_CONTAINER_HISTORY" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_CONTAINER_HISTORY" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -629,18 +629,6 @@ paths: uppercase_operation_id: "GET_CONTAINER_REDIRECTS" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_CONTAINER_REDIRECTS" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -718,18 +706,6 @@ paths: uppercase_operation_id: "LOOKUP_CONTAINER" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "LOOKUP_CONTAINER" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -788,18 +764,6 @@ paths: uppercase_operation_id: "GET_CONTAINER_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_CONTAINER_EDIT" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -869,6 +833,15 @@ paths: uppercase_operation_id: "DELETE_CONTAINER_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "DELETE_CONTAINER_EDIT" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -947,6 +920,15 @@ paths: uppercase_operation_id: "CREATE_CREATOR" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "CREATE_CREATOR" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -1040,6 +1022,15 @@ paths: uppercase_operation_id: "CREATE_CREATOR_BATCH" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "CREATE_CREATOR_BATCH" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -1112,18 +1103,6 @@ paths: uppercase_operation_id: "GET_CREATOR" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_CREATOR" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -1207,6 +1186,15 @@ paths: uppercase_operation_id: "UPDATE_CREATOR" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "UPDATE_CREATOR" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -1281,6 +1269,15 @@ paths: uppercase_operation_id: "DELETE_CREATOR" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "DELETE_CREATOR" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -1357,18 +1354,6 @@ paths: uppercase_operation_id: "GET_CREATOR_REVISION" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_CREATOR_REVISION" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -1432,18 +1417,6 @@ paths: uppercase_operation_id: "GET_CREATOR_HISTORY" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_CREATOR_HISTORY" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -1508,18 +1481,6 @@ paths: uppercase_operation_id: "GET_CREATOR_RELEASES" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_CREATOR_RELEASES" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -1576,18 +1537,6 @@ paths: uppercase_operation_id: "GET_CREATOR_REDIRECTS" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_CREATOR_REDIRECTS" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -1665,18 +1614,6 @@ paths: uppercase_operation_id: "LOOKUP_CREATOR" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "LOOKUP_CREATOR" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -1735,18 +1672,6 @@ paths: uppercase_operation_id: "GET_CREATOR_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_CREATOR_EDIT" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -1816,6 +1741,15 @@ paths: uppercase_operation_id: "DELETE_CREATOR_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "DELETE_CREATOR_EDIT" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -1894,6 +1828,15 @@ paths: uppercase_operation_id: "CREATE_FILE" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "CREATE_FILE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -1987,6 +1930,15 @@ paths: uppercase_operation_id: "CREATE_FILE_BATCH" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "CREATE_FILE_BATCH" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -2059,18 +2011,6 @@ paths: uppercase_operation_id: "GET_FILE" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_FILE" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -2154,6 +2094,15 @@ paths: uppercase_operation_id: "UPDATE_FILE" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "UPDATE_FILE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -2228,6 +2177,15 @@ paths: uppercase_operation_id: "DELETE_FILE" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "DELETE_FILE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -2304,18 +2262,6 @@ paths: uppercase_operation_id: "GET_FILE_REVISION" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_FILE_REVISION" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -2379,18 +2325,6 @@ paths: uppercase_operation_id: "GET_FILE_HISTORY" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_FILE_HISTORY" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -2447,18 +2381,6 @@ paths: uppercase_operation_id: "GET_FILE_REDIRECTS" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_FILE_REDIRECTS" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -2549,18 +2471,6 @@ paths: uppercase_operation_id: "LOOKUP_FILE" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "LOOKUP_FILE" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -2619,18 +2529,6 @@ paths: uppercase_operation_id: "GET_FILE_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_FILE_EDIT" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -2700,6 +2598,15 @@ paths: uppercase_operation_id: "DELETE_FILE_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "DELETE_FILE_EDIT" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -2778,6 +2685,15 @@ paths: uppercase_operation_id: "CREATE_FILESET" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "CREATE_FILESET" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -2869,6 +2785,15 @@ paths: uppercase_operation_id: "CREATE_FILESET_BATCH" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "CREATE_FILESET_BATCH" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -2939,18 +2864,6 @@ paths: uppercase_operation_id: "GET_FILESET" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_FILESET" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -3034,6 +2947,15 @@ paths: uppercase_operation_id: "UPDATE_FILESET" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "UPDATE_FILESET" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -3106,6 +3028,15 @@ paths: uppercase_operation_id: "DELETE_FILESET" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "DELETE_FILESET" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -3180,18 +3111,6 @@ paths: uppercase_operation_id: "GET_FILESET_REVISION" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_FILESET_REVISION" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -3255,18 +3174,6 @@ paths: uppercase_operation_id: "GET_FILESET_HISTORY" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_FILESET_HISTORY" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -3323,18 +3230,6 @@ paths: uppercase_operation_id: "GET_FILESET_REDIRECTS" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_FILESET_REDIRECTS" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -3393,18 +3288,6 @@ paths: uppercase_operation_id: "GET_FILESET_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_FILESET_EDIT" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -3474,6 +3357,15 @@ paths: uppercase_operation_id: "DELETE_FILESET_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "DELETE_FILESET_EDIT" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -3552,6 +3444,15 @@ paths: uppercase_operation_id: "CREATE_WEBCAPTURE" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "CREATE_WEBCAPTURE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -3643,6 +3544,15 @@ paths: uppercase_operation_id: "CREATE_WEBCAPTURE_BATCH" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "CREATE_WEBCAPTURE_BATCH" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -3713,18 +3623,6 @@ paths: uppercase_operation_id: "GET_WEBCAPTURE" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_WEBCAPTURE" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -3808,6 +3706,15 @@ paths: uppercase_operation_id: "UPDATE_WEBCAPTURE" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "UPDATE_WEBCAPTURE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -3880,6 +3787,15 @@ paths: uppercase_operation_id: "DELETE_WEBCAPTURE" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "DELETE_WEBCAPTURE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -3954,18 +3870,6 @@ paths: uppercase_operation_id: "GET_WEBCAPTURE_REVISION" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_WEBCAPTURE_REVISION" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -4029,18 +3933,6 @@ paths: uppercase_operation_id: "GET_WEBCAPTURE_HISTORY" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_WEBCAPTURE_HISTORY" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -4097,18 +3989,6 @@ paths: uppercase_operation_id: "GET_WEBCAPTURE_REDIRECTS" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_WEBCAPTURE_REDIRECTS" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -4167,18 +4047,6 @@ paths: uppercase_operation_id: "GET_WEBCAPTURE_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_WEBCAPTURE_EDIT" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -4248,6 +4116,15 @@ paths: uppercase_operation_id: "DELETE_WEBCAPTURE_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "DELETE_WEBCAPTURE_EDIT" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -4326,6 +4203,15 @@ paths: uppercase_operation_id: "CREATE_RELEASE" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "CREATE_RELEASE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -4417,6 +4303,15 @@ paths: uppercase_operation_id: "CREATE_RELEASE_BATCH" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "CREATE_RELEASE_BATCH" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -4482,20 +4377,8 @@ paths: description: "Bad Request" schema: $ref: "#/definitions/error_response" - x-responseId: "BadRequest" - x-uppercaseResponseId: "BAD_REQUEST" - uppercase_operation_id: "GET_RELEASE" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" uppercase_operation_id: "GET_RELEASE" uppercase_data_type: "ERRORRESPONSE" producesJson: true @@ -4582,6 +4465,15 @@ paths: uppercase_operation_id: "UPDATE_RELEASE" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "UPDATE_RELEASE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -4654,6 +4546,15 @@ paths: uppercase_operation_id: "DELETE_RELEASE" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "DELETE_RELEASE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -4728,18 +4629,6 @@ paths: uppercase_operation_id: "GET_RELEASE_REVISION" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_RELEASE_REVISION" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -4803,18 +4692,6 @@ paths: uppercase_operation_id: "GET_RELEASE_HISTORY" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_RELEASE_HISTORY" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -4879,18 +4756,6 @@ paths: uppercase_operation_id: "GET_RELEASE_FILES" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_RELEASE_FILES" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -4955,18 +4820,6 @@ paths: uppercase_operation_id: "GET_RELEASE_FILESETS" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_RELEASE_FILESETS" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -5031,18 +4884,6 @@ paths: uppercase_operation_id: "GET_RELEASE_WEBCAPTURES" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_RELEASE_WEBCAPTURES" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -5099,18 +4940,6 @@ paths: uppercase_operation_id: "GET_RELEASE_REDIRECTS" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_RELEASE_REDIRECTS" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -5210,18 +5039,6 @@ paths: uppercase_operation_id: "LOOKUP_RELEASE" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "LOOKUP_RELEASE" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -5280,18 +5097,6 @@ paths: uppercase_operation_id: "GET_RELEASE_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_RELEASE_EDIT" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -5361,6 +5166,15 @@ paths: uppercase_operation_id: "DELETE_RELEASE_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "DELETE_RELEASE_EDIT" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -5439,6 +5253,15 @@ paths: uppercase_operation_id: "CREATE_WORK" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "CREATE_WORK" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -5530,6 +5353,15 @@ paths: uppercase_operation_id: "CREATE_WORK_BATCH" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "CREATE_WORK_BATCH" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -5600,18 +5432,6 @@ paths: uppercase_operation_id: "GET_WORK" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_WORK" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -5695,6 +5515,15 @@ paths: uppercase_operation_id: "UPDATE_WORK" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "UPDATE_WORK" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -5767,6 +5596,15 @@ paths: uppercase_operation_id: "DELETE_WORK" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "DELETE_WORK" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -5841,18 +5679,6 @@ paths: uppercase_operation_id: "GET_WORK_REVISION" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_WORK_REVISION" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -5916,18 +5742,6 @@ paths: uppercase_operation_id: "GET_WORK_HISTORY" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_WORK_HISTORY" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -5984,18 +5798,6 @@ paths: uppercase_operation_id: "GET_WORK_REDIRECTS" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_WORK_REDIRECTS" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -6060,18 +5862,6 @@ paths: uppercase_operation_id: "GET_WORK_RELEASES" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_WORK_RELEASES" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -6130,18 +5920,6 @@ paths: uppercase_operation_id: "GET_WORK_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true - 401: - description: "Not Authorized" - schema: - $ref: "#/definitions/error_response" - headers: - WWW_Authenticate: - type: "string" - x-responseId: "NotAuthorized" - x-uppercaseResponseId: "NOT_AUTHORIZED" - uppercase_operation_id: "GET_WORK_EDIT" - uppercase_data_type: "ERRORRESPONSE" - producesJson: true 404: description: "Not Found" schema: @@ -6211,6 +5989,15 @@ paths: uppercase_operation_id: "DELETE_WORK_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "DELETE_WORK_EDIT" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -6377,6 +6164,27 @@ paths: uppercase_operation_id: "CREATE_EDITGROUP" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 401: + description: "Not Authorized" + schema: + $ref: "#/definitions/error_response" + headers: + WWW_Authenticate: + type: "string" + x-responseId: "NotAuthorized" + x-uppercaseResponseId: "NOT_AUTHORIZED" + uppercase_operation_id: "CREATE_EDITGROUP" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "CREATE_EDITGROUP" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 500: description: "Generic Error" schema: @@ -6485,6 +6293,27 @@ paths: uppercase_operation_id: "ACCEPT_EDITGROUP" uppercase_data_type: "ERRORRESPONSE" producesJson: true + 401: + description: "Not Authorized" + schema: + $ref: "#/definitions/error_response" + headers: + WWW_Authenticate: + type: "string" + x-responseId: "NotAuthorized" + x-uppercaseResponseId: "NOT_AUTHORIZED" + uppercase_operation_id: "ACCEPT_EDITGROUP" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "ACCEPT_EDITGROUP" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true 404: description: "Not Found" schema: @@ -8466,11 +8295,7 @@ x-entity-props: edit_extra: type: "object" additionalProperties: {} -x-entity-responses: - 400: - description: "Bad Request" - schema: - $ref: "#/definitions/error_response" +x-auth-responses: 401: description: "Not Authorized" schema: @@ -8478,6 +8303,15 @@ x-entity-responses: headers: WWW_Authenticate: type: "string" + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" +x-entity-responses: + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" 404: description: "Not Found" schema: diff --git a/rust/fatcat-api-spec/src/client.rs b/rust/fatcat-api-spec/src/client.rs index 1e889092..b67e193a 100644 --- a/rust/fatcat-api-spec/src/client.rs +++ b/rust/fatcat-api-spec/src/client.rs @@ -227,6 +227,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateContainerResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -322,6 +329,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateContainerBatchResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -405,6 +419,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteContainerResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -484,6 +505,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteContainerEditResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -554,21 +582,6 @@ impl Api for Client { Ok(GetContainerResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetContainerResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -633,21 +646,6 @@ impl Api for Client { Ok(GetContainerEditResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetContainerEditResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -716,21 +714,6 @@ impl Api for Client { Ok(GetContainerHistoryResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetContainerHistoryResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -795,21 +778,6 @@ impl Api for Client { Ok(GetContainerRedirectsResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetContainerRedirectsResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -886,21 +854,6 @@ impl Api for Client { Ok(GetContainerRevisionResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetContainerRevisionResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -981,21 +934,6 @@ impl Api for Client { Ok(LookupContainerResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(LookupContainerResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -1090,6 +1028,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(UpdateContainerResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -1177,6 +1122,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateCreatorResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -1272,6 +1224,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateCreatorBatchResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -1355,6 +1314,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteCreatorResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -1434,6 +1400,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteCreatorEditResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -1504,21 +1477,6 @@ impl Api for Client { Ok(GetCreatorResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetCreatorResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -1583,21 +1541,6 @@ impl Api for Client { Ok(GetCreatorEditResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetCreatorEditResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -1666,21 +1609,6 @@ impl Api for Client { Ok(GetCreatorHistoryResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetCreatorHistoryResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -1745,21 +1673,6 @@ impl Api for Client { Ok(GetCreatorRedirectsResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetCreatorRedirectsResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -1828,21 +1741,6 @@ impl Api for Client { Ok(GetCreatorReleasesResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetCreatorReleasesResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -1919,21 +1817,6 @@ impl Api for Client { Ok(GetCreatorRevisionResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetCreatorRevisionResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -2014,21 +1897,6 @@ impl Api for Client { Ok(LookupCreatorResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(LookupCreatorResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -2123,6 +1991,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(UpdateCreatorResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -2315,6 +2190,28 @@ impl Api for Client { Ok(AcceptEditgroupResponse::BadRequest(body)) } + 401 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } + let response_www_authenticate = response + .headers + .get::() + .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; + + Ok(AcceptEditgroupResponse::NotAuthorized { + body: body, + www_authenticate: response_www_authenticate.0.clone(), + }) + } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(AcceptEditgroupResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -2387,13 +2284,35 @@ impl Api for Client { Ok(CreateEditgroupResponse::BadRequest(body)) } - 500 => { + 401 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - - Ok(CreateEditgroupResponse::GenericError(body)) - } + header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } + let response_www_authenticate = response + .headers + .get::() + .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; + + Ok(CreateEditgroupResponse::NotAuthorized { + body: body, + www_authenticate: response_www_authenticate.0.clone(), + }) + } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateEditgroupResponse::Forbidden(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateEditgroupResponse::GenericError(body)) + } code => { let mut buf = [0; 100]; let debug_body = match response.read(&mut buf) { @@ -2633,6 +2552,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateFileResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -2728,6 +2654,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateFileBatchResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -2811,6 +2744,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteFileResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -2890,6 +2830,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteFileEditResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -2960,21 +2907,6 @@ impl Api for Client { Ok(GetFileResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetFileResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -3039,21 +2971,6 @@ impl Api for Client { Ok(GetFileEditResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetFileEditResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -3122,21 +3039,6 @@ impl Api for Client { Ok(GetFileHistoryResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetFileHistoryResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -3201,21 +3103,6 @@ impl Api for Client { Ok(GetFileRedirectsResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetFileRedirectsResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -3292,21 +3179,6 @@ impl Api for Client { Ok(GetFileRevisionResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetFileRevisionResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -3390,21 +3262,6 @@ impl Api for Client { Ok(LookupFileResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(LookupFileResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -3499,6 +3356,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(UpdateFileResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -3586,6 +3450,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateFilesetResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -3681,6 +3552,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateFilesetBatchResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -3764,6 +3642,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteFilesetResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -3843,6 +3728,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteFilesetEditResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -3913,21 +3805,6 @@ impl Api for Client { Ok(GetFilesetResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetFilesetResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -3992,21 +3869,6 @@ impl Api for Client { Ok(GetFilesetEditResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetFilesetEditResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -4075,21 +3937,6 @@ impl Api for Client { Ok(GetFilesetHistoryResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetFilesetHistoryResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -4154,21 +4001,6 @@ impl Api for Client { Ok(GetFilesetRedirectsResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetFilesetRedirectsResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -4245,21 +4077,6 @@ impl Api for Client { Ok(GetFilesetRevisionResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetFilesetRevisionResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -4354,6 +4171,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(UpdateFilesetResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -4441,6 +4265,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateReleaseResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -4536,6 +4367,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateReleaseBatchResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -4619,6 +4457,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateWorkResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -4702,6 +4547,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteReleaseResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -4781,6 +4633,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteReleaseEditResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -4851,22 +4710,7 @@ impl Api for Client { Ok(GetReleaseResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetReleaseResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } - 404 => { + 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; @@ -4930,21 +4774,6 @@ impl Api for Client { Ok(GetReleaseEditResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetReleaseEditResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -5013,21 +4842,6 @@ impl Api for Client { Ok(GetReleaseFilesResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetReleaseFilesResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -5096,21 +4910,6 @@ impl Api for Client { Ok(GetReleaseFilesetsResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetReleaseFilesetsResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -5179,21 +4978,6 @@ impl Api for Client { Ok(GetReleaseHistoryResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetReleaseHistoryResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -5258,21 +5042,6 @@ impl Api for Client { Ok(GetReleaseRedirectsResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetReleaseRedirectsResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -5349,21 +5118,6 @@ impl Api for Client { Ok(GetReleaseRevisionResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetReleaseRevisionResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -5432,21 +5186,6 @@ impl Api for Client { Ok(GetReleaseWebcapturesResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetReleaseWebcapturesResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -5539,21 +5278,6 @@ impl Api for Client { Ok(LookupReleaseResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(LookupReleaseResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -5648,6 +5372,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(UpdateReleaseResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -5740,6 +5471,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateWebcaptureResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -5835,6 +5573,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateWebcaptureBatchResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -5918,6 +5663,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteWebcaptureResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -5997,6 +5749,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteWebcaptureEditResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -6067,21 +5826,6 @@ impl Api for Client { Ok(GetWebcaptureResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetWebcaptureResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -6146,21 +5890,6 @@ impl Api for Client { Ok(GetWebcaptureEditResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetWebcaptureEditResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -6229,21 +5958,6 @@ impl Api for Client { Ok(GetWebcaptureHistoryResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetWebcaptureHistoryResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -6308,21 +6022,6 @@ impl Api for Client { Ok(GetWebcaptureRedirectsResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetWebcaptureRedirectsResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -6399,21 +6098,6 @@ impl Api for Client { Ok(GetWebcaptureRevisionResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetWebcaptureRevisionResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -6508,6 +6192,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(UpdateWebcaptureResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -6603,6 +6294,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateWorkBatchResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -6686,6 +6384,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteWorkResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -6765,6 +6470,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteWorkEditResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -6835,21 +6547,6 @@ impl Api for Client { Ok(GetWorkResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetWorkResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -6914,21 +6611,6 @@ impl Api for Client { Ok(GetWorkEditResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetWorkEditResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -6997,21 +6679,6 @@ impl Api for Client { Ok(GetWorkHistoryResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetWorkHistoryResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -7076,21 +6743,6 @@ impl Api for Client { Ok(GetWorkRedirectsResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetWorkRedirectsResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -7159,21 +6811,6 @@ impl Api for Client { Ok(GetWorkReleasesResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetWorkReleasesResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -7250,21 +6887,6 @@ impl Api for Client { Ok(GetWorkRevisionResponse::BadRequest(body)) } - 401 => { - let mut buf = String::new(); - response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - let response_www_authenticate = response - .headers - .get::() - .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - - Ok(GetWorkRevisionResponse::NotAuthorized { - body: body, - www_authenticate: response_www_authenticate.0.clone(), - }) - } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; @@ -7359,6 +6981,13 @@ impl Api for Client { www_authenticate: response_www_authenticate.0.clone(), }) } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(UpdateWorkResponse::Forbidden(body)) + } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; diff --git a/rust/fatcat-api-spec/src/lib.rs b/rust/fatcat-api-spec/src/lib.rs index 16b40999..c6126c9c 100644 --- a/rust/fatcat-api-spec/src/lib.rs +++ b/rust/fatcat-api-spec/src/lib.rs @@ -40,6 +40,8 @@ pub enum CreateContainerResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -54,6 +56,8 @@ pub enum CreateContainerBatchResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -68,6 +72,8 @@ pub enum DeleteContainerResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -82,6 +88,8 @@ pub enum DeleteContainerEditResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -94,8 +102,6 @@ pub enum GetContainerResponse { FoundEntity(models::ContainerEntity), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -108,8 +114,6 @@ pub enum GetContainerEditResponse { FoundEdit(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -122,8 +126,6 @@ pub enum GetContainerHistoryResponse { FoundEntityHistory(Vec), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -136,8 +138,6 @@ pub enum GetContainerRedirectsResponse { FoundEntityRedirects(Vec), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -150,8 +150,6 @@ pub enum GetContainerRevisionResponse { FoundEntityRevision(models::ContainerEntity), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -164,8 +162,6 @@ pub enum LookupContainerResponse { FoundEntity(models::ContainerEntity), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -180,6 +176,8 @@ pub enum UpdateContainerResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -194,6 +192,8 @@ pub enum CreateCreatorResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -208,6 +208,8 @@ pub enum CreateCreatorBatchResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -222,6 +224,8 @@ pub enum DeleteCreatorResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -236,6 +240,8 @@ pub enum DeleteCreatorEditResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -248,8 +254,6 @@ pub enum GetCreatorResponse { FoundEntity(models::CreatorEntity), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -262,8 +266,6 @@ pub enum GetCreatorEditResponse { FoundEdit(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -276,8 +278,6 @@ pub enum GetCreatorHistoryResponse { FoundEntityHistory(Vec), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -290,8 +290,6 @@ pub enum GetCreatorRedirectsResponse { FoundEntityRedirects(Vec), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -304,8 +302,6 @@ pub enum GetCreatorReleasesResponse { Found(Vec), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -318,8 +314,6 @@ pub enum GetCreatorRevisionResponse { FoundEntityRevision(models::CreatorEntity), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -332,8 +326,6 @@ pub enum LookupCreatorResponse { FoundEntity(models::CreatorEntity), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -348,6 +340,8 @@ pub enum UpdateCreatorResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -384,6 +378,10 @@ pub enum AcceptEditgroupResponse { MergedSuccessfully(models::Success), /// Bad Request BadRequest(models::ErrorResponse), + /// Not Authorized + NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Edit Conflict @@ -398,6 +396,10 @@ pub enum CreateEditgroupResponse { SuccessfullyCreated(models::Editgroup), /// Bad Request BadRequest(models::ErrorResponse), + /// Not Authorized + NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } @@ -440,6 +442,8 @@ pub enum CreateFileResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -454,6 +458,8 @@ pub enum CreateFileBatchResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -468,6 +474,8 @@ pub enum DeleteFileResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -482,6 +490,8 @@ pub enum DeleteFileEditResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -494,8 +504,6 @@ pub enum GetFileResponse { FoundEntity(models::FileEntity), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -508,8 +516,6 @@ pub enum GetFileEditResponse { FoundEdit(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -522,8 +528,6 @@ pub enum GetFileHistoryResponse { FoundEntityHistory(Vec), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -536,8 +540,6 @@ pub enum GetFileRedirectsResponse { FoundEntityRedirects(Vec), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -550,8 +552,6 @@ pub enum GetFileRevisionResponse { FoundEntityRevision(models::FileEntity), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -564,8 +564,6 @@ pub enum LookupFileResponse { FoundEntity(models::FileEntity), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -580,6 +578,8 @@ pub enum UpdateFileResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -594,6 +594,8 @@ pub enum CreateFilesetResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -608,6 +610,8 @@ pub enum CreateFilesetBatchResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -622,6 +626,8 @@ pub enum DeleteFilesetResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -636,6 +642,8 @@ pub enum DeleteFilesetEditResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -648,8 +656,6 @@ pub enum GetFilesetResponse { FoundEntity(models::FilesetEntity), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -662,8 +668,6 @@ pub enum GetFilesetEditResponse { FoundEdit(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -676,8 +680,6 @@ pub enum GetFilesetHistoryResponse { FoundEntityHistory(Vec), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -690,8 +692,6 @@ pub enum GetFilesetRedirectsResponse { FoundEntityRedirects(Vec), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -704,8 +704,6 @@ pub enum GetFilesetRevisionResponse { FoundEntityRevision(models::FilesetEntity), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -720,6 +718,8 @@ pub enum UpdateFilesetResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -734,6 +734,8 @@ pub enum CreateReleaseResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -748,6 +750,8 @@ pub enum CreateReleaseBatchResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -762,6 +766,8 @@ pub enum CreateWorkResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -776,6 +782,8 @@ pub enum DeleteReleaseResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -790,6 +798,8 @@ pub enum DeleteReleaseEditResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -802,8 +812,6 @@ pub enum GetReleaseResponse { FoundEntity(models::ReleaseEntity), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -816,8 +824,6 @@ pub enum GetReleaseEditResponse { FoundEdit(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -830,8 +836,6 @@ pub enum GetReleaseFilesResponse { Found(Vec), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -844,8 +848,6 @@ pub enum GetReleaseFilesetsResponse { Found(Vec), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -858,8 +860,6 @@ pub enum GetReleaseHistoryResponse { FoundEntityHistory(Vec), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -872,8 +872,6 @@ pub enum GetReleaseRedirectsResponse { FoundEntityRedirects(Vec), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -886,8 +884,6 @@ pub enum GetReleaseRevisionResponse { FoundEntityRevision(models::ReleaseEntity), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -900,8 +896,6 @@ pub enum GetReleaseWebcapturesResponse { Found(Vec), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -914,8 +908,6 @@ pub enum LookupReleaseResponse { FoundEntity(models::ReleaseEntity), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -930,6 +922,8 @@ pub enum UpdateReleaseResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -944,6 +938,8 @@ pub enum CreateWebcaptureResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -958,6 +954,8 @@ pub enum CreateWebcaptureBatchResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -972,6 +970,8 @@ pub enum DeleteWebcaptureResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -986,6 +986,8 @@ pub enum DeleteWebcaptureEditResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -998,8 +1000,6 @@ pub enum GetWebcaptureResponse { FoundEntity(models::WebcaptureEntity), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -1012,8 +1012,6 @@ pub enum GetWebcaptureEditResponse { FoundEdit(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -1026,8 +1024,6 @@ pub enum GetWebcaptureHistoryResponse { FoundEntityHistory(Vec), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -1040,8 +1036,6 @@ pub enum GetWebcaptureRedirectsResponse { FoundEntityRedirects(Vec), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -1054,8 +1048,6 @@ pub enum GetWebcaptureRevisionResponse { FoundEntityRevision(models::WebcaptureEntity), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -1070,6 +1062,8 @@ pub enum UpdateWebcaptureResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -1084,6 +1078,8 @@ pub enum CreateWorkBatchResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -1098,6 +1094,8 @@ pub enum DeleteWorkResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -1112,6 +1110,8 @@ pub enum DeleteWorkEditResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -1124,8 +1124,6 @@ pub enum GetWorkResponse { FoundEntity(models::WorkEntity), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -1138,8 +1136,6 @@ pub enum GetWorkEditResponse { FoundEdit(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -1152,8 +1148,6 @@ pub enum GetWorkHistoryResponse { FoundEntityHistory(Vec), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -1166,8 +1160,6 @@ pub enum GetWorkRedirectsResponse { FoundEntityRedirects(Vec), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -1180,8 +1172,6 @@ pub enum GetWorkReleasesResponse { Found(Vec), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -1194,8 +1184,6 @@ pub enum GetWorkRevisionResponse { FoundEntityRevision(models::WorkEntity), /// Bad Request BadRequest(models::ErrorResponse), - /// Not Authorized - NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, /// Not Found NotFound(models::ErrorResponse), /// Generic Error @@ -1210,6 +1198,8 @@ pub enum UpdateWorkResponse { BadRequest(models::ErrorResponse), /// Not Authorized NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error diff --git a/rust/fatcat-api-spec/src/mimetypes.rs b/rust/fatcat-api-spec/src/mimetypes.rs index 772a1066..77a66c46 100644 --- a/rust/fatcat-api-spec/src/mimetypes.rs +++ b/rust/fatcat-api-spec/src/mimetypes.rs @@ -17,6 +17,10 @@ pub mod responses { pub static ref CREATE_CONTAINER_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreateContainer + lazy_static! { + pub static ref CREATE_CONTAINER_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateContainer lazy_static! { pub static ref CREATE_CONTAINER_NOT_FOUND: Mime = mime!(Application / Json); } @@ -37,6 +41,10 @@ pub mod responses { pub static ref CREATE_CONTAINER_BATCH_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreateContainerBatch + lazy_static! { + pub static ref CREATE_CONTAINER_BATCH_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateContainerBatch lazy_static! { pub static ref CREATE_CONTAINER_BATCH_NOT_FOUND: Mime = mime!(Application / Json); } @@ -57,6 +65,10 @@ pub mod responses { pub static ref DELETE_CONTAINER_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for DeleteContainer + lazy_static! { + pub static ref DELETE_CONTAINER_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteContainer lazy_static! { pub static ref DELETE_CONTAINER_NOT_FOUND: Mime = mime!(Application / Json); } @@ -77,6 +89,10 @@ pub mod responses { pub static ref DELETE_CONTAINER_EDIT_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for DeleteContainerEdit + lazy_static! { + pub static ref DELETE_CONTAINER_EDIT_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteContainerEdit lazy_static! { pub static ref DELETE_CONTAINER_EDIT_NOT_FOUND: Mime = mime!(Application / Json); } @@ -93,10 +109,6 @@ pub mod responses { pub static ref GET_CONTAINER_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetContainer - lazy_static! { - pub static ref GET_CONTAINER_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetContainer lazy_static! { pub static ref GET_CONTAINER_NOT_FOUND: Mime = mime!(Application / Json); } @@ -113,10 +125,6 @@ pub mod responses { pub static ref GET_CONTAINER_EDIT_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetContainerEdit - lazy_static! { - pub static ref GET_CONTAINER_EDIT_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetContainerEdit lazy_static! { pub static ref GET_CONTAINER_EDIT_NOT_FOUND: Mime = mime!(Application / Json); } @@ -133,10 +141,6 @@ pub mod responses { pub static ref GET_CONTAINER_HISTORY_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetContainerHistory - lazy_static! { - pub static ref GET_CONTAINER_HISTORY_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetContainerHistory lazy_static! { pub static ref GET_CONTAINER_HISTORY_NOT_FOUND: Mime = mime!(Application / Json); } @@ -153,10 +157,6 @@ pub mod responses { pub static ref GET_CONTAINER_REDIRECTS_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetContainerRedirects - lazy_static! { - pub static ref GET_CONTAINER_REDIRECTS_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetContainerRedirects lazy_static! { pub static ref GET_CONTAINER_REDIRECTS_NOT_FOUND: Mime = mime!(Application / Json); } @@ -173,10 +173,6 @@ pub mod responses { pub static ref GET_CONTAINER_REVISION_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetContainerRevision - lazy_static! { - pub static ref GET_CONTAINER_REVISION_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetContainerRevision lazy_static! { pub static ref GET_CONTAINER_REVISION_NOT_FOUND: Mime = mime!(Application / Json); } @@ -193,10 +189,6 @@ pub mod responses { pub static ref LOOKUP_CONTAINER_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for LookupContainer - lazy_static! { - pub static ref LOOKUP_CONTAINER_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for LookupContainer lazy_static! { pub static ref LOOKUP_CONTAINER_NOT_FOUND: Mime = mime!(Application / Json); } @@ -217,6 +209,10 @@ pub mod responses { pub static ref UPDATE_CONTAINER_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for UpdateContainer + lazy_static! { + pub static ref UPDATE_CONTAINER_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for UpdateContainer lazy_static! { pub static ref UPDATE_CONTAINER_NOT_FOUND: Mime = mime!(Application / Json); } @@ -237,6 +233,10 @@ pub mod responses { pub static ref CREATE_CREATOR_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreateCreator + lazy_static! { + pub static ref CREATE_CREATOR_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateCreator lazy_static! { pub static ref CREATE_CREATOR_NOT_FOUND: Mime = mime!(Application / Json); } @@ -257,6 +257,10 @@ pub mod responses { pub static ref CREATE_CREATOR_BATCH_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreateCreatorBatch + lazy_static! { + pub static ref CREATE_CREATOR_BATCH_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateCreatorBatch lazy_static! { pub static ref CREATE_CREATOR_BATCH_NOT_FOUND: Mime = mime!(Application / Json); } @@ -277,6 +281,10 @@ pub mod responses { pub static ref DELETE_CREATOR_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for DeleteCreator + lazy_static! { + pub static ref DELETE_CREATOR_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteCreator lazy_static! { pub static ref DELETE_CREATOR_NOT_FOUND: Mime = mime!(Application / Json); } @@ -297,6 +305,10 @@ pub mod responses { pub static ref DELETE_CREATOR_EDIT_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for DeleteCreatorEdit + lazy_static! { + pub static ref DELETE_CREATOR_EDIT_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteCreatorEdit lazy_static! { pub static ref DELETE_CREATOR_EDIT_NOT_FOUND: Mime = mime!(Application / Json); } @@ -313,10 +325,6 @@ pub mod responses { pub static ref GET_CREATOR_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetCreator - lazy_static! { - pub static ref GET_CREATOR_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetCreator lazy_static! { pub static ref GET_CREATOR_NOT_FOUND: Mime = mime!(Application / Json); } @@ -333,10 +341,6 @@ pub mod responses { pub static ref GET_CREATOR_EDIT_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetCreatorEdit - lazy_static! { - pub static ref GET_CREATOR_EDIT_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetCreatorEdit lazy_static! { pub static ref GET_CREATOR_EDIT_NOT_FOUND: Mime = mime!(Application / Json); } @@ -353,10 +357,6 @@ pub mod responses { pub static ref GET_CREATOR_HISTORY_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetCreatorHistory - lazy_static! { - pub static ref GET_CREATOR_HISTORY_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetCreatorHistory lazy_static! { pub static ref GET_CREATOR_HISTORY_NOT_FOUND: Mime = mime!(Application / Json); } @@ -373,10 +373,6 @@ pub mod responses { pub static ref GET_CREATOR_REDIRECTS_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetCreatorRedirects - lazy_static! { - pub static ref GET_CREATOR_REDIRECTS_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetCreatorRedirects lazy_static! { pub static ref GET_CREATOR_REDIRECTS_NOT_FOUND: Mime = mime!(Application / Json); } @@ -393,10 +389,6 @@ pub mod responses { pub static ref GET_CREATOR_RELEASES_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetCreatorReleases - lazy_static! { - pub static ref GET_CREATOR_RELEASES_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetCreatorReleases lazy_static! { pub static ref GET_CREATOR_RELEASES_NOT_FOUND: Mime = mime!(Application / Json); } @@ -413,10 +405,6 @@ pub mod responses { pub static ref GET_CREATOR_REVISION_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetCreatorRevision - lazy_static! { - pub static ref GET_CREATOR_REVISION_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetCreatorRevision lazy_static! { pub static ref GET_CREATOR_REVISION_NOT_FOUND: Mime = mime!(Application / Json); } @@ -433,10 +421,6 @@ pub mod responses { pub static ref LOOKUP_CREATOR_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for LookupCreator - lazy_static! { - pub static ref LOOKUP_CREATOR_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for LookupCreator lazy_static! { pub static ref LOOKUP_CREATOR_NOT_FOUND: Mime = mime!(Application / Json); } @@ -457,6 +441,10 @@ pub mod responses { pub static ref UPDATE_CREATOR_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for UpdateCreator + lazy_static! { + pub static ref UPDATE_CREATOR_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for UpdateCreator lazy_static! { pub static ref UPDATE_CREATOR_NOT_FOUND: Mime = mime!(Application / Json); } @@ -505,6 +493,14 @@ pub mod responses { pub static ref ACCEPT_EDITGROUP_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for AcceptEditgroup + lazy_static! { + pub static ref ACCEPT_EDITGROUP_NOT_AUTHORIZED: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for AcceptEditgroup + lazy_static! { + pub static ref ACCEPT_EDITGROUP_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for AcceptEditgroup lazy_static! { pub static ref ACCEPT_EDITGROUP_NOT_FOUND: Mime = mime!(Application / Json); } @@ -525,6 +521,14 @@ pub mod responses { pub static ref CREATE_EDITGROUP_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreateEditgroup + lazy_static! { + pub static ref CREATE_EDITGROUP_NOT_AUTHORIZED: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateEditgroup + lazy_static! { + pub static ref CREATE_EDITGROUP_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateEditgroup lazy_static! { pub static ref CREATE_EDITGROUP_GENERIC_ERROR: Mime = mime!(Application / Json); } @@ -577,6 +581,10 @@ pub mod responses { pub static ref CREATE_FILE_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreateFile + lazy_static! { + pub static ref CREATE_FILE_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateFile lazy_static! { pub static ref CREATE_FILE_NOT_FOUND: Mime = mime!(Application / Json); } @@ -597,6 +605,10 @@ pub mod responses { pub static ref CREATE_FILE_BATCH_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreateFileBatch + lazy_static! { + pub static ref CREATE_FILE_BATCH_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateFileBatch lazy_static! { pub static ref CREATE_FILE_BATCH_NOT_FOUND: Mime = mime!(Application / Json); } @@ -617,6 +629,10 @@ pub mod responses { pub static ref DELETE_FILE_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for DeleteFile + lazy_static! { + pub static ref DELETE_FILE_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteFile lazy_static! { pub static ref DELETE_FILE_NOT_FOUND: Mime = mime!(Application / Json); } @@ -637,6 +653,10 @@ pub mod responses { pub static ref DELETE_FILE_EDIT_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for DeleteFileEdit + lazy_static! { + pub static ref DELETE_FILE_EDIT_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteFileEdit lazy_static! { pub static ref DELETE_FILE_EDIT_NOT_FOUND: Mime = mime!(Application / Json); } @@ -653,10 +673,6 @@ pub mod responses { pub static ref GET_FILE_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetFile - lazy_static! { - pub static ref GET_FILE_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetFile lazy_static! { pub static ref GET_FILE_NOT_FOUND: Mime = mime!(Application / Json); } @@ -673,10 +689,6 @@ pub mod responses { pub static ref GET_FILE_EDIT_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetFileEdit - lazy_static! { - pub static ref GET_FILE_EDIT_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetFileEdit lazy_static! { pub static ref GET_FILE_EDIT_NOT_FOUND: Mime = mime!(Application / Json); } @@ -693,10 +705,6 @@ pub mod responses { pub static ref GET_FILE_HISTORY_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetFileHistory - lazy_static! { - pub static ref GET_FILE_HISTORY_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetFileHistory lazy_static! { pub static ref GET_FILE_HISTORY_NOT_FOUND: Mime = mime!(Application / Json); } @@ -713,10 +721,6 @@ pub mod responses { pub static ref GET_FILE_REDIRECTS_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetFileRedirects - lazy_static! { - pub static ref GET_FILE_REDIRECTS_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetFileRedirects lazy_static! { pub static ref GET_FILE_REDIRECTS_NOT_FOUND: Mime = mime!(Application / Json); } @@ -733,10 +737,6 @@ pub mod responses { pub static ref GET_FILE_REVISION_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetFileRevision - lazy_static! { - pub static ref GET_FILE_REVISION_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetFileRevision lazy_static! { pub static ref GET_FILE_REVISION_NOT_FOUND: Mime = mime!(Application / Json); } @@ -753,10 +753,6 @@ pub mod responses { pub static ref LOOKUP_FILE_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for LookupFile - lazy_static! { - pub static ref LOOKUP_FILE_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for LookupFile lazy_static! { pub static ref LOOKUP_FILE_NOT_FOUND: Mime = mime!(Application / Json); } @@ -777,6 +773,10 @@ pub mod responses { pub static ref UPDATE_FILE_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for UpdateFile + lazy_static! { + pub static ref UPDATE_FILE_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for UpdateFile lazy_static! { pub static ref UPDATE_FILE_NOT_FOUND: Mime = mime!(Application / Json); } @@ -797,6 +797,10 @@ pub mod responses { pub static ref CREATE_FILESET_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreateFileset + lazy_static! { + pub static ref CREATE_FILESET_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateFileset lazy_static! { pub static ref CREATE_FILESET_NOT_FOUND: Mime = mime!(Application / Json); } @@ -817,6 +821,10 @@ pub mod responses { pub static ref CREATE_FILESET_BATCH_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreateFilesetBatch + lazy_static! { + pub static ref CREATE_FILESET_BATCH_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateFilesetBatch lazy_static! { pub static ref CREATE_FILESET_BATCH_NOT_FOUND: Mime = mime!(Application / Json); } @@ -837,6 +845,10 @@ pub mod responses { pub static ref DELETE_FILESET_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for DeleteFileset + lazy_static! { + pub static ref DELETE_FILESET_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteFileset lazy_static! { pub static ref DELETE_FILESET_NOT_FOUND: Mime = mime!(Application / Json); } @@ -857,6 +869,10 @@ pub mod responses { pub static ref DELETE_FILESET_EDIT_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for DeleteFilesetEdit + lazy_static! { + pub static ref DELETE_FILESET_EDIT_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteFilesetEdit lazy_static! { pub static ref DELETE_FILESET_EDIT_NOT_FOUND: Mime = mime!(Application / Json); } @@ -873,10 +889,6 @@ pub mod responses { pub static ref GET_FILESET_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetFileset - lazy_static! { - pub static ref GET_FILESET_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetFileset lazy_static! { pub static ref GET_FILESET_NOT_FOUND: Mime = mime!(Application / Json); } @@ -893,10 +905,6 @@ pub mod responses { pub static ref GET_FILESET_EDIT_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetFilesetEdit - lazy_static! { - pub static ref GET_FILESET_EDIT_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetFilesetEdit lazy_static! { pub static ref GET_FILESET_EDIT_NOT_FOUND: Mime = mime!(Application / Json); } @@ -913,10 +921,6 @@ pub mod responses { pub static ref GET_FILESET_HISTORY_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetFilesetHistory - lazy_static! { - pub static ref GET_FILESET_HISTORY_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetFilesetHistory lazy_static! { pub static ref GET_FILESET_HISTORY_NOT_FOUND: Mime = mime!(Application / Json); } @@ -933,10 +937,6 @@ pub mod responses { pub static ref GET_FILESET_REDIRECTS_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetFilesetRedirects - lazy_static! { - pub static ref GET_FILESET_REDIRECTS_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetFilesetRedirects lazy_static! { pub static ref GET_FILESET_REDIRECTS_NOT_FOUND: Mime = mime!(Application / Json); } @@ -953,10 +953,6 @@ pub mod responses { pub static ref GET_FILESET_REVISION_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetFilesetRevision - lazy_static! { - pub static ref GET_FILESET_REVISION_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetFilesetRevision lazy_static! { pub static ref GET_FILESET_REVISION_NOT_FOUND: Mime = mime!(Application / Json); } @@ -977,6 +973,10 @@ pub mod responses { pub static ref UPDATE_FILESET_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for UpdateFileset + lazy_static! { + pub static ref UPDATE_FILESET_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for UpdateFileset lazy_static! { pub static ref UPDATE_FILESET_NOT_FOUND: Mime = mime!(Application / Json); } @@ -997,6 +997,10 @@ pub mod responses { pub static ref CREATE_RELEASE_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreateRelease + lazy_static! { + pub static ref CREATE_RELEASE_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateRelease lazy_static! { pub static ref CREATE_RELEASE_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1017,6 +1021,10 @@ pub mod responses { pub static ref CREATE_RELEASE_BATCH_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreateReleaseBatch + lazy_static! { + pub static ref CREATE_RELEASE_BATCH_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateReleaseBatch lazy_static! { pub static ref CREATE_RELEASE_BATCH_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1037,6 +1045,10 @@ pub mod responses { pub static ref CREATE_WORK_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreateWork + lazy_static! { + pub static ref CREATE_WORK_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateWork lazy_static! { pub static ref CREATE_WORK_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1057,6 +1069,10 @@ pub mod responses { pub static ref DELETE_RELEASE_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for DeleteRelease + lazy_static! { + pub static ref DELETE_RELEASE_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteRelease lazy_static! { pub static ref DELETE_RELEASE_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1077,6 +1093,10 @@ pub mod responses { pub static ref DELETE_RELEASE_EDIT_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for DeleteReleaseEdit + lazy_static! { + pub static ref DELETE_RELEASE_EDIT_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteReleaseEdit lazy_static! { pub static ref DELETE_RELEASE_EDIT_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1093,10 +1113,6 @@ pub mod responses { pub static ref GET_RELEASE_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetRelease - lazy_static! { - pub static ref GET_RELEASE_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetRelease lazy_static! { pub static ref GET_RELEASE_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1113,10 +1129,6 @@ pub mod responses { pub static ref GET_RELEASE_EDIT_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetReleaseEdit - lazy_static! { - pub static ref GET_RELEASE_EDIT_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetReleaseEdit lazy_static! { pub static ref GET_RELEASE_EDIT_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1133,10 +1145,6 @@ pub mod responses { pub static ref GET_RELEASE_FILES_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetReleaseFiles - lazy_static! { - pub static ref GET_RELEASE_FILES_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetReleaseFiles lazy_static! { pub static ref GET_RELEASE_FILES_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1153,10 +1161,6 @@ pub mod responses { pub static ref GET_RELEASE_FILESETS_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetReleaseFilesets - lazy_static! { - pub static ref GET_RELEASE_FILESETS_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetReleaseFilesets lazy_static! { pub static ref GET_RELEASE_FILESETS_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1173,10 +1177,6 @@ pub mod responses { pub static ref GET_RELEASE_HISTORY_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetReleaseHistory - lazy_static! { - pub static ref GET_RELEASE_HISTORY_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetReleaseHistory lazy_static! { pub static ref GET_RELEASE_HISTORY_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1193,10 +1193,6 @@ pub mod responses { pub static ref GET_RELEASE_REDIRECTS_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetReleaseRedirects - lazy_static! { - pub static ref GET_RELEASE_REDIRECTS_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetReleaseRedirects lazy_static! { pub static ref GET_RELEASE_REDIRECTS_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1213,10 +1209,6 @@ pub mod responses { pub static ref GET_RELEASE_REVISION_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetReleaseRevision - lazy_static! { - pub static ref GET_RELEASE_REVISION_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetReleaseRevision lazy_static! { pub static ref GET_RELEASE_REVISION_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1233,10 +1225,6 @@ pub mod responses { pub static ref GET_RELEASE_WEBCAPTURES_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetReleaseWebcaptures - lazy_static! { - pub static ref GET_RELEASE_WEBCAPTURES_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetReleaseWebcaptures lazy_static! { pub static ref GET_RELEASE_WEBCAPTURES_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1253,10 +1241,6 @@ pub mod responses { pub static ref LOOKUP_RELEASE_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for LookupRelease - lazy_static! { - pub static ref LOOKUP_RELEASE_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for LookupRelease lazy_static! { pub static ref LOOKUP_RELEASE_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1277,6 +1261,10 @@ pub mod responses { pub static ref UPDATE_RELEASE_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for UpdateRelease + lazy_static! { + pub static ref UPDATE_RELEASE_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for UpdateRelease lazy_static! { pub static ref UPDATE_RELEASE_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1297,6 +1285,10 @@ pub mod responses { pub static ref CREATE_WEBCAPTURE_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreateWebcapture + lazy_static! { + pub static ref CREATE_WEBCAPTURE_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateWebcapture lazy_static! { pub static ref CREATE_WEBCAPTURE_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1317,6 +1309,10 @@ pub mod responses { pub static ref CREATE_WEBCAPTURE_BATCH_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreateWebcaptureBatch + lazy_static! { + pub static ref CREATE_WEBCAPTURE_BATCH_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateWebcaptureBatch lazy_static! { pub static ref CREATE_WEBCAPTURE_BATCH_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1337,6 +1333,10 @@ pub mod responses { pub static ref DELETE_WEBCAPTURE_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for DeleteWebcapture + lazy_static! { + pub static ref DELETE_WEBCAPTURE_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteWebcapture lazy_static! { pub static ref DELETE_WEBCAPTURE_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1357,6 +1357,10 @@ pub mod responses { pub static ref DELETE_WEBCAPTURE_EDIT_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for DeleteWebcaptureEdit + lazy_static! { + pub static ref DELETE_WEBCAPTURE_EDIT_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteWebcaptureEdit lazy_static! { pub static ref DELETE_WEBCAPTURE_EDIT_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1373,10 +1377,6 @@ pub mod responses { pub static ref GET_WEBCAPTURE_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetWebcapture - lazy_static! { - pub static ref GET_WEBCAPTURE_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetWebcapture lazy_static! { pub static ref GET_WEBCAPTURE_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1393,10 +1393,6 @@ pub mod responses { pub static ref GET_WEBCAPTURE_EDIT_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetWebcaptureEdit - lazy_static! { - pub static ref GET_WEBCAPTURE_EDIT_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetWebcaptureEdit lazy_static! { pub static ref GET_WEBCAPTURE_EDIT_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1413,10 +1409,6 @@ pub mod responses { pub static ref GET_WEBCAPTURE_HISTORY_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetWebcaptureHistory - lazy_static! { - pub static ref GET_WEBCAPTURE_HISTORY_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetWebcaptureHistory lazy_static! { pub static ref GET_WEBCAPTURE_HISTORY_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1433,10 +1425,6 @@ pub mod responses { pub static ref GET_WEBCAPTURE_REDIRECTS_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetWebcaptureRedirects - lazy_static! { - pub static ref GET_WEBCAPTURE_REDIRECTS_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetWebcaptureRedirects lazy_static! { pub static ref GET_WEBCAPTURE_REDIRECTS_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1453,10 +1441,6 @@ pub mod responses { pub static ref GET_WEBCAPTURE_REVISION_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetWebcaptureRevision - lazy_static! { - pub static ref GET_WEBCAPTURE_REVISION_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetWebcaptureRevision lazy_static! { pub static ref GET_WEBCAPTURE_REVISION_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1477,6 +1461,10 @@ pub mod responses { pub static ref UPDATE_WEBCAPTURE_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for UpdateWebcapture + lazy_static! { + pub static ref UPDATE_WEBCAPTURE_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for UpdateWebcapture lazy_static! { pub static ref UPDATE_WEBCAPTURE_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1497,6 +1485,10 @@ pub mod responses { pub static ref CREATE_WORK_BATCH_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreateWorkBatch + lazy_static! { + pub static ref CREATE_WORK_BATCH_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateWorkBatch lazy_static! { pub static ref CREATE_WORK_BATCH_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1517,6 +1509,10 @@ pub mod responses { pub static ref DELETE_WORK_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for DeleteWork + lazy_static! { + pub static ref DELETE_WORK_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteWork lazy_static! { pub static ref DELETE_WORK_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1537,6 +1533,10 @@ pub mod responses { pub static ref DELETE_WORK_EDIT_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for DeleteWorkEdit + lazy_static! { + pub static ref DELETE_WORK_EDIT_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteWorkEdit lazy_static! { pub static ref DELETE_WORK_EDIT_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1553,10 +1553,6 @@ pub mod responses { pub static ref GET_WORK_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetWork - lazy_static! { - pub static ref GET_WORK_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetWork lazy_static! { pub static ref GET_WORK_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1573,10 +1569,6 @@ pub mod responses { pub static ref GET_WORK_EDIT_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetWorkEdit - lazy_static! { - pub static ref GET_WORK_EDIT_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetWorkEdit lazy_static! { pub static ref GET_WORK_EDIT_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1593,10 +1585,6 @@ pub mod responses { pub static ref GET_WORK_HISTORY_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetWorkHistory - lazy_static! { - pub static ref GET_WORK_HISTORY_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetWorkHistory lazy_static! { pub static ref GET_WORK_HISTORY_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1613,10 +1601,6 @@ pub mod responses { pub static ref GET_WORK_REDIRECTS_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetWorkRedirects - lazy_static! { - pub static ref GET_WORK_REDIRECTS_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetWorkRedirects lazy_static! { pub static ref GET_WORK_REDIRECTS_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1633,10 +1617,6 @@ pub mod responses { pub static ref GET_WORK_RELEASES_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetWorkReleases - lazy_static! { - pub static ref GET_WORK_RELEASES_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetWorkReleases lazy_static! { pub static ref GET_WORK_RELEASES_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1653,10 +1633,6 @@ pub mod responses { pub static ref GET_WORK_REVISION_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for GetWorkRevision - lazy_static! { - pub static ref GET_WORK_REVISION_NOT_AUTHORIZED: Mime = mime!(Application / Json); - } - /// Create Mime objects for the response content types for GetWorkRevision lazy_static! { pub static ref GET_WORK_REVISION_NOT_FOUND: Mime = mime!(Application / Json); } @@ -1677,6 +1653,10 @@ pub mod responses { pub static ref UPDATE_WORK_NOT_AUTHORIZED: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for UpdateWork + lazy_static! { + pub static ref UPDATE_WORK_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for UpdateWork lazy_static! { pub static ref UPDATE_WORK_NOT_FOUND: Mime = mime!(Application / Json); } diff --git a/rust/fatcat-api-spec/src/server.rs b/rust/fatcat-api-spec/src/server.rs index 076652bb..268d194c 100644 --- a/rust/fatcat-api-spec/src/server.rs +++ b/rust/fatcat-api-spec/src/server.rs @@ -183,6 +183,18 @@ where } Ok(response) } + CreateContainerResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } CreateContainerResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -312,6 +324,18 @@ where } Ok(response) } + CreateContainerBatchResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_BATCH_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } CreateContainerBatchResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -424,6 +448,16 @@ where Ok(response) } + DeleteContainerResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_CONTAINER_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } DeleteContainerResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -526,6 +560,16 @@ where Ok(response) } + DeleteContainerEditResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_CONTAINER_EDIT_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } DeleteContainerEditResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -620,19 +664,6 @@ where Ok(response) } - GetContainerResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetContainerResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -722,19 +753,6 @@ where Ok(response) } - GetContainerEditResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_EDIT_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetContainerEditResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -828,19 +846,6 @@ where Ok(response) } - GetContainerHistoryResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_HISTORY_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetContainerHistoryResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -930,19 +935,6 @@ where Ok(response) } - GetContainerRedirectsResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_REDIRECTS_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetContainerRedirectsResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -1037,19 +1029,6 @@ where Ok(response) } - GetContainerRevisionResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_REVISION_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetContainerRevisionResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -1131,19 +1110,6 @@ where Ok(response) } - LookupContainerResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::LOOKUP_CONTAINER_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } LookupContainerResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -1283,6 +1249,18 @@ where } Ok(response) } + UpdateContainerResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::UPDATE_CONTAINER_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } UpdateContainerResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -1411,6 +1389,18 @@ where } Ok(response) } + CreateCreatorResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } CreateCreatorResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -1540,6 +1530,18 @@ where } Ok(response) } + CreateCreatorBatchResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_BATCH_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } CreateCreatorBatchResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -1652,6 +1654,16 @@ where Ok(response) } + DeleteCreatorResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_CREATOR_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } DeleteCreatorResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -1754,6 +1766,16 @@ where Ok(response) } + DeleteCreatorEditResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_CREATOR_EDIT_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } DeleteCreatorEditResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -1848,19 +1870,6 @@ where Ok(response) } - GetCreatorResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetCreatorResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -1950,19 +1959,6 @@ where Ok(response) } - GetCreatorEditResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_EDIT_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetCreatorEditResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -2056,19 +2052,6 @@ where Ok(response) } - GetCreatorHistoryResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_HISTORY_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetCreatorHistoryResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -2158,19 +2141,6 @@ where Ok(response) } - GetCreatorRedirectsResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_REDIRECTS_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetCreatorRedirectsResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -2264,19 +2234,6 @@ where Ok(response) } - GetCreatorReleasesResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_RELEASES_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetCreatorReleasesResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -2371,19 +2328,6 @@ where Ok(response) } - GetCreatorRevisionResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_REVISION_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetCreatorRevisionResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -2465,19 +2409,6 @@ where Ok(response) } - LookupCreatorResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::LOOKUP_CREATOR_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } LookupCreatorResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -2617,6 +2548,18 @@ where } Ok(response) } + UpdateCreatorResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::UPDATE_CREATOR_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } UpdateCreatorResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -2888,6 +2831,29 @@ where Ok(response) } + AcceptEditgroupResponse::NotAuthorized { body, www_authenticate } => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(401), body_string)); + header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } + response.headers.set(ResponseWwwAuthenticate(www_authenticate)); + + response.headers.set(ContentType(mimetypes::responses::ACCEPT_EDITGROUP_NOT_AUTHORIZED.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + AcceptEditgroupResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::ACCEPT_EDITGROUP_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } AcceptEditgroupResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -3001,11 +2967,14 @@ where } Ok(response) } - CreateEditgroupResponse::GenericError(body) => { + CreateEditgroupResponse::NotAuthorized { body, www_authenticate } => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - let mut response = Response::with((status::Status::from_u16(500), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_EDITGROUP_GENERIC_ERROR.clone())); + let mut response = Response::with((status::Status::from_u16(401), body_string)); + header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } + response.headers.set(ResponseWwwAuthenticate(www_authenticate)); + + response.headers.set(ContentType(mimetypes::responses::CREATE_EDITGROUP_NOT_AUTHORIZED.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -3013,12 +2982,36 @@ where } Ok(response) } - }, - Err(_) => { - // Application code returned an error. This should not happen, as the implementation should - // return a valid response. - Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) - } + CreateEditgroupResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_EDITGROUP_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + CreateEditgroupResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_EDITGROUP_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } } } @@ -3343,6 +3336,18 @@ where } Ok(response) } + CreateFileResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } CreateFileResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -3472,6 +3477,18 @@ where } Ok(response) } + CreateFileBatchResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_BATCH_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } CreateFileBatchResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -3584,6 +3601,16 @@ where Ok(response) } + DeleteFileResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_FILE_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } DeleteFileResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -3686,6 +3713,16 @@ where Ok(response) } + DeleteFileEditResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_FILE_EDIT_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } DeleteFileEditResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -3780,19 +3817,6 @@ where Ok(response) } - GetFileResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_FILE_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetFileResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -3882,19 +3906,6 @@ where Ok(response) } - GetFileEditResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_FILE_EDIT_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetFileEditResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -3988,19 +3999,6 @@ where Ok(response) } - GetFileHistoryResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_FILE_HISTORY_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetFileHistoryResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -4090,19 +4088,6 @@ where Ok(response) } - GetFileRedirectsResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_FILE_REDIRECTS_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetFileRedirectsResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -4197,19 +4182,6 @@ where Ok(response) } - GetFileRevisionResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_FILE_REVISION_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetFileRevisionResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -4292,19 +4264,6 @@ where Ok(response) } - LookupFileResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::LOOKUP_FILE_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } LookupFileResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -4444,6 +4403,18 @@ where } Ok(response) } + UpdateFileResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::UPDATE_FILE_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } UpdateFileResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -4570,6 +4541,18 @@ where } Ok(response) } + CreateFilesetResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILESET_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } CreateFilesetResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -4697,6 +4680,18 @@ where } Ok(response) } + CreateFilesetBatchResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILESET_BATCH_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } CreateFilesetBatchResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -4807,6 +4802,16 @@ where Ok(response) } + DeleteFilesetResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_FILESET_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } DeleteFilesetResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -4909,6 +4914,16 @@ where Ok(response) } + DeleteFilesetEditResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_FILESET_EDIT_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } DeleteFilesetEditResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -5003,19 +5018,6 @@ where Ok(response) } - GetFilesetResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_FILESET_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetFilesetResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -5105,19 +5107,6 @@ where Ok(response) } - GetFilesetEditResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_FILESET_EDIT_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetFilesetEditResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -5211,19 +5200,6 @@ where Ok(response) } - GetFilesetHistoryResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_FILESET_HISTORY_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetFilesetHistoryResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -5313,19 +5289,6 @@ where Ok(response) } - GetFilesetRedirectsResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_FILESET_REDIRECTS_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetFilesetRedirectsResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -5420,19 +5383,6 @@ where Ok(response) } - GetFilesetRevisionResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_FILESET_REVISION_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetFilesetRevisionResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -5570,6 +5520,18 @@ where } Ok(response) } + UpdateFilesetResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::UPDATE_FILESET_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } UpdateFilesetResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -5696,6 +5658,18 @@ where } Ok(response) } + CreateReleaseResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } CreateReleaseResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -5823,6 +5797,18 @@ where } Ok(response) } + CreateReleaseBatchResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } CreateReleaseBatchResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -5949,11 +5935,11 @@ where } Ok(response) } - CreateWorkResponse::NotFound(body) => { + CreateWorkResponse::Forbidden(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - let mut response = Response::with((status::Status::from_u16(404), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_NOT_FOUND.clone())); + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_FORBIDDEN.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -5961,12 +5947,24 @@ where } Ok(response) } - CreateWorkResponse::GenericError(body) => { + CreateWorkResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - let mut response = Response::with((status::Status::from_u16(500), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_GENERIC_ERROR.clone())); - + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + CreateWorkResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_GENERIC_ERROR.clone())); + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); @@ -6059,6 +6057,16 @@ where Ok(response) } + DeleteReleaseResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } DeleteReleaseResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -6161,6 +6169,16 @@ where Ok(response) } + DeleteReleaseEditResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_EDIT_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } DeleteReleaseEditResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -6255,19 +6273,6 @@ where Ok(response) } - GetReleaseResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetReleaseResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -6357,19 +6362,6 @@ where Ok(response) } - GetReleaseEditResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_EDIT_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetReleaseEditResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -6463,19 +6455,6 @@ where Ok(response) } - GetReleaseFilesResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_FILES_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetReleaseFilesResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -6569,19 +6548,6 @@ where Ok(response) } - GetReleaseFilesetsResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_FILESETS_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetReleaseFilesetsResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -6675,19 +6641,6 @@ where Ok(response) } - GetReleaseHistoryResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_HISTORY_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetReleaseHistoryResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -6777,19 +6730,6 @@ where Ok(response) } - GetReleaseRedirectsResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REDIRECTS_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetReleaseRedirectsResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -6884,19 +6824,6 @@ where Ok(response) } - GetReleaseRevisionResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REVISION_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetReleaseRevisionResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -6990,19 +6917,6 @@ where Ok(response) } - GetReleaseWebcapturesResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_WEBCAPTURES_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetReleaseWebcapturesResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -7091,19 +7005,6 @@ where Ok(response) } - LookupReleaseResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::LOOKUP_RELEASE_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } LookupReleaseResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -7241,6 +7142,18 @@ where } Ok(response) } + UpdateReleaseResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::UPDATE_RELEASE_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } UpdateReleaseResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -7367,6 +7280,18 @@ where } Ok(response) } + CreateWebcaptureResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_WEBCAPTURE_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } CreateWebcaptureResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -7494,6 +7419,18 @@ where } Ok(response) } + CreateWebcaptureBatchResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_WEBCAPTURE_BATCH_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } CreateWebcaptureBatchResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -7604,6 +7541,16 @@ where Ok(response) } + DeleteWebcaptureResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_WEBCAPTURE_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } DeleteWebcaptureResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -7706,6 +7653,16 @@ where Ok(response) } + DeleteWebcaptureEditResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_WEBCAPTURE_EDIT_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } DeleteWebcaptureEditResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -7800,19 +7757,6 @@ where Ok(response) } - GetWebcaptureResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetWebcaptureResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -7902,19 +7846,6 @@ where Ok(response) } - GetWebcaptureEditResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_EDIT_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetWebcaptureEditResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -8008,19 +7939,6 @@ where Ok(response) } - GetWebcaptureHistoryResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_HISTORY_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetWebcaptureHistoryResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -8110,19 +8028,6 @@ where Ok(response) } - GetWebcaptureRedirectsResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_REDIRECTS_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetWebcaptureRedirectsResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -8217,19 +8122,6 @@ where Ok(response) } - GetWebcaptureRevisionResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_REVISION_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetWebcaptureRevisionResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -8367,6 +8259,18 @@ where } Ok(response) } + UpdateWebcaptureResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::UPDATE_WEBCAPTURE_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } UpdateWebcaptureResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -8494,6 +8398,18 @@ where } Ok(response) } + CreateWorkBatchResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_BATCH_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } CreateWorkBatchResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -8604,6 +8520,16 @@ where Ok(response) } + DeleteWorkResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_WORK_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } DeleteWorkResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -8706,6 +8632,16 @@ where Ok(response) } + DeleteWorkEditResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_WORK_EDIT_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } DeleteWorkEditResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -8800,19 +8736,6 @@ where Ok(response) } - GetWorkResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_WORK_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetWorkResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -8902,19 +8825,6 @@ where Ok(response) } - GetWorkEditResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_WORK_EDIT_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetWorkEditResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -9008,19 +8918,6 @@ where Ok(response) } - GetWorkHistoryResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_WORK_HISTORY_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetWorkHistoryResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -9110,19 +9007,6 @@ where Ok(response) } - GetWorkRedirectsResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_WORK_REDIRECTS_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetWorkRedirectsResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -9216,19 +9100,6 @@ where Ok(response) } - GetWorkReleasesResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_WORK_RELEASES_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetWorkReleasesResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -9323,19 +9194,6 @@ where Ok(response) } - GetWorkRevisionResponse::NotAuthorized { body, www_authenticate } => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(401), body_string)); - header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } - response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - - response.headers.set(ContentType(mimetypes::responses::GET_WORK_REVISION_NOT_AUTHORIZED.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - - Ok(response) - } GetWorkRevisionResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -9473,6 +9331,18 @@ where } Ok(response) } + UpdateWorkResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::UPDATE_WORK_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } UpdateWorkResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); -- cgit v1.2.3 From 42ffee8c583729287aed7eaa6df4b7b121c1f7f6 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 31 Dec 2018 18:05:24 -0800 Subject: make editor_id optional when createding editgroup The editor_id can be infered from auth metadata. --- fatcat-openapi2.yml | 2 -- rust/fatcat-api-spec/README.md | 2 +- rust/fatcat-api-spec/api.yaml | 2 -- rust/fatcat-api-spec/api/swagger.yaml | 2 -- rust/fatcat-api-spec/src/models.rs | 7 ++++--- rust/src/api_server.rs | 6 +++--- rust/src/api_wrappers.rs | 13 +++++++++++++ rust/src/bin/fatcatd.rs | 7 ++++++- rust/src/database_models.rs | 2 +- rust/src/lib.rs | 3 +-- rust/tests/test_api_server_http.rs | 33 +++++++++++++++++++++++++++++++++ rust/tests/test_old_python_tests.rs | 7 +++++-- 12 files changed, 67 insertions(+), 19 deletions(-) (limited to 'rust/fatcat-api-spec/README.md') diff --git a/fatcat-openapi2.yml b/fatcat-openapi2.yml index 98b9e4b0..80db5074 100644 --- a/fatcat-openapi2.yml +++ b/fatcat-openapi2.yml @@ -445,8 +445,6 @@ definitions: example: "zerocool93" editgroup: type: object - required: - - editor_id properties: editgroup_id: <<: *FATCATIDENT diff --git a/rust/fatcat-api-spec/README.md b/rust/fatcat-api-spec/README.md index bed47c45..7e946b16 100644 --- a/rust/fatcat-api-spec/README.md +++ b/rust/fatcat-api-spec/README.md @@ -13,7 +13,7 @@ To see how to make this your own, look here: [README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md) - API version: 0.1.0 -- Build date: 2018-12-31T22:21:53.785Z +- Build date: 2019-01-01T01:45:02.795Z This autogenerated project defines an API crate `fatcat` which contains: * An `Api` trait defining the API in Rust. diff --git a/rust/fatcat-api-spec/api.yaml b/rust/fatcat-api-spec/api.yaml index 98b9e4b0..80db5074 100644 --- a/rust/fatcat-api-spec/api.yaml +++ b/rust/fatcat-api-spec/api.yaml @@ -445,8 +445,6 @@ definitions: example: "zerocool93" editgroup: type: object - required: - - editor_id properties: editgroup_id: <<: *FATCATIDENT diff --git a/rust/fatcat-api-spec/api/swagger.yaml b/rust/fatcat-api-spec/api/swagger.yaml index 670d3551..12bfe192 100644 --- a/rust/fatcat-api-spec/api/swagger.yaml +++ b/rust/fatcat-api-spec/api/swagger.yaml @@ -7598,8 +7598,6 @@ definitions: upperCaseName: "EDITOR" editgroup: type: "object" - required: - - "editor_id" properties: editgroup_id: type: "string" diff --git a/rust/fatcat-api-spec/src/models.rs b/rust/fatcat-api-spec/src/models.rs index 01b4c28e..4d7575b6 100644 --- a/rust/fatcat-api-spec/src/models.rs +++ b/rust/fatcat-api-spec/src/models.rs @@ -190,7 +190,8 @@ pub struct Editgroup { /// base32-encoded unique identifier #[serde(rename = "editor_id")] - pub editor_id: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub editor_id: Option, #[serde(rename = "description")] #[serde(skip_serializing_if = "Option::is_none")] @@ -206,10 +207,10 @@ pub struct Editgroup { } impl Editgroup { - pub fn new(editor_id: String) -> Editgroup { + pub fn new() -> Editgroup { Editgroup { editgroup_id: None, - editor_id: editor_id, + editor_id: None, description: None, extra: None, edits: None, diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs index 853f7bc2..be9f1883 100644 --- a/rust/src/api_server.rs +++ b/rust/src/api_server.rs @@ -384,7 +384,7 @@ impl Server { ) -> Result { let row: EditgroupRow = insert_into(editgroup::table) .values(( - editgroup::editor_id.eq(FatCatId::from_str(&entity.editor_id)?.to_uuid()), + editgroup::editor_id.eq(FatCatId::from_str(&entity.editor_id.unwrap())?.to_uuid()), editgroup::description.eq(entity.description), editgroup::extra_json.eq(entity.extra), )) @@ -392,7 +392,7 @@ impl Server { Ok(Editgroup { editgroup_id: Some(uuid2fcid(&row.id)), - editor_id: uuid2fcid(&row.editor_id), + editor_id: Some(uuid2fcid(&row.editor_id)), description: row.description, edits: None, extra: row.extra_json, @@ -467,7 +467,7 @@ impl Server { let eg = Editgroup { editgroup_id: Some(uuid2fcid(&row.id)), - editor_id: uuid2fcid(&row.editor_id), + editor_id: Some(uuid2fcid(&row.editor_id)), description: row.description, edits: Some(edits), extra: row.extra_json, diff --git a/rust/src/api_wrappers.rs b/rust/src/api_wrappers.rs index ae070e02..3dec1c26 100644 --- a/rust/src/api_wrappers.rs +++ b/rust/src/api_wrappers.rs @@ -988,6 +988,19 @@ impl Api for Server { .auth_confectionary .require_auth(&conn, &context.auth_data)?; auth_context.require_role(FatcatRole::Editor)?; + let mut entity = entity.clone(); + match entity.editor_id.clone() { + Some(editor_id) => { + if !auth_context.has_role(FatcatRole::Admin) { + if editor_id != auth_context.editor_id.to_string() { + bail!("not authorized to create editgroups in others' names"); + } + } + }, + None => { + entity.editor_id = Some(auth_context.editor_id.to_string()); + } + }; self.create_editgroup_handler(entity, &conn) }) { Ok(eg) => CreateEditgroupResponse::SuccessfullyCreated(eg), diff --git a/rust/src/bin/fatcatd.rs b/rust/src/bin/fatcatd.rs index 04f88948..682f5038 100644 --- a/rust/src/bin/fatcatd.rs +++ b/rust/src/bin/fatcatd.rs @@ -45,7 +45,12 @@ fn main() { ); info!( logger, - "all auth keys: {:?}", server.auth_confectionary.root_keys.keys().collect::>(), + "all auth keys: {:?}", + server + .auth_confectionary + .root_keys + .keys() + .collect::>(), ); let mut router = fatcat_api_spec::router(server); diff --git a/rust/src/database_models.rs b/rust/src/database_models.rs index f6cca3e1..7a65f901 100644 --- a/rust/src/database_models.rs +++ b/rust/src/database_models.rs @@ -564,7 +564,7 @@ impl EditgroupRow { pub fn into_model_partial(self) -> Editgroup { Editgroup { editgroup_id: Some(uuid2fcid(&self.id)), - editor_id: uuid2fcid(&self.editor_id), + editor_id: Some(uuid2fcid(&self.editor_id)), description: self.description, extra: self.extra_json, edits: None, diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 7d00641a..b3e6c813 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -134,9 +134,8 @@ pub fn env_confectionary() -> Result { } info!("Loading alt auth key: {}", pair[0]); confectionary.add_keypair(pair[0].to_string(), pair[1].to_string())?; - } - }, + } Err(_) => (), } Ok(confectionary) diff --git a/rust/tests/test_api_server_http.rs b/rust/tests/test_api_server_http.rs index 2160a0a0..d975fe6e 100644 --- a/rust/tests/test_api_server_http.rs +++ b/rust/tests/test_api_server_http.rs @@ -1545,3 +1545,36 @@ fn test_release_types() { Some("release_type"), ); } + +#[test] +fn test_create_editgroup() { + let (headers, router, _conn) = setup_http(); + + // We're authenticated, so don't need to supply editor_id + check_http_response( + request::post( + &format!( + "http://localhost:9411/v0/editgroup", + ), + headers.clone(), + "{}", + &router, + ), + status::Created, + None, + ); + + // But can if we want to + check_http_response( + request::post( + &format!( + "http://localhost:9411/v0/editgroup", + ), + headers.clone(), + r#"{"editor_id": "aaaaaaaaaaaabkvkaaaaaaaaae"}"#, + &router, + ), + status::Created, + None, + ); +} diff --git a/rust/tests/test_old_python_tests.rs b/rust/tests/test_old_python_tests.rs index 1f91c7db..afeff55e 100644 --- a/rust/tests/test_old_python_tests.rs +++ b/rust/tests/test_old_python_tests.rs @@ -22,7 +22,8 @@ fn test_api_rich_create() { let admin_id = "aaaaaaaaaaaabkvkaaaaaaaaae".to_string(); - let mut new_eg = Editgroup::new(admin_id); + let mut new_eg = Editgroup::new(); + new_eg.editor_id = Some(admin_id); new_eg.description = Some("a unit test edit".to_string()); let resp = client.create_editgroup(new_eg).wait().unwrap(); let editgroup_id = match resp { @@ -196,8 +197,10 @@ fn test_merge_works() { let admin_id = "aaaaaaaaaaaabkvkaaaaaaaaae".to_string(); + let mut eg = Editgroup::new(); + eg.editor_id = Some(admin_id); let resp = client - .create_editgroup(Editgroup::new(admin_id)) + .create_editgroup(eg) .wait() .unwrap(); let editgroup_id = match resp { -- cgit v1.2.3 From 7b7e271decb2fbd5858aaae03616aa0da57a9429 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 31 Dec 2018 18:43:22 -0800 Subject: add missing security/auth declarations --- fatcat-openapi2.yml | 50 +++++++++++++++++++++ python/fatcat_client/README.md | 12 +++++- python/fatcat_client/api/default_api.py | 74 ++++++++++++++++---------------- python/fatcat_client/configuration.py | 7 +++ python/fatcat_client/models/editgroup.py | 5 +-- rust/fatcat-api-spec/README.md | 2 +- rust/fatcat-api-spec/api.yaml | 50 +++++++++++++++++++++ rust/fatcat-api-spec/api/swagger.yaml | 50 +++++++++++++++++++++ rust/fatcat-api-spec/src/server.rs | 50 +++++++++++++++++++++ 9 files changed, 258 insertions(+), 42 deletions(-) (limited to 'rust/fatcat-api-spec/README.md') diff --git a/fatcat-openapi2.yml b/fatcat-openapi2.yml index 80db5074..b7f7fbb3 100644 --- a/fatcat-openapi2.yml +++ b/fatcat-openapi2.yml @@ -823,6 +823,8 @@ paths: in: path required: true <<: *FATCATUUID + security: + - Bearer: [] responses: 200: description: Deleted Edit @@ -1102,6 +1104,8 @@ paths: in: path required: true <<: *FATCATUUID + security: + - Bearer: [] responses: 200: description: Deleted Edit @@ -1363,6 +1367,8 @@ paths: in: path required: true <<: *FATCATUUID + security: + - Bearer: [] responses: 200: description: Deleted Edit @@ -1385,6 +1391,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 201: description: Created Entity @@ -1415,6 +1423,8 @@ paths: type: array items: $ref: "#/definitions/fileset_entity" + security: + - Bearer: [] responses: 201: description: Created Entities @@ -1465,6 +1475,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 200: description: Updated Entity @@ -1481,6 +1493,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 200: description: Deleted Entity @@ -1582,6 +1596,8 @@ paths: in: path required: true <<: *FATCATUUID + security: + - Bearer: [] responses: 200: description: Deleted Edit @@ -1604,6 +1620,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 201: description: Created Entity @@ -1634,6 +1652,8 @@ paths: type: array items: $ref: "#/definitions/webcapture_entity" + security: + - Bearer: [] responses: 201: description: Created Entities @@ -1684,6 +1704,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 200: description: Updated Entity @@ -1700,6 +1722,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 200: description: Deleted Entity @@ -1801,6 +1825,8 @@ paths: in: path required: true <<: *FATCATUUID + security: + - Bearer: [] responses: 200: description: Deleted Edit @@ -1823,6 +1849,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 201: description: Created Entity @@ -1853,6 +1881,8 @@ paths: type: array items: $ref: "#/definitions/release_entity" + security: + - Bearer: [] responses: 201: description: Created Entities @@ -1903,6 +1933,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 200: description: Updated Entity @@ -1919,6 +1951,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 200: description: Deleted Entity @@ -2135,6 +2169,8 @@ paths: in: path required: true <<: *FATCATUUID + security: + - Bearer: [] responses: 200: description: Deleted Edit @@ -2157,6 +2193,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 201: description: Created Entity @@ -2187,6 +2225,8 @@ paths: type: array items: $ref: "#/definitions/work_entity" + security: + - Bearer: [] responses: 201: description: Created Entities @@ -2237,6 +2277,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 200: description: Updated Entity @@ -2253,6 +2295,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 200: description: Deleted Entity @@ -2377,6 +2421,8 @@ paths: in: path required: true <<: *FATCATUUID + security: + - Bearer: [] responses: 200: description: Deleted Edit @@ -2447,6 +2493,8 @@ paths: required: true schema: $ref: "#/definitions/editgroup" + security: + - Bearer: [] responses: 201: description: Successfully Created @@ -2498,6 +2546,8 @@ paths: operationId: "accept_editgroup" tags: # TAGLINE - edit-lifecycle # TAGLINE + security: + - Bearer: [] responses: 200: description: Merged Successfully diff --git a/python/fatcat_client/README.md b/python/fatcat_client/README.md index 0f170925..069eb1b4 100644 --- a/python/fatcat_client/README.md +++ b/python/fatcat_client/README.md @@ -50,6 +50,11 @@ import time import fatcat_client from fatcat_client.rest import ApiException from pprint import pprint + +# Configure API key authorization: Bearer +fatcat_client.configuration.api_key['Authorization'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# fatcat_client.configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class api_instance = fatcat_client.DefaultApi() editgroup_id = 'editgroup_id_example' # str | base32-encoded unique identifier @@ -184,7 +189,12 @@ Class | Method | HTTP request | Description ## Documentation For Authorization - All endpoints do not require authorization. + +## Bearer + +- **Type**: API key +- **API key parameter name**: Authorization +- **Location**: HTTP header ## Author diff --git a/python/fatcat_client/api/default_api.py b/python/fatcat_client/api/default_api.py index 9f7edf07..5cb5dc64 100644 --- a/python/fatcat_client/api/default_api.py +++ b/python/fatcat_client/api/default_api.py @@ -120,7 +120,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/editgroup/{editgroup_id}/accept', 'POST', @@ -221,7 +221,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/container', 'POST', @@ -326,7 +326,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/container/batch', 'POST', @@ -427,7 +427,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/creator', 'POST', @@ -532,7 +532,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/creator/batch', 'POST', @@ -629,7 +629,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/editgroup', 'POST', @@ -730,7 +730,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/file', 'POST', @@ -835,7 +835,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/file/batch', 'POST', @@ -936,7 +936,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/fileset', 'POST', @@ -1041,7 +1041,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/fileset/batch', 'POST', @@ -1142,7 +1142,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/release', 'POST', @@ -1247,7 +1247,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/release/batch', 'POST', @@ -1348,7 +1348,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/webcapture', 'POST', @@ -1453,7 +1453,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/webcapture/batch', 'POST', @@ -1554,7 +1554,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/work', 'POST', @@ -1659,7 +1659,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/work/batch', 'POST', @@ -1760,7 +1760,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/container/{ident}', 'DELETE', @@ -1865,7 +1865,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/container/edit/{edit_id}', 'DELETE', @@ -1966,7 +1966,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/creator/{ident}', 'DELETE', @@ -2071,7 +2071,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/creator/edit/{edit_id}', 'DELETE', @@ -2172,7 +2172,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/file/{ident}', 'DELETE', @@ -2277,7 +2277,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/file/edit/{edit_id}', 'DELETE', @@ -2378,7 +2378,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/fileset/{ident}', 'DELETE', @@ -2483,7 +2483,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/fileset/edit/{edit_id}', 'DELETE', @@ -2584,7 +2584,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/release/{ident}', 'DELETE', @@ -2689,7 +2689,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/release/edit/{edit_id}', 'DELETE', @@ -2790,7 +2790,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/webcapture/{ident}', 'DELETE', @@ -2895,7 +2895,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/webcapture/edit/{edit_id}', 'DELETE', @@ -2996,7 +2996,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/work/{ident}', 'DELETE', @@ -3101,7 +3101,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/work/edit/{edit_id}', 'DELETE', @@ -8331,7 +8331,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/container/{ident}', 'PUT', @@ -8440,7 +8440,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/creator/{ident}', 'PUT', @@ -8549,7 +8549,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/file/{ident}', 'PUT', @@ -8658,7 +8658,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/fileset/{ident}', 'PUT', @@ -8767,7 +8767,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/release/{ident}', 'PUT', @@ -8876,7 +8876,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/webcapture/{ident}', 'PUT', @@ -8985,7 +8985,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/work/{ident}', 'PUT', diff --git a/python/fatcat_client/configuration.py b/python/fatcat_client/configuration.py index 1dc47841..69b54edb 100644 --- a/python/fatcat_client/configuration.py +++ b/python/fatcat_client/configuration.py @@ -224,6 +224,13 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)): :return: The Auth Settings information dict. """ return { + 'Bearer': + { + 'type': 'api_key', + 'in': 'header', + 'key': 'Authorization', + 'value': self.get_api_key_with_prefix('Authorization') + }, } diff --git a/python/fatcat_client/models/editgroup.py b/python/fatcat_client/models/editgroup.py index 5b1573ed..4c877685 100644 --- a/python/fatcat_client/models/editgroup.py +++ b/python/fatcat_client/models/editgroup.py @@ -60,7 +60,8 @@ class Editgroup(object): if editgroup_id is not None: self.editgroup_id = editgroup_id - self.editor_id = editor_id + if editor_id is not None: + self.editor_id = editor_id if description is not None: self.description = description if extra is not None: @@ -117,8 +118,6 @@ class Editgroup(object): :param editor_id: The editor_id of this Editgroup. # noqa: E501 :type: str """ - if editor_id is None: - raise ValueError("Invalid value for `editor_id`, must not be `None`") # noqa: E501 if editor_id is not None and len(editor_id) > 26: raise ValueError("Invalid value for `editor_id`, length must be less than or equal to `26`") # noqa: E501 if editor_id is not None and len(editor_id) < 26: diff --git a/rust/fatcat-api-spec/README.md b/rust/fatcat-api-spec/README.md index 7e946b16..4f7f811f 100644 --- a/rust/fatcat-api-spec/README.md +++ b/rust/fatcat-api-spec/README.md @@ -13,7 +13,7 @@ To see how to make this your own, look here: [README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md) - API version: 0.1.0 -- Build date: 2019-01-01T01:45:02.795Z +- Build date: 2019-01-01T02:26:01.855Z This autogenerated project defines an API crate `fatcat` which contains: * An `Api` trait defining the API in Rust. diff --git a/rust/fatcat-api-spec/api.yaml b/rust/fatcat-api-spec/api.yaml index 80db5074..b7f7fbb3 100644 --- a/rust/fatcat-api-spec/api.yaml +++ b/rust/fatcat-api-spec/api.yaml @@ -823,6 +823,8 @@ paths: in: path required: true <<: *FATCATUUID + security: + - Bearer: [] responses: 200: description: Deleted Edit @@ -1102,6 +1104,8 @@ paths: in: path required: true <<: *FATCATUUID + security: + - Bearer: [] responses: 200: description: Deleted Edit @@ -1363,6 +1367,8 @@ paths: in: path required: true <<: *FATCATUUID + security: + - Bearer: [] responses: 200: description: Deleted Edit @@ -1385,6 +1391,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 201: description: Created Entity @@ -1415,6 +1423,8 @@ paths: type: array items: $ref: "#/definitions/fileset_entity" + security: + - Bearer: [] responses: 201: description: Created Entities @@ -1465,6 +1475,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 200: description: Updated Entity @@ -1481,6 +1493,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 200: description: Deleted Entity @@ -1582,6 +1596,8 @@ paths: in: path required: true <<: *FATCATUUID + security: + - Bearer: [] responses: 200: description: Deleted Edit @@ -1604,6 +1620,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 201: description: Created Entity @@ -1634,6 +1652,8 @@ paths: type: array items: $ref: "#/definitions/webcapture_entity" + security: + - Bearer: [] responses: 201: description: Created Entities @@ -1684,6 +1704,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 200: description: Updated Entity @@ -1700,6 +1722,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 200: description: Deleted Entity @@ -1801,6 +1825,8 @@ paths: in: path required: true <<: *FATCATUUID + security: + - Bearer: [] responses: 200: description: Deleted Edit @@ -1823,6 +1849,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 201: description: Created Entity @@ -1853,6 +1881,8 @@ paths: type: array items: $ref: "#/definitions/release_entity" + security: + - Bearer: [] responses: 201: description: Created Entities @@ -1903,6 +1933,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 200: description: Updated Entity @@ -1919,6 +1951,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 200: description: Deleted Entity @@ -2135,6 +2169,8 @@ paths: in: path required: true <<: *FATCATUUID + security: + - Bearer: [] responses: 200: description: Deleted Edit @@ -2157,6 +2193,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 201: description: Created Entity @@ -2187,6 +2225,8 @@ paths: type: array items: $ref: "#/definitions/work_entity" + security: + - Bearer: [] responses: 201: description: Created Entities @@ -2237,6 +2277,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 200: description: Updated Entity @@ -2253,6 +2295,8 @@ paths: in: query required: false type: string + security: + - Bearer: [] responses: 200: description: Deleted Entity @@ -2377,6 +2421,8 @@ paths: in: path required: true <<: *FATCATUUID + security: + - Bearer: [] responses: 200: description: Deleted Edit @@ -2447,6 +2493,8 @@ paths: required: true schema: $ref: "#/definitions/editgroup" + security: + - Bearer: [] responses: 201: description: Successfully Created @@ -2498,6 +2546,8 @@ paths: operationId: "accept_editgroup" tags: # TAGLINE - edit-lifecycle # TAGLINE + security: + - Bearer: [] responses: 200: description: Merged Successfully diff --git a/rust/fatcat-api-spec/api/swagger.yaml b/rust/fatcat-api-spec/api/swagger.yaml index 12bfe192..89017877 100644 --- a/rust/fatcat-api-spec/api/swagger.yaml +++ b/rust/fatcat-api-spec/api/swagger.yaml @@ -860,6 +860,8 @@ paths: uppercase_operation_id: "DELETE_CONTAINER_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "delete_container_edit" uppercase_operation_id: "DELETE_CONTAINER_EDIT" path: "/container/edit/:edit_id" @@ -1768,6 +1770,8 @@ paths: uppercase_operation_id: "DELETE_CREATOR_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "delete_creator_edit" uppercase_operation_id: "DELETE_CREATOR_EDIT" path: "/creator/edit/:edit_id" @@ -2625,6 +2629,8 @@ paths: uppercase_operation_id: "DELETE_FILE_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "delete_file_edit" uppercase_operation_id: "DELETE_FILE_EDIT" path: "/file/edit/:edit_id" @@ -2712,6 +2718,8 @@ paths: uppercase_operation_id: "CREATE_FILESET" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "create_fileset" uppercase_operation_id: "CREATE_FILESET" path: "/fileset" @@ -2812,6 +2820,8 @@ paths: uppercase_operation_id: "CREATE_FILESET_BATCH" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "create_fileset_batch" uppercase_operation_id: "CREATE_FILESET_BATCH" path: "/fileset/batch" @@ -2974,6 +2984,8 @@ paths: uppercase_operation_id: "UPDATE_FILESET" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "update_fileset" uppercase_operation_id: "UPDATE_FILESET" path: "/fileset/:ident" @@ -3055,6 +3067,8 @@ paths: uppercase_operation_id: "DELETE_FILESET" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "delete_fileset" uppercase_operation_id: "DELETE_FILESET" path: "/fileset/:ident" @@ -3384,6 +3398,8 @@ paths: uppercase_operation_id: "DELETE_FILESET_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "delete_fileset_edit" uppercase_operation_id: "DELETE_FILESET_EDIT" path: "/fileset/edit/:edit_id" @@ -3471,6 +3487,8 @@ paths: uppercase_operation_id: "CREATE_WEBCAPTURE" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "create_webcapture" uppercase_operation_id: "CREATE_WEBCAPTURE" path: "/webcapture" @@ -3571,6 +3589,8 @@ paths: uppercase_operation_id: "CREATE_WEBCAPTURE_BATCH" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "create_webcapture_batch" uppercase_operation_id: "CREATE_WEBCAPTURE_BATCH" path: "/webcapture/batch" @@ -3733,6 +3753,8 @@ paths: uppercase_operation_id: "UPDATE_WEBCAPTURE" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "update_webcapture" uppercase_operation_id: "UPDATE_WEBCAPTURE" path: "/webcapture/:ident" @@ -3814,6 +3836,8 @@ paths: uppercase_operation_id: "DELETE_WEBCAPTURE" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "delete_webcapture" uppercase_operation_id: "DELETE_WEBCAPTURE" path: "/webcapture/:ident" @@ -4143,6 +4167,8 @@ paths: uppercase_operation_id: "DELETE_WEBCAPTURE_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "delete_webcapture_edit" uppercase_operation_id: "DELETE_WEBCAPTURE_EDIT" path: "/webcapture/edit/:edit_id" @@ -4230,6 +4256,8 @@ paths: uppercase_operation_id: "CREATE_RELEASE" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "create_release" uppercase_operation_id: "CREATE_RELEASE" path: "/release" @@ -4330,6 +4358,8 @@ paths: uppercase_operation_id: "CREATE_RELEASE_BATCH" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "create_release_batch" uppercase_operation_id: "CREATE_RELEASE_BATCH" path: "/release/batch" @@ -4492,6 +4522,8 @@ paths: uppercase_operation_id: "UPDATE_RELEASE" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "update_release" uppercase_operation_id: "UPDATE_RELEASE" path: "/release/:ident" @@ -4573,6 +4605,8 @@ paths: uppercase_operation_id: "DELETE_RELEASE" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "delete_release" uppercase_operation_id: "DELETE_RELEASE" path: "/release/:ident" @@ -5193,6 +5227,8 @@ paths: uppercase_operation_id: "DELETE_RELEASE_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "delete_release_edit" uppercase_operation_id: "DELETE_RELEASE_EDIT" path: "/release/edit/:edit_id" @@ -5280,6 +5316,8 @@ paths: uppercase_operation_id: "CREATE_WORK" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "create_work" uppercase_operation_id: "CREATE_WORK" path: "/work" @@ -5380,6 +5418,8 @@ paths: uppercase_operation_id: "CREATE_WORK_BATCH" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "create_work_batch" uppercase_operation_id: "CREATE_WORK_BATCH" path: "/work/batch" @@ -5542,6 +5582,8 @@ paths: uppercase_operation_id: "UPDATE_WORK" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "update_work" uppercase_operation_id: "UPDATE_WORK" path: "/work/:ident" @@ -5623,6 +5665,8 @@ paths: uppercase_operation_id: "DELETE_WORK" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "delete_work" uppercase_operation_id: "DELETE_WORK" path: "/work/:ident" @@ -6016,6 +6060,8 @@ paths: uppercase_operation_id: "DELETE_WORK_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "delete_work_edit" uppercase_operation_id: "DELETE_WORK_EDIT" path: "/work/edit/:edit_id" @@ -6194,6 +6240,8 @@ paths: uppercase_operation_id: "CREATE_EDITGROUP" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "create_editgroup" uppercase_operation_id: "CREATE_EDITGROUP" path: "/editgroup" @@ -6341,6 +6389,8 @@ paths: uppercase_operation_id: "ACCEPT_EDITGROUP" uppercase_data_type: "ERRORRESPONSE" producesJson: true + security: + - Bearer: [] operation_id: "accept_editgroup" uppercase_operation_id: "ACCEPT_EDITGROUP" path: "/editgroup/:editgroup_id/accept" diff --git a/rust/fatcat-api-spec/src/server.rs b/rust/fatcat-api-spec/src/server.rs index 268d194c..19e33194 100644 --- a/rust/fatcat-api-spec/src/server.rs +++ b/rust/fatcat-api-spec/src/server.rs @@ -510,6 +510,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Path parameters let param_edit_id = { let param = req @@ -1716,6 +1718,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Path parameters let param_edit_id = { let param = req @@ -2794,6 +2798,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Path parameters let param_editgroup_id = { let param = req @@ -2916,6 +2922,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Body parameters (note that non-required body parameters will ignore garbage // values, rather than causing a 400 response). Produce warning header and logs for // any unused fields. @@ -3663,6 +3671,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Path parameters let param_edit_id = { let param = req @@ -4471,6 +4481,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) let query_params = req.get::().unwrap_or_default(); let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); @@ -4609,6 +4621,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) let query_params = req.get::().unwrap_or_default(); let param_autoaccept = query_params.get("autoaccept").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); @@ -4748,6 +4762,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Path parameters let param_ident = { let param = req @@ -4864,6 +4880,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Path parameters let param_edit_id = { let param = req @@ -5435,6 +5453,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Path parameters let param_ident = { let param = req @@ -5588,6 +5608,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) let query_params = req.get::().unwrap_or_default(); let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); @@ -5726,6 +5748,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) let query_params = req.get::().unwrap_or_default(); let param_autoaccept = query_params.get("autoaccept").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); @@ -5865,6 +5889,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) let query_params = req.get::().unwrap_or_default(); let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); @@ -6003,6 +6029,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Path parameters let param_ident = { let param = req @@ -6119,6 +6147,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Path parameters let param_edit_id = { let param = req @@ -7057,6 +7087,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Path parameters let param_ident = { let param = req @@ -7210,6 +7242,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) let query_params = req.get::().unwrap_or_default(); let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); @@ -7348,6 +7382,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) let query_params = req.get::().unwrap_or_default(); let param_autoaccept = query_params.get("autoaccept").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); @@ -7487,6 +7523,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Path parameters let param_ident = { let param = req @@ -7603,6 +7641,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Path parameters let param_edit_id = { let param = req @@ -8174,6 +8214,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Path parameters let param_ident = { let param = req @@ -8327,6 +8369,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) let query_params = req.get::().unwrap_or_default(); let param_autoaccept = query_params.get("autoaccept").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); @@ -8466,6 +8510,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Path parameters let param_ident = { let param = req @@ -8582,6 +8628,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Path parameters let param_edit_id = { let param = req @@ -9246,6 +9294,8 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + // Path parameters let param_ident = { let param = req -- cgit v1.2.3 From 2ff1adeeb85c23df1dd6de3c2dd9ebede2a04954 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 3 Jan 2019 16:52:42 -0800 Subject: crude /auth/oidc endpoint (and codegen) --- fatcat-openapi2.yml | 65 ++++++++ rust/fatcat-api-spec/README.md | 3 +- rust/fatcat-api-spec/api.yaml | 65 ++++++++ rust/fatcat-api-spec/api/swagger.yaml | 133 ++++++++++++++++ rust/fatcat-api-spec/examples/client.rs | 8 +- rust/fatcat-api-spec/examples/server_lib/server.rs | 30 ++-- rust/fatcat-api-spec/src/client.rs | 118 ++++++++++++-- rust/fatcat-api-spec/src/lib.rs | 26 ++++ rust/fatcat-api-spec/src/mimetypes.rs | 32 ++++ rust/fatcat-api-spec/src/models.rs | 57 ++++++- rust/fatcat-api-spec/src/server.rs | 172 +++++++++++++++++++-- 11 files changed, 670 insertions(+), 39 deletions(-) (limited to 'rust/fatcat-api-spec/README.md') diff --git a/fatcat-openapi2.yml b/fatcat-openapi2.yml index b7f7fbb3..fcef1c46 100644 --- a/fatcat-openapi2.yml +++ b/fatcat-openapi2.yml @@ -443,6 +443,12 @@ definitions: username: type: string example: "zerocool93" + is_admin: + type: boolean + is_bot: + type: boolean + is_active: + type: boolean editgroup: type: object properties: @@ -546,6 +552,29 @@ definitions: additionalProperties: {} role: type: string + auth_oidc: + type: object + required: + - provider + - sub + - iss + properties: + provider: + type: string + sub: + type: string + iss: + type: string + auth_oidc_result: + type: object + required: + - editor + - token + properties: + editor: + $ref: "#/definitions/editor" + token: + type: string x-auth-responses: &AUTHRESPONSES 401: @@ -2616,3 +2645,39 @@ paths: description: Generic Error schema: $ref: "#/definitions/error_response" + /auth/oidc: + post: + operationId: "auth_oidc" + tags: # TAGLINE + security: + # required admin privs + - Bearer: [] + parameters: + - name: oidc_params + in: body + required: true + schema: + $ref: "#/definitions/auth_oidc" + responses: + 200: + description: Found + schema: + $ref: "#/definitions/auth_oidc_result" + 201: + description: Created + schema: + $ref: "#/definitions/auth_oidc_result" + 400: + description: Bad Request + schema: + $ref: "#/definitions/error_response" + 409: + description: Conflict + schema: + $ref: "#/definitions/error_response" + 500: + description: Generic Error + schema: + $ref: "#/definitions/error_response" + <<: *AUTHRESPONSES + diff --git a/rust/fatcat-api-spec/README.md b/rust/fatcat-api-spec/README.md index 4f7f811f..e4fba05b 100644 --- a/rust/fatcat-api-spec/README.md +++ b/rust/fatcat-api-spec/README.md @@ -13,7 +13,7 @@ To see how to make this your own, look here: [README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md) - API version: 0.1.0 -- Build date: 2019-01-01T02:26:01.855Z +- Build date: 2019-01-04T00:25:33.063Z This autogenerated project defines an API crate `fatcat` which contains: * An `Api` trait defining the API in Rust. @@ -79,6 +79,7 @@ cargo run --example client GetCreatorReleases cargo run --example client GetCreatorRevision cargo run --example client LookupCreator cargo run --example client UpdateCreator +cargo run --example client AuthOidc cargo run --example client GetEditor cargo run --example client GetEditorChangelog cargo run --example client AcceptEditgroup diff --git a/rust/fatcat-api-spec/api.yaml b/rust/fatcat-api-spec/api.yaml index b7f7fbb3..fcef1c46 100644 --- a/rust/fatcat-api-spec/api.yaml +++ b/rust/fatcat-api-spec/api.yaml @@ -443,6 +443,12 @@ definitions: username: type: string example: "zerocool93" + is_admin: + type: boolean + is_bot: + type: boolean + is_active: + type: boolean editgroup: type: object properties: @@ -546,6 +552,29 @@ definitions: additionalProperties: {} role: type: string + auth_oidc: + type: object + required: + - provider + - sub + - iss + properties: + provider: + type: string + sub: + type: string + iss: + type: string + auth_oidc_result: + type: object + required: + - editor + - token + properties: + editor: + $ref: "#/definitions/editor" + token: + type: string x-auth-responses: &AUTHRESPONSES 401: @@ -2616,3 +2645,39 @@ paths: description: Generic Error schema: $ref: "#/definitions/error_response" + /auth/oidc: + post: + operationId: "auth_oidc" + tags: # TAGLINE + security: + # required admin privs + - Bearer: [] + parameters: + - name: oidc_params + in: body + required: true + schema: + $ref: "#/definitions/auth_oidc" + responses: + 200: + description: Found + schema: + $ref: "#/definitions/auth_oidc_result" + 201: + description: Created + schema: + $ref: "#/definitions/auth_oidc_result" + 400: + description: Bad Request + schema: + $ref: "#/definitions/error_response" + 409: + description: Conflict + schema: + $ref: "#/definitions/error_response" + 500: + description: Generic Error + schema: + $ref: "#/definitions/error_response" + <<: *AUTHRESPONSES + diff --git a/rust/fatcat-api-spec/api/swagger.yaml b/rust/fatcat-api-spec/api/swagger.yaml index 89017877..f2a58670 100644 --- a/rust/fatcat-api-spec/api/swagger.yaml +++ b/rust/fatcat-api-spec/api/swagger.yaml @@ -6481,6 +6481,97 @@ paths: path: "/changelog/:index" HttpMethod: "Get" httpmethod: "get" + /auth/oidc: + post: + operationId: "auth_oidc" + parameters: + - in: "body" + name: "oidc_params" + required: true + schema: + $ref: "#/definitions/auth_oidc" + uppercase_data_type: "AUTHOIDC" + refName: "auth_oidc" + formatString: "{:?}" + example: "???" + model_key: "editgroup_edits" + uppercase_operation_id: "AUTH_OIDC" + consumesJson: true + responses: + 200: + description: "Found" + schema: + $ref: "#/definitions/auth_oidc_result" + x-responseId: "Found" + x-uppercaseResponseId: "FOUND" + uppercase_operation_id: "AUTH_OIDC" + uppercase_data_type: "AUTHOIDCRESULT" + producesJson: true + 201: + description: "Created" + schema: + $ref: "#/definitions/auth_oidc_result" + x-responseId: "Created" + x-uppercaseResponseId: "CREATED" + uppercase_operation_id: "AUTH_OIDC" + uppercase_data_type: "AUTHOIDCRESULT" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "AUTH_OIDC" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 401: + description: "Not Authorized" + schema: + $ref: "#/definitions/error_response" + headers: + WWW_Authenticate: + type: "string" + x-responseId: "NotAuthorized" + x-uppercaseResponseId: "NOT_AUTHORIZED" + uppercase_operation_id: "AUTH_OIDC" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "AUTH_OIDC" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 409: + description: "Conflict" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Conflict" + x-uppercaseResponseId: "CONFLICT" + uppercase_operation_id: "AUTH_OIDC" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "AUTH_OIDC" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + security: + - Bearer: [] + operation_id: "auth_oidc" + uppercase_operation_id: "AUTH_OIDC" + path: "/auth/oidc" + HttpMethod: "Post" + httpmethod: "post" + noClientExample: true securityDefinitions: Bearer: type: "apiKey" @@ -7642,8 +7733,17 @@ definitions: username: type: "string" example: "zerocool93" + is_admin: + type: "boolean" + is_bot: + type: "boolean" + is_active: + type: "boolean" example: + is_admin: true + is_active: true editor_id: "q3nouwy3nnbsvo3h5klxsx4a7y" + is_bot: true username: "zerocool93" upperCaseName: "EDITOR" editgroup: @@ -7988,6 +8088,39 @@ definitions: creator_id: "creator_id" index: 1 upperCaseName: "RELEASE_CONTRIB" + auth_oidc: + type: "object" + required: + - "iss" + - "provider" + - "sub" + properties: + provider: + type: "string" + sub: + type: "string" + iss: + type: "string" + upperCaseName: "AUTH_OIDC" + auth_oidc_result: + type: "object" + required: + - "editor" + - "token" + properties: + editor: + $ref: "#/definitions/editor" + token: + type: "string" + example: + editor: + is_admin: true + is_active: true + editor_id: "q3nouwy3nnbsvo3h5klxsx4a7y" + is_bot: true + username: "zerocool93" + token: "token" + upperCaseName: "AUTH_OIDC_RESULT" file_entity_urls: required: - "rel" diff --git a/rust/fatcat-api-spec/examples/client.rs b/rust/fatcat-api-spec/examples/client.rs index bf0c07b3..d95b4ffd 100644 --- a/rust/fatcat-api-spec/examples/client.rs +++ b/rust/fatcat-api-spec/examples/client.rs @@ -12,7 +12,7 @@ extern crate uuid; use clap::{App, Arg}; #[allow(unused_imports)] use fatcat::{ - AcceptEditgroupResponse, ApiError, ApiNoContext, ContextWrapperExt, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, + AcceptEditgroupResponse, ApiError, ApiNoContext, AuthOidcResponse, ContextWrapperExt, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse, CreateFileBatchResponse, CreateFileResponse, CreateFilesetBatchResponse, CreateFilesetResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWebcaptureBatchResponse, CreateWebcaptureResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, DeleteCreatorEditResponse, DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, @@ -271,6 +271,12 @@ fn main() { // let result = client.update_creator("ident_example".to_string(), ???, Some("editgroup_id_example".to_string())).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); // }, + + // Disabled because there's no example. + // Some("AuthOidc") => { + // let result = client.auth_oidc(???).wait(); + // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + // }, Some("GetEditor") => { let result = client.get_editor("editor_id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); diff --git a/rust/fatcat-api-spec/examples/server_lib/server.rs b/rust/fatcat-api-spec/examples/server_lib/server.rs index a9301650..b6408343 100644 --- a/rust/fatcat-api-spec/examples/server_lib/server.rs +++ b/rust/fatcat-api-spec/examples/server_lib/server.rs @@ -11,18 +11,18 @@ use swagger; use fatcat::models; use fatcat::{ - AcceptEditgroupResponse, Api, ApiError, Context, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse, - CreateFileBatchResponse, CreateFileResponse, CreateFilesetBatchResponse, CreateFilesetResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWebcaptureBatchResponse, - CreateWebcaptureResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, DeleteCreatorEditResponse, DeleteCreatorResponse, - DeleteFileEditResponse, DeleteFileResponse, DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWebcaptureEditResponse, - DeleteWebcaptureResponse, DeleteWorkEditResponse, DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, GetContainerHistoryResponse, - GetContainerRedirectsResponse, GetContainerResponse, GetContainerRevisionResponse, GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, GetCreatorReleasesResponse, - GetCreatorResponse, GetCreatorRevisionResponse, GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, GetFileRedirectsResponse, - GetFileResponse, GetFileRevisionResponse, GetFilesetEditResponse, GetFilesetHistoryResponse, GetFilesetRedirectsResponse, GetFilesetResponse, GetFilesetRevisionResponse, GetReleaseEditResponse, - GetReleaseFilesResponse, GetReleaseFilesetsResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetReleaseWebcapturesResponse, - GetWebcaptureEditResponse, GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, GetWebcaptureResponse, GetWebcaptureRevisionResponse, GetWorkEditResponse, GetWorkHistoryResponse, - GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse, - UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse, + AcceptEditgroupResponse, Api, ApiError, AuthOidcResponse, Context, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, + CreateEditgroupResponse, CreateFileBatchResponse, CreateFileResponse, CreateFilesetBatchResponse, CreateFilesetResponse, CreateReleaseBatchResponse, CreateReleaseResponse, + CreateWebcaptureBatchResponse, CreateWebcaptureResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, DeleteCreatorEditResponse, + DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, + DeleteWebcaptureEditResponse, DeleteWebcaptureResponse, DeleteWorkEditResponse, DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, + GetContainerHistoryResponse, GetContainerRedirectsResponse, GetContainerResponse, GetContainerRevisionResponse, GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, + GetCreatorReleasesResponse, GetCreatorResponse, GetCreatorRevisionResponse, GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, + GetFileRedirectsResponse, GetFileResponse, GetFileRevisionResponse, GetFilesetEditResponse, GetFilesetHistoryResponse, GetFilesetRedirectsResponse, GetFilesetResponse, GetFilesetRevisionResponse, + GetReleaseEditResponse, GetReleaseFilesResponse, GetReleaseFilesetsResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, + GetReleaseWebcapturesResponse, GetWebcaptureEditResponse, GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, GetWebcaptureResponse, GetWebcaptureRevisionResponse, GetWorkEditResponse, + GetWorkHistoryResponse, GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, + LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse, }; #[derive(Copy, Clone)] @@ -296,6 +296,12 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn auth_oidc(&self, oidc_params: models::AuthOidc, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("auth_oidc({:?}) - X-Span-ID: {:?}", oidc_params, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + fn get_editor(&self, editor_id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!("get_editor(\"{}\") - X-Span-ID: {:?}", editor_id, context.x_span_id.unwrap_or(String::from("")).clone()); diff --git a/rust/fatcat-api-spec/src/client.rs b/rust/fatcat-api-spec/src/client.rs index b67e193a..44bcd54d 100644 --- a/rust/fatcat-api-spec/src/client.rs +++ b/rust/fatcat-api-spec/src/client.rs @@ -35,18 +35,18 @@ use swagger::{ApiError, Context, XSpanId}; use models; use { - AcceptEditgroupResponse, Api, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse, CreateFileBatchResponse, - CreateFileResponse, CreateFilesetBatchResponse, CreateFilesetResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWebcaptureBatchResponse, CreateWebcaptureResponse, - CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, DeleteCreatorEditResponse, DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, - DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWebcaptureEditResponse, DeleteWebcaptureResponse, DeleteWorkEditResponse, - DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, GetContainerHistoryResponse, GetContainerRedirectsResponse, GetContainerResponse, - GetContainerRevisionResponse, GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, GetCreatorReleasesResponse, GetCreatorResponse, GetCreatorRevisionResponse, - GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, GetFileRedirectsResponse, GetFileResponse, GetFileRevisionResponse, - GetFilesetEditResponse, GetFilesetHistoryResponse, GetFilesetRedirectsResponse, GetFilesetResponse, GetFilesetRevisionResponse, GetReleaseEditResponse, GetReleaseFilesResponse, - GetReleaseFilesetsResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetReleaseWebcapturesResponse, GetWebcaptureEditResponse, - GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, GetWebcaptureResponse, GetWebcaptureRevisionResponse, GetWorkEditResponse, GetWorkHistoryResponse, GetWorkRedirectsResponse, - GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse, UpdateContainerResponse, - UpdateCreatorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse, + AcceptEditgroupResponse, Api, AuthOidcResponse, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse, + CreateFileBatchResponse, CreateFileResponse, CreateFilesetBatchResponse, CreateFilesetResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWebcaptureBatchResponse, + CreateWebcaptureResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, DeleteCreatorEditResponse, DeleteCreatorResponse, + DeleteFileEditResponse, DeleteFileResponse, DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWebcaptureEditResponse, + DeleteWebcaptureResponse, DeleteWorkEditResponse, DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, GetContainerHistoryResponse, + GetContainerRedirectsResponse, GetContainerResponse, GetContainerRevisionResponse, GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, GetCreatorReleasesResponse, + GetCreatorResponse, GetCreatorRevisionResponse, GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, GetFileRedirectsResponse, + GetFileResponse, GetFileRevisionResponse, GetFilesetEditResponse, GetFilesetHistoryResponse, GetFilesetRedirectsResponse, GetFilesetResponse, GetFilesetRevisionResponse, GetReleaseEditResponse, + GetReleaseFilesResponse, GetReleaseFilesetsResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetReleaseWebcapturesResponse, + GetWebcaptureEditResponse, GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, GetWebcaptureResponse, GetWebcaptureRevisionResponse, GetWorkEditResponse, GetWorkHistoryResponse, + GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse, + UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse, }; /// Convert input into a base path, e.g. "http://example:123". Also checks the scheme as it goes. @@ -2030,6 +2030,100 @@ impl Api for Client { Box::new(futures::done(result)) } + fn auth_oidc(&self, param_oidc_params: models::AuthOidc, context: &Context) -> Box + Send> { + let url = format!("{}/v0/auth/oidc", self.base_path); + + let body = serde_json::to_string(¶m_oidc_params).expect("impossible to fail to serialize"); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Post, &url); + let mut custom_headers = hyper::header::Headers::new(); + + let request = request.body(&body); + + custom_headers.set(ContentType(mimetypes::requests::AUTH_OIDC.clone())); + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(AuthOidcResponse::Found(body)) + } + 201 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(AuthOidcResponse::Created(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(AuthOidcResponse::BadRequest(body)) + } + 401 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } + let response_www_authenticate = response + .headers + .get::() + .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; + + Ok(AuthOidcResponse::NotAuthorized { + body: body, + www_authenticate: response_www_authenticate.0.clone(), + }) + } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(AuthOidcResponse::Forbidden(body)) + } + 409 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(AuthOidcResponse::Conflict(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(AuthOidcResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + fn get_editor(&self, param_editor_id: String, context: &Context) -> Box + Send> { let url = format!( "{}/v0/editor/{editor_id}", diff --git a/rust/fatcat-api-spec/src/lib.rs b/rust/fatcat-api-spec/src/lib.rs index c6126c9c..c89dc90c 100644 --- a/rust/fatcat-api-spec/src/lib.rs +++ b/rust/fatcat-api-spec/src/lib.rs @@ -348,6 +348,24 @@ pub enum UpdateCreatorResponse { GenericError(models::ErrorResponse), } +#[derive(Debug, PartialEq)] +pub enum AuthOidcResponse { + /// Found + Found(models::AuthOidcResult), + /// Created + Created(models::AuthOidcResult), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Authorized + NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), + /// Conflict + Conflict(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + #[derive(Debug, PartialEq)] pub enum GetEditorResponse { /// Found @@ -1281,6 +1299,8 @@ pub trait Api { fn update_creator(&self, ident: String, entity: models::CreatorEntity, editgroup_id: Option, context: &Context) -> Box + Send>; + fn auth_oidc(&self, oidc_params: models::AuthOidc, context: &Context) -> Box + Send>; + fn get_editor(&self, editor_id: String, context: &Context) -> Box + Send>; fn get_editor_changelog(&self, editor_id: String, context: &Context) -> Box + Send>; @@ -1527,6 +1547,8 @@ pub trait ApiNoContext { fn update_creator(&self, ident: String, entity: models::CreatorEntity, editgroup_id: Option) -> Box + Send>; + fn auth_oidc(&self, oidc_params: models::AuthOidc) -> Box + Send>; + fn get_editor(&self, editor_id: String) -> Box + Send>; fn get_editor_changelog(&self, editor_id: String) -> Box + Send>; @@ -1810,6 +1832,10 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().update_creator(ident, entity, editgroup_id, &self.context()) } + fn auth_oidc(&self, oidc_params: models::AuthOidc) -> Box + Send> { + self.api().auth_oidc(oidc_params, &self.context()) + } + fn get_editor(&self, editor_id: String) -> Box + Send> { self.api().get_editor(editor_id, &self.context()) } diff --git a/rust/fatcat-api-spec/src/mimetypes.rs b/rust/fatcat-api-spec/src/mimetypes.rs index 77a66c46..322ab045 100644 --- a/rust/fatcat-api-spec/src/mimetypes.rs +++ b/rust/fatcat-api-spec/src/mimetypes.rs @@ -452,6 +452,34 @@ pub mod responses { lazy_static! { pub static ref UPDATE_CREATOR_GENERIC_ERROR: Mime = mime!(Application / Json); } + /// Create Mime objects for the response content types for AuthOidc + lazy_static! { + pub static ref AUTH_OIDC_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for AuthOidc + lazy_static! { + pub static ref AUTH_OIDC_CREATED: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for AuthOidc + lazy_static! { + pub static ref AUTH_OIDC_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for AuthOidc + lazy_static! { + pub static ref AUTH_OIDC_NOT_AUTHORIZED: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for AuthOidc + lazy_static! { + pub static ref AUTH_OIDC_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for AuthOidc + lazy_static! { + pub static ref AUTH_OIDC_CONFLICT: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for AuthOidc + lazy_static! { + pub static ref AUTH_OIDC_GENERIC_ERROR: Mime = mime!(Application / Json); + } /// Create Mime objects for the response content types for GetEditor lazy_static! { pub static ref GET_EDITOR_FOUND: Mime = mime!(Application / Json); @@ -1693,6 +1721,10 @@ pub mod requests { lazy_static! { pub static ref UPDATE_CREATOR: Mime = mime!(Application / Json); } + /// Create Mime objects for the request content types for AuthOidc + lazy_static! { + pub static ref AUTH_OIDC: Mime = mime!(Application / Json); + } /// Create Mime objects for the request content types for CreateEditgroup lazy_static! { pub static ref CREATE_EDITGROUP: Mime = mime!(Application / Json); diff --git a/rust/fatcat-api-spec/src/models.rs b/rust/fatcat-api-spec/src/models.rs index 4d7575b6..8c17cf66 100644 --- a/rust/fatcat-api-spec/src/models.rs +++ b/rust/fatcat-api-spec/src/models.rs @@ -9,6 +9,43 @@ use models; use std::collections::HashMap; use swagger; +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct AuthOidc { + #[serde(rename = "provider")] + pub provider: String, + + #[serde(rename = "sub")] + pub sub: String, + + #[serde(rename = "iss")] + pub iss: String, +} + +impl AuthOidc { + pub fn new(provider: String, sub: String, iss: String) -> AuthOidc { + AuthOidc { + provider: provider, + sub: sub, + iss: iss, + } + } +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct AuthOidcResult { + #[serde(rename = "editor")] + pub editor: models::Editor, + + #[serde(rename = "token")] + pub token: String, +} + +impl AuthOidcResult { + pub fn new(editor: models::Editor, token: String) -> AuthOidcResult { + AuthOidcResult { editor: editor, token: token } + } +} + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ChangelogEntry { #[serde(rename = "index")] @@ -272,11 +309,29 @@ pub struct Editor { #[serde(rename = "username")] pub username: String, + + #[serde(rename = "is_admin")] + #[serde(skip_serializing_if = "Option::is_none")] + pub is_admin: Option, + + #[serde(rename = "is_bot")] + #[serde(skip_serializing_if = "Option::is_none")] + pub is_bot: Option, + + #[serde(rename = "is_active")] + #[serde(skip_serializing_if = "Option::is_none")] + pub is_active: Option, } impl Editor { pub fn new(username: String) -> Editor { - Editor { editor_id: None, username: username } + Editor { + editor_id: None, + username: username, + is_admin: None, + is_bot: None, + is_active: None, + } } } diff --git a/rust/fatcat-api-spec/src/server.rs b/rust/fatcat-api-spec/src/server.rs index 19e33194..8a515e43 100644 --- a/rust/fatcat-api-spec/src/server.rs +++ b/rust/fatcat-api-spec/src/server.rs @@ -37,18 +37,18 @@ use swagger::{ApiError, Context, XSpanId}; #[allow(unused_imports)] use models; use { - AcceptEditgroupResponse, Api, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse, CreateFileBatchResponse, - CreateFileResponse, CreateFilesetBatchResponse, CreateFilesetResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWebcaptureBatchResponse, CreateWebcaptureResponse, - CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, DeleteCreatorEditResponse, DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, - DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWebcaptureEditResponse, DeleteWebcaptureResponse, DeleteWorkEditResponse, - DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, GetContainerHistoryResponse, GetContainerRedirectsResponse, GetContainerResponse, - GetContainerRevisionResponse, GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, GetCreatorReleasesResponse, GetCreatorResponse, GetCreatorRevisionResponse, - GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, GetFileRedirectsResponse, GetFileResponse, GetFileRevisionResponse, - GetFilesetEditResponse, GetFilesetHistoryResponse, GetFilesetRedirectsResponse, GetFilesetResponse, GetFilesetRevisionResponse, GetReleaseEditResponse, GetReleaseFilesResponse, - GetReleaseFilesetsResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetReleaseWebcapturesResponse, GetWebcaptureEditResponse, - GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, GetWebcaptureResponse, GetWebcaptureRevisionResponse, GetWorkEditResponse, GetWorkHistoryResponse, GetWorkRedirectsResponse, - GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse, UpdateContainerResponse, - UpdateCreatorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse, + AcceptEditgroupResponse, Api, AuthOidcResponse, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse, + CreateFileBatchResponse, CreateFileResponse, CreateFilesetBatchResponse, CreateFilesetResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWebcaptureBatchResponse, + CreateWebcaptureResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, DeleteCreatorEditResponse, DeleteCreatorResponse, + DeleteFileEditResponse, DeleteFileResponse, DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWebcaptureEditResponse, + DeleteWebcaptureResponse, DeleteWorkEditResponse, DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, GetContainerHistoryResponse, + GetContainerRedirectsResponse, GetContainerResponse, GetContainerRevisionResponse, GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, GetCreatorReleasesResponse, + GetCreatorResponse, GetCreatorRevisionResponse, GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, GetFileRedirectsResponse, + GetFileResponse, GetFileRevisionResponse, GetFilesetEditResponse, GetFilesetHistoryResponse, GetFilesetRedirectsResponse, GetFilesetResponse, GetFilesetRevisionResponse, GetReleaseEditResponse, + GetReleaseFilesResponse, GetReleaseFilesetsResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetReleaseWebcapturesResponse, + GetWebcaptureEditResponse, GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, GetWebcaptureResponse, GetWebcaptureRevisionResponse, GetWorkEditResponse, GetWorkHistoryResponse, + GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse, + UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse, }; header! { (Warning, "Warning") => [String] } @@ -2605,6 +2605,154 @@ where "UpdateCreator", ); + let api_clone = api.clone(); + router.post( + "/v0/auth/oidc", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + + // Body parameters (note that non-required body parameters will ignore garbage + // values, rather than causing a 400 response). Produce warning header and logs for + // any unused fields. + + let param_oidc_params = req + .get::() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter oidc_params - not valid UTF-8: {}", e))))?; + + let mut unused_elements = Vec::new(); + + let param_oidc_params = if let Some(param_oidc_params_raw) = param_oidc_params { + let deserializer = &mut serde_json::Deserializer::from_str(¶m_oidc_params_raw); + + let param_oidc_params: Option = serde_ignored::deserialize(deserializer, |path| { + warn!("Ignoring unknown field in body: {}", path); + unused_elements.push(path.to_string()); + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter oidc_params - doesn't match schema: {}", e))))?; + + param_oidc_params + } else { + None + }; + let param_oidc_params = param_oidc_params.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter oidc_params".to_string())))?; + + match api.auth_oidc(param_oidc_params, context).wait() { + Ok(rsp) => match rsp { + AuthOidcResponse::Found(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(200), body_string)); + response.headers.set(ContentType(mimetypes::responses::AUTH_OIDC_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + AuthOidcResponse::Created(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(201), body_string)); + response.headers.set(ContentType(mimetypes::responses::AUTH_OIDC_CREATED.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + AuthOidcResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::AUTH_OIDC_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + AuthOidcResponse::NotAuthorized { body, www_authenticate } => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(401), body_string)); + header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } + response.headers.set(ResponseWwwAuthenticate(www_authenticate)); + + response.headers.set(ContentType(mimetypes::responses::AUTH_OIDC_NOT_AUTHORIZED.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + AuthOidcResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::AUTH_OIDC_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + AuthOidcResponse::Conflict(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(409), body_string)); + response.headers.set(ContentType(mimetypes::responses::AUTH_OIDC_CONFLICT.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + AuthOidcResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::AUTH_OIDC_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "AuthOidc", + ); + let api_clone = api.clone(); router.get( "/v0/editor/:editor_id", -- cgit v1.2.3 From 65fa084379a159db81fc5424deda18013f01194b Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 3 Jan 2019 17:53:04 -0800 Subject: rust codegen --- rust/fatcat-api-spec/README.md | 3 +- rust/fatcat-api-spec/api.yaml | 28 ++++ rust/fatcat-api-spec/api/swagger.yaml | 87 ++++++++++++ rust/fatcat-api-spec/examples/client.rs | 8 +- rust/fatcat-api-spec/examples/server_lib/server.rs | 14 +- rust/fatcat-api-spec/src/client.rs | 93 ++++++++++++- rust/fatcat-api-spec/src/lib.rs | 24 ++++ rust/fatcat-api-spec/src/mimetypes.rs | 28 ++++ rust/fatcat-api-spec/src/server.rs | 153 ++++++++++++++++++++- 9 files changed, 433 insertions(+), 5 deletions(-) (limited to 'rust/fatcat-api-spec/README.md') diff --git a/rust/fatcat-api-spec/README.md b/rust/fatcat-api-spec/README.md index e4fba05b..c33509da 100644 --- a/rust/fatcat-api-spec/README.md +++ b/rust/fatcat-api-spec/README.md @@ -13,7 +13,7 @@ To see how to make this your own, look here: [README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md) - API version: 0.1.0 -- Build date: 2019-01-04T00:25:33.063Z +- Build date: 2019-01-04T01:38:25.420Z This autogenerated project defines an API crate `fatcat` which contains: * An `Api` trait defining the API in Rust. @@ -82,6 +82,7 @@ cargo run --example client UpdateCreator cargo run --example client AuthOidc cargo run --example client GetEditor cargo run --example client GetEditorChangelog +cargo run --example client UpdateEditor cargo run --example client AcceptEditgroup cargo run --example client CreateEditgroup cargo run --example client GetChangelog diff --git a/rust/fatcat-api-spec/api.yaml b/rust/fatcat-api-spec/api.yaml index fcef1c46..b9a61fe4 100644 --- a/rust/fatcat-api-spec/api.yaml +++ b/rust/fatcat-api-spec/api.yaml @@ -2484,6 +2484,34 @@ paths: description: Generic Error schema: $ref: "#/definitions/error_response" + put: + operationId: "update_editor" + parameters: + - name: editor + in: body + required: true + schema: + $ref: "#/definitions/editor" + security: + - Bearer: [] + responses: + 200: + description: Updated Editor + schema: + $ref: "#/definitions/editor" + 400: + description: Bad Request + schema: + $ref: "#/definitions/error_response" + 404: + description: Not Found + schema: + $ref: "#/definitions/error_response" + 500: + description: Generic Error + schema: + $ref: "#/definitions/error_response" + <<: *AUTHRESPONSES /editor/{editor_id}/changelog: parameters: - name: editor_id diff --git a/rust/fatcat-api-spec/api/swagger.yaml b/rust/fatcat-api-spec/api/swagger.yaml index f2a58670..d58785c8 100644 --- a/rust/fatcat-api-spec/api/swagger.yaml +++ b/rust/fatcat-api-spec/api/swagger.yaml @@ -6119,6 +6119,93 @@ paths: path: "/editor/:editor_id" HttpMethod: "Get" httpmethod: "get" + put: + operationId: "update_editor" + parameters: + - name: "editor_id" + in: "path" + required: true + type: "string" + formatString: "\\\"{}\\\"" + example: "\"editor_id_example\".to_string()" + - in: "body" + name: "editor" + required: true + schema: + $ref: "#/definitions/editor" + uppercase_data_type: "EDITOR" + refName: "editor" + formatString: "{:?}" + example: "???" + model_key: "editgroup_edits" + uppercase_operation_id: "UPDATE_EDITOR" + consumesJson: true + responses: + 200: + description: "Updated Editor" + schema: + $ref: "#/definitions/editor" + x-responseId: "UpdatedEditor" + x-uppercaseResponseId: "UPDATED_EDITOR" + uppercase_operation_id: "UPDATE_EDITOR" + uppercase_data_type: "EDITOR" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "UPDATE_EDITOR" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 401: + description: "Not Authorized" + schema: + $ref: "#/definitions/error_response" + headers: + WWW_Authenticate: + type: "string" + x-responseId: "NotAuthorized" + x-uppercaseResponseId: "NOT_AUTHORIZED" + uppercase_operation_id: "UPDATE_EDITOR" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "UPDATE_EDITOR" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "UPDATE_EDITOR" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "UPDATE_EDITOR" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + security: + - Bearer: [] + operation_id: "update_editor" + uppercase_operation_id: "UPDATE_EDITOR" + path: "/editor/:editor_id" + HttpMethod: "Put" + httpmethod: "put" + noClientExample: true /editor/{editor_id}/changelog: get: operationId: "get_editor_changelog" diff --git a/rust/fatcat-api-spec/examples/client.rs b/rust/fatcat-api-spec/examples/client.rs index d95b4ffd..4eed8ae4 100644 --- a/rust/fatcat-api-spec/examples/client.rs +++ b/rust/fatcat-api-spec/examples/client.rs @@ -23,7 +23,8 @@ use fatcat::{ GetReleaseEditResponse, GetReleaseFilesResponse, GetReleaseFilesetsResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetReleaseWebcapturesResponse, GetWebcaptureEditResponse, GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, GetWebcaptureResponse, GetWebcaptureRevisionResponse, GetWorkEditResponse, GetWorkHistoryResponse, GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, - LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse, + LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, + UpdateWorkResponse, }; #[allow(unused_imports)] use futures::{future, stream, Future, Stream}; @@ -287,6 +288,11 @@ fn main() { println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } + // Disabled because there's no example. + // Some("UpdateEditor") => { + // let result = client.update_editor("editor_id_example".to_string(), ???).wait(); + // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + // }, Some("AcceptEditgroup") => { let result = client.accept_editgroup("editgroup_id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); diff --git a/rust/fatcat-api-spec/examples/server_lib/server.rs b/rust/fatcat-api-spec/examples/server_lib/server.rs index b6408343..5e86a10e 100644 --- a/rust/fatcat-api-spec/examples/server_lib/server.rs +++ b/rust/fatcat-api-spec/examples/server_lib/server.rs @@ -22,7 +22,8 @@ use fatcat::{ GetReleaseEditResponse, GetReleaseFilesResponse, GetReleaseFilesetsResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetReleaseWebcapturesResponse, GetWebcaptureEditResponse, GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, GetWebcaptureResponse, GetWebcaptureRevisionResponse, GetWorkEditResponse, GetWorkHistoryResponse, GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, - LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse, + LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, + UpdateWorkResponse, }; #[derive(Copy, Clone)] @@ -314,6 +315,17 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn update_editor(&self, editor_id: String, editor: models::Editor, context: &Context) -> Box + Send> { + let context = context.clone(); + println!( + "update_editor(\"{}\", {:?}) - X-Span-ID: {:?}", + editor_id, + editor, + context.x_span_id.unwrap_or(String::from("")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + fn accept_editgroup(&self, editgroup_id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!("accept_editgroup(\"{}\") - X-Span-ID: {:?}", editgroup_id, context.x_span_id.unwrap_or(String::from("")).clone()); diff --git a/rust/fatcat-api-spec/src/client.rs b/rust/fatcat-api-spec/src/client.rs index 44bcd54d..470a5350 100644 --- a/rust/fatcat-api-spec/src/client.rs +++ b/rust/fatcat-api-spec/src/client.rs @@ -46,7 +46,7 @@ use { GetReleaseFilesResponse, GetReleaseFilesetsResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetReleaseWebcapturesResponse, GetWebcaptureEditResponse, GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, GetWebcaptureResponse, GetWebcaptureRevisionResponse, GetWorkEditResponse, GetWorkHistoryResponse, GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse, - UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse, + UpdateContainerResponse, UpdateCreatorResponse, UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse, }; /// Convert input into a base path, e.g. "http://example:123". Also checks the scheme as it goes. @@ -2252,6 +2252,97 @@ impl Api for Client { Box::new(futures::done(result)) } + fn update_editor(&self, param_editor_id: String, param_editor: models::Editor, context: &Context) -> Box + Send> { + let url = format!( + "{}/v0/editor/{editor_id}", + self.base_path, + editor_id = utf8_percent_encode(¶m_editor_id.to_string(), PATH_SEGMENT_ENCODE_SET) + ); + + let body = serde_json::to_string(¶m_editor).expect("impossible to fail to serialize"); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Put, &url); + let mut custom_headers = hyper::header::Headers::new(); + + let request = request.body(&body); + + custom_headers.set(ContentType(mimetypes::requests::UPDATE_EDITOR.clone())); + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(UpdateEditorResponse::UpdatedEditor(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(UpdateEditorResponse::BadRequest(body)) + } + 401 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } + let response_www_authenticate = response + .headers + .get::() + .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; + + Ok(UpdateEditorResponse::NotAuthorized { + body: body, + www_authenticate: response_www_authenticate.0.clone(), + }) + } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(UpdateEditorResponse::Forbidden(body)) + } + 404 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(UpdateEditorResponse::NotFound(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(UpdateEditorResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + fn accept_editgroup(&self, param_editgroup_id: String, context: &Context) -> Box + Send> { let url = format!( "{}/v0/editgroup/{editgroup_id}/accept", diff --git a/rust/fatcat-api-spec/src/lib.rs b/rust/fatcat-api-spec/src/lib.rs index c89dc90c..258b635b 100644 --- a/rust/fatcat-api-spec/src/lib.rs +++ b/rust/fatcat-api-spec/src/lib.rs @@ -390,6 +390,22 @@ pub enum GetEditorChangelogResponse { GenericError(models::ErrorResponse), } +#[derive(Debug, PartialEq)] +pub enum UpdateEditorResponse { + /// Updated Editor + UpdatedEditor(models::Editor), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Authorized + NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + #[derive(Debug, PartialEq)] pub enum AcceptEditgroupResponse { /// Merged Successfully @@ -1305,6 +1321,8 @@ pub trait Api { fn get_editor_changelog(&self, editor_id: String, context: &Context) -> Box + Send>; + fn update_editor(&self, editor_id: String, editor: models::Editor, context: &Context) -> Box + Send>; + fn accept_editgroup(&self, editgroup_id: String, context: &Context) -> Box + Send>; fn create_editgroup(&self, editgroup: models::Editgroup, context: &Context) -> Box + Send>; @@ -1553,6 +1571,8 @@ pub trait ApiNoContext { fn get_editor_changelog(&self, editor_id: String) -> Box + Send>; + fn update_editor(&self, editor_id: String, editor: models::Editor) -> Box + Send>; + fn accept_editgroup(&self, editgroup_id: String) -> Box + Send>; fn create_editgroup(&self, editgroup: models::Editgroup) -> Box + Send>; @@ -1844,6 +1864,10 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().get_editor_changelog(editor_id, &self.context()) } + fn update_editor(&self, editor_id: String, editor: models::Editor) -> Box + Send> { + self.api().update_editor(editor_id, editor, &self.context()) + } + fn accept_editgroup(&self, editgroup_id: String) -> Box + Send> { self.api().accept_editgroup(editgroup_id, &self.context()) } diff --git a/rust/fatcat-api-spec/src/mimetypes.rs b/rust/fatcat-api-spec/src/mimetypes.rs index 322ab045..cfdd357d 100644 --- a/rust/fatcat-api-spec/src/mimetypes.rs +++ b/rust/fatcat-api-spec/src/mimetypes.rs @@ -512,6 +512,30 @@ pub mod responses { lazy_static! { pub static ref GET_EDITOR_CHANGELOG_GENERIC_ERROR: Mime = mime!(Application / Json); } + /// Create Mime objects for the response content types for UpdateEditor + lazy_static! { + pub static ref UPDATE_EDITOR_UPDATED_EDITOR: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for UpdateEditor + lazy_static! { + pub static ref UPDATE_EDITOR_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for UpdateEditor + lazy_static! { + pub static ref UPDATE_EDITOR_NOT_AUTHORIZED: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for UpdateEditor + lazy_static! { + pub static ref UPDATE_EDITOR_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for UpdateEditor + lazy_static! { + pub static ref UPDATE_EDITOR_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for UpdateEditor + lazy_static! { + pub static ref UPDATE_EDITOR_GENERIC_ERROR: Mime = mime!(Application / Json); + } /// Create Mime objects for the response content types for AcceptEditgroup lazy_static! { pub static ref ACCEPT_EDITGROUP_MERGED_SUCCESSFULLY: Mime = mime!(Application / Json); @@ -1725,6 +1749,10 @@ pub mod requests { lazy_static! { pub static ref AUTH_OIDC: Mime = mime!(Application / Json); } + /// Create Mime objects for the request content types for UpdateEditor + lazy_static! { + pub static ref UPDATE_EDITOR: Mime = mime!(Application / Json); + } /// Create Mime objects for the request content types for CreateEditgroup lazy_static! { pub static ref CREATE_EDITGROUP: Mime = mime!(Application / Json); diff --git a/rust/fatcat-api-spec/src/server.rs b/rust/fatcat-api-spec/src/server.rs index 8a515e43..c0903676 100644 --- a/rust/fatcat-api-spec/src/server.rs +++ b/rust/fatcat-api-spec/src/server.rs @@ -48,7 +48,7 @@ use { GetReleaseFilesResponse, GetReleaseFilesetsResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetReleaseWebcapturesResponse, GetWebcaptureEditResponse, GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, GetWebcaptureResponse, GetWebcaptureRevisionResponse, GetWorkEditResponse, GetWorkHistoryResponse, GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse, - UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse, + UpdateContainerResponse, UpdateCreatorResponse, UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse, }; header! { (Warning, "Warning") => [String] } @@ -2931,6 +2931,157 @@ where "GetEditorChangelog", ); + let api_clone = api.clone(); + router.put( + "/v0/editor/:editor_id", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + + // Path parameters + let param_editor_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editor_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editor_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editor_id: {}", e))))? + }; + + // Body parameters (note that non-required body parameters will ignore garbage + // values, rather than causing a 400 response). Produce warning header and logs for + // any unused fields. + + let param_editor = req + .get::() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter editor - not valid UTF-8: {}", e))))?; + + let mut unused_elements = Vec::new(); + + let param_editor = if let Some(param_editor_raw) = param_editor { + let deserializer = &mut serde_json::Deserializer::from_str(¶m_editor_raw); + + let param_editor: Option = serde_ignored::deserialize(deserializer, |path| { + warn!("Ignoring unknown field in body: {}", path); + unused_elements.push(path.to_string()); + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter editor - doesn't match schema: {}", e))))?; + + param_editor + } else { + None + }; + let param_editor = param_editor.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter editor".to_string())))?; + + match api.update_editor(param_editor_id, param_editor, context).wait() { + Ok(rsp) => match rsp { + UpdateEditorResponse::UpdatedEditor(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(200), body_string)); + response.headers.set(ContentType(mimetypes::responses::UPDATE_EDITOR_UPDATED_EDITOR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + UpdateEditorResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::UPDATE_EDITOR_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + UpdateEditorResponse::NotAuthorized { body, www_authenticate } => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(401), body_string)); + header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } + response.headers.set(ResponseWwwAuthenticate(www_authenticate)); + + response.headers.set(ContentType(mimetypes::responses::UPDATE_EDITOR_NOT_AUTHORIZED.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + UpdateEditorResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::UPDATE_EDITOR_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + UpdateEditorResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::UPDATE_EDITOR_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + UpdateEditorResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::UPDATE_EDITOR_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "UpdateEditor", + ); + let api_clone = api.clone(); router.post( "/v0/editgroup/:editgroup_id/accept", -- cgit v1.2.3 From ab4e1bbf2bb9bb67d6639b90a10970b54dd1aa03 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 3 Jan 2019 22:08:47 -0800 Subject: allow passing prefered_username in oidc signup/login --- fatcat-openapi2.yml | 3 +++ python/fatcat_client/models/auth_oidc.py | 33 +++++++++++++++++++++++++++++--- rust/fatcat-api-spec/README.md | 2 +- rust/fatcat-api-spec/api.yaml | 3 +++ rust/fatcat-api-spec/api/swagger.yaml | 3 +++ rust/fatcat-api-spec/src/models.rs | 6 +++++- 6 files changed, 45 insertions(+), 5 deletions(-) (limited to 'rust/fatcat-api-spec/README.md') diff --git a/fatcat-openapi2.yml b/fatcat-openapi2.yml index b9a61fe4..501a1296 100644 --- a/fatcat-openapi2.yml +++ b/fatcat-openapi2.yml @@ -558,6 +558,7 @@ definitions: - provider - sub - iss + - preferred_username properties: provider: type: string @@ -565,6 +566,8 @@ definitions: type: string iss: type: string + preferred_username: + type: string auth_oidc_result: type: object required: diff --git a/python/fatcat_client/models/auth_oidc.py b/python/fatcat_client/models/auth_oidc.py index 871cc23d..1ee4c429 100644 --- a/python/fatcat_client/models/auth_oidc.py +++ b/python/fatcat_client/models/auth_oidc.py @@ -33,26 +33,30 @@ class AuthOidc(object): swagger_types = { 'provider': 'str', 'sub': 'str', - 'iss': 'str' + 'iss': 'str', + 'preferred_username': 'str' } attribute_map = { 'provider': 'provider', 'sub': 'sub', - 'iss': 'iss' + 'iss': 'iss', + 'preferred_username': 'preferred_username' } - def __init__(self, provider=None, sub=None, iss=None): # noqa: E501 + def __init__(self, provider=None, sub=None, iss=None, preferred_username=None): # noqa: E501 """AuthOidc - a model defined in Swagger""" # noqa: E501 self._provider = None self._sub = None self._iss = None + self._preferred_username = None self.discriminator = None self.provider = provider self.sub = sub self.iss = iss + self.preferred_username = preferred_username @property def provider(self): @@ -123,6 +127,29 @@ class AuthOidc(object): self._iss = iss + @property + def preferred_username(self): + """Gets the preferred_username of this AuthOidc. # noqa: E501 + + + :return: The preferred_username of this AuthOidc. # noqa: E501 + :rtype: str + """ + return self._preferred_username + + @preferred_username.setter + def preferred_username(self, preferred_username): + """Sets the preferred_username of this AuthOidc. + + + :param preferred_username: The preferred_username of this AuthOidc. # noqa: E501 + :type: str + """ + if preferred_username is None: + raise ValueError("Invalid value for `preferred_username`, must not be `None`") # noqa: E501 + + self._preferred_username = preferred_username + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/rust/fatcat-api-spec/README.md b/rust/fatcat-api-spec/README.md index c33509da..f81f641a 100644 --- a/rust/fatcat-api-spec/README.md +++ b/rust/fatcat-api-spec/README.md @@ -13,7 +13,7 @@ To see how to make this your own, look here: [README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md) - API version: 0.1.0 -- Build date: 2019-01-04T01:38:25.420Z +- Build date: 2019-01-04T05:57:03.701Z This autogenerated project defines an API crate `fatcat` which contains: * An `Api` trait defining the API in Rust. diff --git a/rust/fatcat-api-spec/api.yaml b/rust/fatcat-api-spec/api.yaml index b9a61fe4..501a1296 100644 --- a/rust/fatcat-api-spec/api.yaml +++ b/rust/fatcat-api-spec/api.yaml @@ -558,6 +558,7 @@ definitions: - provider - sub - iss + - preferred_username properties: provider: type: string @@ -565,6 +566,8 @@ definitions: type: string iss: type: string + preferred_username: + type: string auth_oidc_result: type: object required: diff --git a/rust/fatcat-api-spec/api/swagger.yaml b/rust/fatcat-api-spec/api/swagger.yaml index d58785c8..a19d6ae1 100644 --- a/rust/fatcat-api-spec/api/swagger.yaml +++ b/rust/fatcat-api-spec/api/swagger.yaml @@ -8179,6 +8179,7 @@ definitions: type: "object" required: - "iss" + - "preferred_username" - "provider" - "sub" properties: @@ -8188,6 +8189,8 @@ definitions: type: "string" iss: type: "string" + preferred_username: + type: "string" upperCaseName: "AUTH_OIDC" auth_oidc_result: type: "object" diff --git a/rust/fatcat-api-spec/src/models.rs b/rust/fatcat-api-spec/src/models.rs index 8c17cf66..536bdd24 100644 --- a/rust/fatcat-api-spec/src/models.rs +++ b/rust/fatcat-api-spec/src/models.rs @@ -19,14 +19,18 @@ pub struct AuthOidc { #[serde(rename = "iss")] pub iss: String, + + #[serde(rename = "preferred_username")] + pub preferred_username: String, } impl AuthOidc { - pub fn new(provider: String, sub: String, iss: String) -> AuthOidc { + pub fn new(provider: String, sub: String, iss: String, preferred_username: String) -> AuthOidc { AuthOidc { provider: provider, sub: sub, iss: iss, + preferred_username: preferred_username, } } } -- cgit v1.2.3 From 35f3f55aac364373ba16191abdb3c0c585249245 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 7 Jan 2019 18:08:09 -0800 Subject: add auth/check endpoint --- fatcat-openapi2.yml | 26 +++++ rust/HACKING.md | 9 ++ rust/fatcat-api-spec/README.md | 3 +- rust/fatcat-api-spec/api.yaml | 26 +++++ rust/fatcat-api-spec/api/swagger.yaml | 66 ++++++++++++ rust/fatcat-api-spec/examples/client.rs | 9 +- rust/fatcat-api-spec/examples/server_lib/server.rs | 8 +- rust/fatcat-api-spec/src/client.rs | 103 +++++++++++++++--- rust/fatcat-api-spec/src/lib.rs | 22 ++++ rust/fatcat-api-spec/src/mimetypes.rs | 20 ++++ rust/fatcat-api-spec/src/server.rs | 118 ++++++++++++++++++--- rust/src/api_wrappers.rs | 96 ++++++++++++++--- rust/src/auth.rs | 21 +++- 13 files changed, 480 insertions(+), 47 deletions(-) (limited to 'rust/fatcat-api-spec/README.md') diff --git a/fatcat-openapi2.yml b/fatcat-openapi2.yml index 501a1296..625a0143 100644 --- a/fatcat-openapi2.yml +++ b/fatcat-openapi2.yml @@ -2711,4 +2711,30 @@ paths: schema: $ref: "#/definitions/error_response" <<: *AUTHRESPONSES + /auth/check: + get: + operationId: "auth_check" + tags: # TAGLINE + security: + # required admin privs + - Bearer: [] + parameters: + - name: role + in: query + required: false + type: string + responses: + 200: + description: Success + schema: + $ref: "#/definitions/success" + 400: + description: Bad Request + schema: + $ref: "#/definitions/error_response" + 500: + description: Generic Error + schema: + $ref: "#/definitions/error_response" + <<: *AUTHRESPONSES diff --git a/rust/HACKING.md b/rust/HACKING.md index 9d161b87..b3a551fa 100644 --- a/rust/HACKING.md +++ b/rust/HACKING.md @@ -54,6 +54,15 @@ Debug SQL schema errors (if diesel commands fail): ## Direct API Interaction +First setup an auth token and check that authentication is working + + EDITOR_ID='aaaaaaaaaaaabkvkaaaaaaaaay' + AUTH_TOKEN=`./target/debug/fatcat-auth create-token $EDITOR_ID` + http get :9411/v0/auth/check "Authorization:Bearer $AUTH_TOKEN" + http get :9411/v0/auth/check?role=admin "Authorization:Bearer $AUTH_TOKEN" + +You'll need to add the `$AUTH_TOKEN` bit to all requests below. + Creating entities via API: http --json post localhost:9411/v0/container name=asdf issn=1234-5678 diff --git a/rust/fatcat-api-spec/README.md b/rust/fatcat-api-spec/README.md index f81f641a..f8a6e817 100644 --- a/rust/fatcat-api-spec/README.md +++ b/rust/fatcat-api-spec/README.md @@ -13,7 +13,7 @@ To see how to make this your own, look here: [README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md) - API version: 0.1.0 -- Build date: 2019-01-04T05:57:03.701Z +- Build date: 2019-01-08T01:49:55.777Z This autogenerated project defines an API crate `fatcat` which contains: * An `Api` trait defining the API in Rust. @@ -79,6 +79,7 @@ cargo run --example client GetCreatorReleases cargo run --example client GetCreatorRevision cargo run --example client LookupCreator cargo run --example client UpdateCreator +cargo run --example client AuthCheck cargo run --example client AuthOidc cargo run --example client GetEditor cargo run --example client GetEditorChangelog diff --git a/rust/fatcat-api-spec/api.yaml b/rust/fatcat-api-spec/api.yaml index 501a1296..625a0143 100644 --- a/rust/fatcat-api-spec/api.yaml +++ b/rust/fatcat-api-spec/api.yaml @@ -2711,4 +2711,30 @@ paths: schema: $ref: "#/definitions/error_response" <<: *AUTHRESPONSES + /auth/check: + get: + operationId: "auth_check" + tags: # TAGLINE + security: + # required admin privs + - Bearer: [] + parameters: + - name: role + in: query + required: false + type: string + responses: + 200: + description: Success + schema: + $ref: "#/definitions/success" + 400: + description: Bad Request + schema: + $ref: "#/definitions/error_response" + 500: + description: Generic Error + schema: + $ref: "#/definitions/error_response" + <<: *AUTHRESPONSES diff --git a/rust/fatcat-api-spec/api/swagger.yaml b/rust/fatcat-api-spec/api/swagger.yaml index a19d6ae1..9d4767c0 100644 --- a/rust/fatcat-api-spec/api/swagger.yaml +++ b/rust/fatcat-api-spec/api/swagger.yaml @@ -6659,6 +6659,72 @@ paths: HttpMethod: "Post" httpmethod: "post" noClientExample: true + /auth/check: + get: + operationId: "auth_check" + parameters: + - name: "role" + in: "query" + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"role_example\".to_string())" + responses: + 200: + description: "Success" + schema: + $ref: "#/definitions/success" + x-responseId: "Success" + x-uppercaseResponseId: "SUCCESS" + uppercase_operation_id: "AUTH_CHECK" + uppercase_data_type: "SUCCESS" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "AUTH_CHECK" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 401: + description: "Not Authorized" + schema: + $ref: "#/definitions/error_response" + headers: + WWW_Authenticate: + type: "string" + x-responseId: "NotAuthorized" + x-uppercaseResponseId: "NOT_AUTHORIZED" + uppercase_operation_id: "AUTH_CHECK" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 403: + description: "Forbidden" + schema: + $ref: "#/definitions/error_response" + x-responseId: "Forbidden" + x-uppercaseResponseId: "FORBIDDEN" + uppercase_operation_id: "AUTH_CHECK" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "AUTH_CHECK" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + security: + - Bearer: [] + operation_id: "auth_check" + uppercase_operation_id: "AUTH_CHECK" + path: "/auth/check" + HttpMethod: "Get" + httpmethod: "get" securityDefinitions: Bearer: type: "apiKey" diff --git a/rust/fatcat-api-spec/examples/client.rs b/rust/fatcat-api-spec/examples/client.rs index 4eed8ae4..5a43a33c 100644 --- a/rust/fatcat-api-spec/examples/client.rs +++ b/rust/fatcat-api-spec/examples/client.rs @@ -12,8 +12,8 @@ extern crate uuid; use clap::{App, Arg}; #[allow(unused_imports)] use fatcat::{ - AcceptEditgroupResponse, ApiError, ApiNoContext, AuthOidcResponse, ContextWrapperExt, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, - CreateEditgroupResponse, CreateFileBatchResponse, CreateFileResponse, CreateFilesetBatchResponse, CreateFilesetResponse, CreateReleaseBatchResponse, CreateReleaseResponse, + AcceptEditgroupResponse, ApiError, ApiNoContext, AuthCheckResponse, AuthOidcResponse, ContextWrapperExt, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, + CreateCreatorResponse, CreateEditgroupResponse, CreateFileBatchResponse, CreateFileResponse, CreateFilesetBatchResponse, CreateFilesetResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWebcaptureBatchResponse, CreateWebcaptureResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, DeleteCreatorEditResponse, DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWebcaptureEditResponse, DeleteWebcaptureResponse, DeleteWorkEditResponse, DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, @@ -54,6 +54,7 @@ fn main() { "GetCreatorReleases", "GetCreatorRevision", "LookupCreator", + "AuthCheck", "GetEditor", "GetEditorChangelog", "AcceptEditgroup", @@ -272,6 +273,10 @@ fn main() { // let result = client.update_creator("ident_example".to_string(), ???, Some("editgroup_id_example".to_string())).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); // }, + Some("AuthCheck") => { + let result = client.auth_check(Some("role_example".to_string())).wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + } // Disabled because there's no example. // Some("AuthOidc") => { diff --git a/rust/fatcat-api-spec/examples/server_lib/server.rs b/rust/fatcat-api-spec/examples/server_lib/server.rs index 5e86a10e..73917351 100644 --- a/rust/fatcat-api-spec/examples/server_lib/server.rs +++ b/rust/fatcat-api-spec/examples/server_lib/server.rs @@ -11,7 +11,7 @@ use swagger; use fatcat::models; use fatcat::{ - AcceptEditgroupResponse, Api, ApiError, AuthOidcResponse, Context, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, + AcceptEditgroupResponse, Api, ApiError, AuthCheckResponse, AuthOidcResponse, Context, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse, CreateFileBatchResponse, CreateFileResponse, CreateFilesetBatchResponse, CreateFilesetResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWebcaptureBatchResponse, CreateWebcaptureResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, DeleteCreatorEditResponse, DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, @@ -297,6 +297,12 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn auth_check(&self, role: Option, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("auth_check({:?}) - X-Span-ID: {:?}", role, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + fn auth_oidc(&self, oidc_params: models::AuthOidc, context: &Context) -> Box + Send> { let context = context.clone(); println!("auth_oidc({:?}) - X-Span-ID: {:?}", oidc_params, context.x_span_id.unwrap_or(String::from("")).clone()); diff --git a/rust/fatcat-api-spec/src/client.rs b/rust/fatcat-api-spec/src/client.rs index 470a5350..7f364eb4 100644 --- a/rust/fatcat-api-spec/src/client.rs +++ b/rust/fatcat-api-spec/src/client.rs @@ -35,18 +35,19 @@ use swagger::{ApiError, Context, XSpanId}; use models; use { - AcceptEditgroupResponse, Api, AuthOidcResponse, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse, - CreateFileBatchResponse, CreateFileResponse, CreateFilesetBatchResponse, CreateFilesetResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWebcaptureBatchResponse, - CreateWebcaptureResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, DeleteCreatorEditResponse, DeleteCreatorResponse, - DeleteFileEditResponse, DeleteFileResponse, DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWebcaptureEditResponse, - DeleteWebcaptureResponse, DeleteWorkEditResponse, DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, GetContainerHistoryResponse, - GetContainerRedirectsResponse, GetContainerResponse, GetContainerRevisionResponse, GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, GetCreatorReleasesResponse, - GetCreatorResponse, GetCreatorRevisionResponse, GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, GetFileRedirectsResponse, - GetFileResponse, GetFileRevisionResponse, GetFilesetEditResponse, GetFilesetHistoryResponse, GetFilesetRedirectsResponse, GetFilesetResponse, GetFilesetRevisionResponse, GetReleaseEditResponse, - GetReleaseFilesResponse, GetReleaseFilesetsResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetReleaseWebcapturesResponse, - GetWebcaptureEditResponse, GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, GetWebcaptureResponse, GetWebcaptureRevisionResponse, GetWorkEditResponse, GetWorkHistoryResponse, - GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse, - UpdateContainerResponse, UpdateCreatorResponse, UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse, + AcceptEditgroupResponse, Api, AuthCheckResponse, AuthOidcResponse, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, + CreateEditgroupResponse, CreateFileBatchResponse, CreateFileResponse, CreateFilesetBatchResponse, CreateFilesetResponse, CreateReleaseBatchResponse, CreateReleaseResponse, + CreateWebcaptureBatchResponse, CreateWebcaptureResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, DeleteCreatorEditResponse, + DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, + DeleteWebcaptureEditResponse, DeleteWebcaptureResponse, DeleteWorkEditResponse, DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, + GetContainerHistoryResponse, GetContainerRedirectsResponse, GetContainerResponse, GetContainerRevisionResponse, GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, + GetCreatorReleasesResponse, GetCreatorResponse, GetCreatorRevisionResponse, GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, + GetFileRedirectsResponse, GetFileResponse, GetFileRevisionResponse, GetFilesetEditResponse, GetFilesetHistoryResponse, GetFilesetRedirectsResponse, GetFilesetResponse, GetFilesetRevisionResponse, + GetReleaseEditResponse, GetReleaseFilesResponse, GetReleaseFilesetsResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, + GetReleaseWebcapturesResponse, GetWebcaptureEditResponse, GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, GetWebcaptureResponse, GetWebcaptureRevisionResponse, GetWorkEditResponse, + GetWorkHistoryResponse, GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, + LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, + UpdateWorkResponse, }; /// Convert input into a base path, e.g. "http://example:123". Also checks the scheme as it goes. @@ -2030,6 +2031,84 @@ impl Api for Client { Box::new(futures::done(result)) } + fn auth_check(&self, param_role: Option, context: &Context) -> Box + Send> { + // Query parameters + let query_role = param_role.map_or_else(String::new, |query| format!("role={role}&", role = query.to_string())); + + let url = format!("{}/v0/auth/check?{role}", self.base_path, role = utf8_percent_encode(&query_role, QUERY_ENCODE_SET)); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Get, &url); + let mut custom_headers = hyper::header::Headers::new(); + + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(AuthCheckResponse::Success(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(AuthCheckResponse::BadRequest(body)) + } + 401 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } + let response_www_authenticate = response + .headers + .get::() + .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; + + Ok(AuthCheckResponse::NotAuthorized { + body: body, + www_authenticate: response_www_authenticate.0.clone(), + }) + } + 403 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(AuthCheckResponse::Forbidden(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(AuthCheckResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + fn auth_oidc(&self, param_oidc_params: models::AuthOidc, context: &Context) -> Box + Send> { let url = format!("{}/v0/auth/oidc", self.base_path); diff --git a/rust/fatcat-api-spec/src/lib.rs b/rust/fatcat-api-spec/src/lib.rs index 258b635b..17c74384 100644 --- a/rust/fatcat-api-spec/src/lib.rs +++ b/rust/fatcat-api-spec/src/lib.rs @@ -348,6 +348,20 @@ pub enum UpdateCreatorResponse { GenericError(models::ErrorResponse), } +#[derive(Debug, PartialEq)] +pub enum AuthCheckResponse { + /// Success + Success(models::Success), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Authorized + NotAuthorized { body: models::ErrorResponse, www_authenticate: String }, + /// Forbidden + Forbidden(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + #[derive(Debug, PartialEq)] pub enum AuthOidcResponse { /// Found @@ -1315,6 +1329,8 @@ pub trait Api { fn update_creator(&self, ident: String, entity: models::CreatorEntity, editgroup_id: Option, context: &Context) -> Box + Send>; + fn auth_check(&self, role: Option, context: &Context) -> Box + Send>; + fn auth_oidc(&self, oidc_params: models::AuthOidc, context: &Context) -> Box + Send>; fn get_editor(&self, editor_id: String, context: &Context) -> Box + Send>; @@ -1565,6 +1581,8 @@ pub trait ApiNoContext { fn update_creator(&self, ident: String, entity: models::CreatorEntity, editgroup_id: Option) -> Box + Send>; + fn auth_check(&self, role: Option) -> Box + Send>; + fn auth_oidc(&self, oidc_params: models::AuthOidc) -> Box + Send>; fn get_editor(&self, editor_id: String) -> Box + Send>; @@ -1852,6 +1870,10 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().update_creator(ident, entity, editgroup_id, &self.context()) } + fn auth_check(&self, role: Option) -> Box + Send> { + self.api().auth_check(role, &self.context()) + } + fn auth_oidc(&self, oidc_params: models::AuthOidc) -> Box + Send> { self.api().auth_oidc(oidc_params, &self.context()) } diff --git a/rust/fatcat-api-spec/src/mimetypes.rs b/rust/fatcat-api-spec/src/mimetypes.rs index cfdd357d..83add9e3 100644 --- a/rust/fatcat-api-spec/src/mimetypes.rs +++ b/rust/fatcat-api-spec/src/mimetypes.rs @@ -452,6 +452,26 @@ pub mod responses { lazy_static! { pub static ref UPDATE_CREATOR_GENERIC_ERROR: Mime = mime!(Application / Json); } + /// Create Mime objects for the response content types for AuthCheck + lazy_static! { + pub static ref AUTH_CHECK_SUCCESS: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for AuthCheck + lazy_static! { + pub static ref AUTH_CHECK_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for AuthCheck + lazy_static! { + pub static ref AUTH_CHECK_NOT_AUTHORIZED: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for AuthCheck + lazy_static! { + pub static ref AUTH_CHECK_FORBIDDEN: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for AuthCheck + lazy_static! { + pub static ref AUTH_CHECK_GENERIC_ERROR: Mime = mime!(Application / Json); + } /// Create Mime objects for the response content types for AuthOidc lazy_static! { pub static ref AUTH_OIDC_FOUND: Mime = mime!(Application / Json); diff --git a/rust/fatcat-api-spec/src/server.rs b/rust/fatcat-api-spec/src/server.rs index c0903676..d8fc7dc2 100644 --- a/rust/fatcat-api-spec/src/server.rs +++ b/rust/fatcat-api-spec/src/server.rs @@ -37,18 +37,19 @@ use swagger::{ApiError, Context, XSpanId}; #[allow(unused_imports)] use models; use { - AcceptEditgroupResponse, Api, AuthOidcResponse, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse, - CreateFileBatchResponse, CreateFileResponse, CreateFilesetBatchResponse, CreateFilesetResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWebcaptureBatchResponse, - CreateWebcaptureResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, DeleteCreatorEditResponse, DeleteCreatorResponse, - DeleteFileEditResponse, DeleteFileResponse, DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWebcaptureEditResponse, - DeleteWebcaptureResponse, DeleteWorkEditResponse, DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, GetContainerHistoryResponse, - GetContainerRedirectsResponse, GetContainerResponse, GetContainerRevisionResponse, GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, GetCreatorReleasesResponse, - GetCreatorResponse, GetCreatorRevisionResponse, GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, GetFileRedirectsResponse, - GetFileResponse, GetFileRevisionResponse, GetFilesetEditResponse, GetFilesetHistoryResponse, GetFilesetRedirectsResponse, GetFilesetResponse, GetFilesetRevisionResponse, GetReleaseEditResponse, - GetReleaseFilesResponse, GetReleaseFilesetsResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetReleaseWebcapturesResponse, - GetWebcaptureEditResponse, GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, GetWebcaptureResponse, GetWebcaptureRevisionResponse, GetWorkEditResponse, GetWorkHistoryResponse, - GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse, - UpdateContainerResponse, UpdateCreatorResponse, UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse, + AcceptEditgroupResponse, Api, AuthCheckResponse, AuthOidcResponse, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, + CreateEditgroupResponse, CreateFileBatchResponse, CreateFileResponse, CreateFilesetBatchResponse, CreateFilesetResponse, CreateReleaseBatchResponse, CreateReleaseResponse, + CreateWebcaptureBatchResponse, CreateWebcaptureResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, DeleteCreatorEditResponse, + DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, + DeleteWebcaptureEditResponse, DeleteWebcaptureResponse, DeleteWorkEditResponse, DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, + GetContainerHistoryResponse, GetContainerRedirectsResponse, GetContainerResponse, GetContainerRevisionResponse, GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, + GetCreatorReleasesResponse, GetCreatorResponse, GetCreatorRevisionResponse, GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, + GetFileRedirectsResponse, GetFileResponse, GetFileRevisionResponse, GetFilesetEditResponse, GetFilesetHistoryResponse, GetFilesetRedirectsResponse, GetFilesetResponse, GetFilesetRevisionResponse, + GetReleaseEditResponse, GetReleaseFilesResponse, GetReleaseFilesetsResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, + GetReleaseWebcapturesResponse, GetWebcaptureEditResponse, GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, GetWebcaptureResponse, GetWebcaptureRevisionResponse, GetWorkEditResponse, + GetWorkHistoryResponse, GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, + LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, + UpdateWorkResponse, }; header! { (Warning, "Warning") => [String] } @@ -2605,6 +2606,99 @@ where "UpdateCreator", ); + let api_clone = api.clone(); + router.get( + "/v0/auth/check", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; + + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::().unwrap_or_default(); + let param_role = query_params.get("role").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + + match api.auth_check(param_role, context).wait() { + Ok(rsp) => match rsp { + AuthCheckResponse::Success(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(200), body_string)); + response.headers.set(ContentType(mimetypes::responses::AUTH_CHECK_SUCCESS.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + AuthCheckResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::AUTH_CHECK_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + AuthCheckResponse::NotAuthorized { body, www_authenticate } => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(401), body_string)); + header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } + response.headers.set(ResponseWwwAuthenticate(www_authenticate)); + + response.headers.set(ContentType(mimetypes::responses::AUTH_CHECK_NOT_AUTHORIZED.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + AuthCheckResponse::Forbidden(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(403), body_string)); + response.headers.set(ContentType(mimetypes::responses::AUTH_CHECK_FORBIDDEN.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + AuthCheckResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::AUTH_CHECK_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "AuthCheck", + ); + let api_clone = api.clone(); router.post( "/v0/auth/oidc", diff --git a/rust/src/api_wrappers.rs b/rust/src/api_wrappers.rs index 614a0007..818a41c2 100644 --- a/rust/src/api_wrappers.rs +++ b/rust/src/api_wrappers.rs @@ -404,8 +404,7 @@ macro_rules! wrap_entity_handlers { $model::db_delete_edit(&conn, edit_id) }) { Ok(()) => - $delete_edit_resp::DeletedEdit(Success { message: format!("Successfully deleted work-in-progress {} edit: {}", stringify!($model), edit_id) } ), - Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) => + $delete_edit_resp::DeletedEdit(Success { message: format!("Successfully deleted work-in-progress {} edit: {}", stringify!($model), edit_id) } ), Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) => $delete_edit_resp::NotFound(ErrorResponse { message: format!("No such {} edit: {}", stringify!($model), edit_id) }), Err(Error(ErrorKind::Diesel(e), _)) => $delete_edit_resp::BadRequest(ErrorResponse { message: e.to_string() }), @@ -918,9 +917,11 @@ impl Api for Server { ErrorKind::OtherBadRequest("editor_id doesn't match".to_string()).into(), ); } - let auth_context = self - .auth_confectionary - .require_auth(&conn, &context.auth_data, Some("update_editor"))?; + let auth_context = self.auth_confectionary.require_auth( + &conn, + &context.auth_data, + Some("update_editor"), + )?; let editor_id = FatCatId::from_str(&editor_id)?; // DANGER! these permissions are for username updates only! if editor_id == auth_context.editor_id { @@ -986,9 +987,11 @@ impl Api for Server { let conn = self.db_pool.get().expect("db_pool error"); let ret = match conn.transaction(|| { let editgroup_id = FatCatId::from_str(&editgroup_id)?; - let auth_context = self - .auth_confectionary - .require_auth(&conn, &context.auth_data, Some("accept_editgroup"))?; + let auth_context = self.auth_confectionary.require_auth( + &conn, + &context.auth_data, + Some("accept_editgroup"), + )?; auth_context.require_role(FatcatRole::Admin)?; // NOTE: this is currently redundant, but zero-cost auth_context.require_editgroup(&conn, editgroup_id)?; @@ -1058,9 +1061,11 @@ impl Api for Server { ) -> Box + Send> { let conn = self.db_pool.get().expect("db_pool error"); let ret = match conn.transaction(|| { - let auth_context = self - .auth_confectionary - .require_auth(&conn, &context.auth_data, Some("create_editgroup"))?; + let auth_context = self.auth_confectionary.require_auth( + &conn, + &context.auth_data, + Some("create_editgroup"), + )?; auth_context.require_role(FatcatRole::Editor)?; let mut entity = entity.clone(); match entity.editor_id.clone() { @@ -1149,9 +1154,11 @@ impl Api for Server { ) -> Box + Send> { let conn = self.db_pool.get().expect("db_pool error"); let ret = match conn.transaction(|| { - let auth_context = self - .auth_confectionary - .require_auth(&conn, &context.auth_data, Some("auth_oidc"))?; + let auth_context = self.auth_confectionary.require_auth( + &conn, + &context.auth_data, + Some("auth_oidc"), + )?; auth_context.require_role(FatcatRole::Superuser)?; let (editor, created) = self.auth_oidc_handler(params, &conn)?; // create an auth token; leave it to webface to attenuate to a given duration @@ -1221,4 +1228,65 @@ impl Api for Server { }; Box::new(futures::done(Ok(ret))) } + + fn auth_check( + &self, + role: Option, + context: &Context, + ) -> Box + Send> { + let conn = self.db_pool.get().expect("db_pool error"); + let ret = match conn.transaction(|| { + let auth_context = self.auth_confectionary.require_auth( + &conn, + &context.auth_data, + Some("auth_check"), + )?; + if let Some(role) = role { + let role = match role.to_lowercase().as_ref() { + "superuser" => FatcatRole::Superuser, + "admin" => FatcatRole::Admin, + "editor" => FatcatRole::Editor, + "bot" => FatcatRole::Bot, + "human" => FatcatRole::Human, + "public" => FatcatRole::Public, + _ => bail!("unknown auth role: {}", role), + }; + auth_context.require_role(role)?; + }; + Ok(()) + }) { + Ok(()) => AuthCheckResponse::Success(Success { + message: "auth check successful!".to_string() }), + Err(Error(ErrorKind::Diesel(e), _)) => AuthCheckResponse::BadRequest(ErrorResponse { + message: e.to_string(), + }), + Err(Error(ErrorKind::Uuid(e), _)) => AuthCheckResponse::BadRequest(ErrorResponse { + message: e.to_string(), + }), + Err(Error(ErrorKind::InvalidCredentials(e), _)) => + // TODO: why can't I NotAuthorized here? + { + AuthCheckResponse::Forbidden(ErrorResponse { + message: e.to_string(), + }) + }, + Err(Error(ErrorKind::InsufficientPrivileges(e), _)) => { + AuthCheckResponse::Forbidden(ErrorResponse { + message: e.to_string(), + }) + }, + Err(Error(ErrorKind::OtherBadRequest(e), _)) => { + AuthCheckResponse::BadRequest(ErrorResponse { + message: e.to_string(), + }) + }, + Err(e) => { + error!("{}", e); + AuthCheckResponse::GenericError(ErrorResponse { + message: e.to_string(), + }) + }, + }; + Box::new(futures::done(Ok(ret))) + } } diff --git a/rust/src/auth.rs b/rust/src/auth.rs index 8894e33b..c20b9b71 100644 --- a/rust/src/auth.rs +++ b/rust/src/auth.rs @@ -56,9 +56,10 @@ impl AuthContext { pub fn require_role(&self, role: FatcatRole) -> Result<()> { match self.has_role(role) { true => Ok(()), - false => Err(ErrorKind::InsufficientPrivileges( - format!("doesn't have required role: {:?}", role), - ) + false => Err(ErrorKind::InsufficientPrivileges(format!( + "doesn't have required role: {:?}", + role + )) .into()), } } @@ -230,7 +231,12 @@ impl AuthConfectionary { Ok(BASE64.encode(&raw)) } - pub fn parse_macaroon_token(&self, conn: &DbConn, s: &str, endpoint: Option<&str>) -> Result { + pub fn parse_macaroon_token( + &self, + conn: &DbConn, + s: &str, + endpoint: Option<&str>, + ) -> Result { let raw = BASE64.decode(s.as_bytes())?; let mac = match Macaroon::deserialize(&raw) { Ok(m) => m, @@ -371,7 +377,12 @@ impl AuthConfectionary { })) } - pub fn require_auth(&self, conn: &DbConn, auth_data: &Option, endpoint: Option<&str>) -> Result { + pub fn require_auth( + &self, + conn: &DbConn, + auth_data: &Option, + endpoint: Option<&str>, + ) -> Result { match self.parse_swagger(conn, auth_data, endpoint)? { Some(auth) => Ok(auth), None => Err(ErrorKind::InvalidCredentials("no token supplied".to_string()).into()), -- cgit v1.2.3