Skip to content

Commit fa8ac2c

Browse files
Commit via running: make Sources/orgs
1 parent 63a71f2 commit fa8ac2c

File tree

2 files changed

+911
-0
lines changed

2 files changed

+911
-0
lines changed

Sources/orgs/Client.swift

Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,241 @@ public struct Client: APIProtocol {
562562
}
563563
)
564564
}
565+
/// Delete attestations in bulk
566+
///
567+
/// Delete artifact attestations in bulk by either subject digests or unique ID.
568+
///
569+
/// - Remark: HTTP `POST /orgs/{org}/attestations/delete-request`.
570+
/// - Remark: Generated from `#/paths//orgs/{org}/attestations/delete-request/post(orgs/delete-attestations-bulk)`.
571+
public func orgsDeleteAttestationsBulk(_ input: Operations.OrgsDeleteAttestationsBulk.Input) async throws -> Operations.OrgsDeleteAttestationsBulk.Output {
572+
try await client.send(
573+
input: input,
574+
forOperation: Operations.OrgsDeleteAttestationsBulk.id,
575+
serializer: { input in
576+
let path = try converter.renderedPath(
577+
template: "/orgs/{}/attestations/delete-request",
578+
parameters: [
579+
input.path.org
580+
]
581+
)
582+
var request: HTTPTypes.HTTPRequest = .init(
583+
soar_path: path,
584+
method: .post
585+
)
586+
suppressMutabilityWarning(&request)
587+
converter.setAcceptHeader(
588+
in: &request.headerFields,
589+
contentTypes: input.headers.accept
590+
)
591+
let body: OpenAPIRuntime.HTTPBody?
592+
switch input.body {
593+
case let .json(value):
594+
body = try converter.setRequiredRequestBodyAsJSON(
595+
value,
596+
headerFields: &request.headerFields,
597+
contentType: "application/json; charset=utf-8"
598+
)
599+
}
600+
return (request, body)
601+
},
602+
deserializer: { response, responseBody in
603+
switch response.status.code {
604+
case 200:
605+
return .ok(.init())
606+
case 404:
607+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
608+
let body: Components.Responses.NotFound.Body
609+
let chosenContentType = try converter.bestContentType(
610+
received: contentType,
611+
options: [
612+
"application/json"
613+
]
614+
)
615+
switch chosenContentType {
616+
case "application/json":
617+
body = try await converter.getResponseBodyAsJSON(
618+
Components.Schemas.BasicError.self,
619+
from: responseBody,
620+
transforming: { value in
621+
.json(value)
622+
}
623+
)
624+
default:
625+
preconditionFailure("bestContentType chose an invalid content type.")
626+
}
627+
return .notFound(.init(body: body))
628+
default:
629+
return .undocumented(
630+
statusCode: response.status.code,
631+
.init(
632+
headerFields: response.headerFields,
633+
body: responseBody
634+
)
635+
)
636+
}
637+
}
638+
)
639+
}
640+
/// Delete attestations by subject digest
641+
///
642+
/// Delete an artifact attestation by subject digest.
643+
///
644+
/// - Remark: HTTP `DELETE /orgs/{org}/attestations/digest/{subject_digest}`.
645+
/// - Remark: Generated from `#/paths//orgs/{org}/attestations/digest/{subject_digest}/delete(orgs/delete-attestations-by-subject-digest)`.
646+
public func orgsDeleteAttestationsBySubjectDigest(_ input: Operations.OrgsDeleteAttestationsBySubjectDigest.Input) async throws -> Operations.OrgsDeleteAttestationsBySubjectDigest.Output {
647+
try await client.send(
648+
input: input,
649+
forOperation: Operations.OrgsDeleteAttestationsBySubjectDigest.id,
650+
serializer: { input in
651+
let path = try converter.renderedPath(
652+
template: "/orgs/{}/attestations/digest/{}",
653+
parameters: [
654+
input.path.org,
655+
input.path.subjectDigest
656+
]
657+
)
658+
var request: HTTPTypes.HTTPRequest = .init(
659+
soar_path: path,
660+
method: .delete
661+
)
662+
suppressMutabilityWarning(&request)
663+
converter.setAcceptHeader(
664+
in: &request.headerFields,
665+
contentTypes: input.headers.accept
666+
)
667+
return (request, nil)
668+
},
669+
deserializer: { response, responseBody in
670+
switch response.status.code {
671+
case 200:
672+
return .ok(.init())
673+
case 204:
674+
return .noContent(.init())
675+
case 404:
676+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
677+
let body: Components.Responses.NotFound.Body
678+
let chosenContentType = try converter.bestContentType(
679+
received: contentType,
680+
options: [
681+
"application/json"
682+
]
683+
)
684+
switch chosenContentType {
685+
case "application/json":
686+
body = try await converter.getResponseBodyAsJSON(
687+
Components.Schemas.BasicError.self,
688+
from: responseBody,
689+
transforming: { value in
690+
.json(value)
691+
}
692+
)
693+
default:
694+
preconditionFailure("bestContentType chose an invalid content type.")
695+
}
696+
return .notFound(.init(body: body))
697+
default:
698+
return .undocumented(
699+
statusCode: response.status.code,
700+
.init(
701+
headerFields: response.headerFields,
702+
body: responseBody
703+
)
704+
)
705+
}
706+
}
707+
)
708+
}
709+
/// Delete attestations by ID
710+
///
711+
/// Delete an artifact attestation by unique ID that is associated with a repository owned by an org.
712+
///
713+
/// - Remark: HTTP `DELETE /orgs/{org}/attestations/{attestation_id}`.
714+
/// - Remark: Generated from `#/paths//orgs/{org}/attestations/{attestation_id}/delete(orgs/delete-attestations-by-id)`.
715+
public func orgsDeleteAttestationsById(_ input: Operations.OrgsDeleteAttestationsById.Input) async throws -> Operations.OrgsDeleteAttestationsById.Output {
716+
try await client.send(
717+
input: input,
718+
forOperation: Operations.OrgsDeleteAttestationsById.id,
719+
serializer: { input in
720+
let path = try converter.renderedPath(
721+
template: "/orgs/{}/attestations/{}",
722+
parameters: [
723+
input.path.org,
724+
input.path.attestationId
725+
]
726+
)
727+
var request: HTTPTypes.HTTPRequest = .init(
728+
soar_path: path,
729+
method: .delete
730+
)
731+
suppressMutabilityWarning(&request)
732+
converter.setAcceptHeader(
733+
in: &request.headerFields,
734+
contentTypes: input.headers.accept
735+
)
736+
return (request, nil)
737+
},
738+
deserializer: { response, responseBody in
739+
switch response.status.code {
740+
case 200:
741+
return .ok(.init())
742+
case 204:
743+
return .noContent(.init())
744+
case 403:
745+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
746+
let body: Components.Responses.Forbidden.Body
747+
let chosenContentType = try converter.bestContentType(
748+
received: contentType,
749+
options: [
750+
"application/json"
751+
]
752+
)
753+
switch chosenContentType {
754+
case "application/json":
755+
body = try await converter.getResponseBodyAsJSON(
756+
Components.Schemas.BasicError.self,
757+
from: responseBody,
758+
transforming: { value in
759+
.json(value)
760+
}
761+
)
762+
default:
763+
preconditionFailure("bestContentType chose an invalid content type.")
764+
}
765+
return .forbidden(.init(body: body))
766+
case 404:
767+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
768+
let body: Components.Responses.NotFound.Body
769+
let chosenContentType = try converter.bestContentType(
770+
received: contentType,
771+
options: [
772+
"application/json"
773+
]
774+
)
775+
switch chosenContentType {
776+
case "application/json":
777+
body = try await converter.getResponseBodyAsJSON(
778+
Components.Schemas.BasicError.self,
779+
from: responseBody,
780+
transforming: { value in
781+
.json(value)
782+
}
783+
)
784+
default:
785+
preconditionFailure("bestContentType chose an invalid content type.")
786+
}
787+
return .notFound(.init(body: body))
788+
default:
789+
return .undocumented(
790+
statusCode: response.status.code,
791+
.init(
792+
headerFields: response.headerFields,
793+
body: responseBody
794+
)
795+
)
796+
}
797+
}
798+
)
799+
}
565800
/// List attestations
566801
///
567802
/// List a collection of artifact attestations with a given subject digest that are associated with repositories owned by an organization.

0 commit comments

Comments
 (0)