Skip to content

Commit 3796e87

Browse files
Commit via running: make Sources/orgs
1 parent 4214664 commit 3796e87

File tree

2 files changed

+739
-0
lines changed

2 files changed

+739
-0
lines changed

Sources/orgs/Client.swift

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,148 @@ public struct Client: APIProtocol {
464464
}
465465
)
466466
}
467+
/// Create artifact metadata storage record
468+
///
469+
/// Create metadata storage records for artifacts associated with an organization.
470+
/// This endpoint will create a new artifact storage record on behalf of any artifact matching the provided digest and
471+
/// associated with a repository owned by the organization.
472+
///
473+
/// - Remark: HTTP `POST /orgs/{org}/artifacts/metadata/storage-record`.
474+
/// - Remark: Generated from `#/paths//orgs/{org}/artifacts/metadata/storage-record/post(orgs/create-artifact-storage-record)`.
475+
public func orgsCreateArtifactStorageRecord(_ input: Operations.OrgsCreateArtifactStorageRecord.Input) async throws -> Operations.OrgsCreateArtifactStorageRecord.Output {
476+
try await client.send(
477+
input: input,
478+
forOperation: Operations.OrgsCreateArtifactStorageRecord.id,
479+
serializer: { input in
480+
let path = try converter.renderedPath(
481+
template: "/orgs/{}/artifacts/metadata/storage-record",
482+
parameters: [
483+
input.path.org
484+
]
485+
)
486+
var request: HTTPTypes.HTTPRequest = .init(
487+
soar_path: path,
488+
method: .post
489+
)
490+
suppressMutabilityWarning(&request)
491+
converter.setAcceptHeader(
492+
in: &request.headerFields,
493+
contentTypes: input.headers.accept
494+
)
495+
let body: OpenAPIRuntime.HTTPBody?
496+
switch input.body {
497+
case let .json(value):
498+
body = try converter.setRequiredRequestBodyAsJSON(
499+
value,
500+
headerFields: &request.headerFields,
501+
contentType: "application/json; charset=utf-8"
502+
)
503+
}
504+
return (request, body)
505+
},
506+
deserializer: { response, responseBody in
507+
switch response.status.code {
508+
case 200:
509+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
510+
let body: Operations.OrgsCreateArtifactStorageRecord.Output.Ok.Body
511+
let chosenContentType = try converter.bestContentType(
512+
received: contentType,
513+
options: [
514+
"application/json"
515+
]
516+
)
517+
switch chosenContentType {
518+
case "application/json":
519+
body = try await converter.getResponseBodyAsJSON(
520+
Operations.OrgsCreateArtifactStorageRecord.Output.Ok.Body.JsonPayload.self,
521+
from: responseBody,
522+
transforming: { value in
523+
.json(value)
524+
}
525+
)
526+
default:
527+
preconditionFailure("bestContentType chose an invalid content type.")
528+
}
529+
return .ok(.init(body: body))
530+
default:
531+
return .undocumented(
532+
statusCode: response.status.code,
533+
.init(
534+
headerFields: response.headerFields,
535+
body: responseBody
536+
)
537+
)
538+
}
539+
}
540+
)
541+
}
542+
/// List artifact storage records
543+
///
544+
/// List a collection of artifact storage records with a given subject digest that are associated with repositories owned by an organization.
545+
///
546+
/// The collection of storage records returned by this endpoint is filtered according to the authenticated user's permissions; if the authenticated user cannot read a repository, the attestations associated with that repository will not be included in the response. In addition, when using a fine-grained access token the `content:read` permission is required.
547+
///
548+
/// - Remark: HTTP `GET /orgs/{org}/artifacts/{subject_digest}/metadata/storage-records`.
549+
/// - Remark: Generated from `#/paths//orgs/{org}/artifacts/{subject_digest}/metadata/storage-records/get(orgs/list-artifact-storage-records)`.
550+
public func orgsListArtifactStorageRecords(_ input: Operations.OrgsListArtifactStorageRecords.Input) async throws -> Operations.OrgsListArtifactStorageRecords.Output {
551+
try await client.send(
552+
input: input,
553+
forOperation: Operations.OrgsListArtifactStorageRecords.id,
554+
serializer: { input in
555+
let path = try converter.renderedPath(
556+
template: "/orgs/{}/artifacts/{}/metadata/storage-records",
557+
parameters: [
558+
input.path.org,
559+
input.path.subjectDigest
560+
]
561+
)
562+
var request: HTTPTypes.HTTPRequest = .init(
563+
soar_path: path,
564+
method: .get
565+
)
566+
suppressMutabilityWarning(&request)
567+
converter.setAcceptHeader(
568+
in: &request.headerFields,
569+
contentTypes: input.headers.accept
570+
)
571+
return (request, nil)
572+
},
573+
deserializer: { response, responseBody in
574+
switch response.status.code {
575+
case 200:
576+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
577+
let body: Operations.OrgsListArtifactStorageRecords.Output.Ok.Body
578+
let chosenContentType = try converter.bestContentType(
579+
received: contentType,
580+
options: [
581+
"application/json"
582+
]
583+
)
584+
switch chosenContentType {
585+
case "application/json":
586+
body = try await converter.getResponseBodyAsJSON(
587+
Operations.OrgsListArtifactStorageRecords.Output.Ok.Body.JsonPayload.self,
588+
from: responseBody,
589+
transforming: { value in
590+
.json(value)
591+
}
592+
)
593+
default:
594+
preconditionFailure("bestContentType chose an invalid content type.")
595+
}
596+
return .ok(.init(body: body))
597+
default:
598+
return .undocumented(
599+
statusCode: response.status.code,
600+
.init(
601+
headerFields: response.headerFields,
602+
body: responseBody
603+
)
604+
)
605+
}
606+
}
607+
)
608+
}
467609
/// List attestations by bulk subject digests
468610
///
469611
/// List a collection of artifact attestations associated with any entry in a list of subject digests owned by an organization.

0 commit comments

Comments
 (0)