Skip to content

Commit 2098712

Browse files
Commit via running ake Sources/code-security
1 parent 5eb7466 commit 2098712

File tree

2 files changed

+549
-4
lines changed

2 files changed

+549
-4
lines changed

Sources/code-security/Client.swift

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,161 @@ public struct Client: APIProtocol {
369369
}
370370
)
371371
}
372+
/// Detach configurations from repositories
373+
///
374+
/// Detach code security configuration(s) from a set of repositories.
375+
/// Repositories will retain their settings but will no longer be associated with the configuration.
376+
///
377+
/// The authenticated user must be an administrator or security manager for the organization to use this endpoint.
378+
///
379+
/// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint.
380+
///
381+
/// - Remark: HTTP `DELETE /orgs/{org}/code-security/configurations/detach`.
382+
/// - Remark: Generated from `#/paths//orgs/{org}/code-security/configurations/detach/delete(code-security/detach-configuration)`.
383+
public func code_hyphen_security_sol_detach_hyphen_configuration(_ input: Operations.code_hyphen_security_sol_detach_hyphen_configuration.Input) async throws -> Operations.code_hyphen_security_sol_detach_hyphen_configuration.Output {
384+
try await client.send(
385+
input: input,
386+
forOperation: Operations.code_hyphen_security_sol_detach_hyphen_configuration.id,
387+
serializer: { input in
388+
let path = try converter.renderedPath(
389+
template: "/orgs/{}/code-security/configurations/detach",
390+
parameters: [
391+
input.path.org
392+
]
393+
)
394+
var request: HTTPTypes.HTTPRequest = .init(
395+
soar_path: path,
396+
method: .delete
397+
)
398+
suppressMutabilityWarning(&request)
399+
converter.setAcceptHeader(
400+
in: &request.headerFields,
401+
contentTypes: input.headers.accept
402+
)
403+
let body: OpenAPIRuntime.HTTPBody?
404+
switch input.body {
405+
case let .json(value):
406+
body = try converter.setRequiredRequestBodyAsJSON(
407+
value,
408+
headerFields: &request.headerFields,
409+
contentType: "application/json; charset=utf-8"
410+
)
411+
}
412+
return (request, body)
413+
},
414+
deserializer: { response, responseBody in
415+
switch response.status.code {
416+
case 204:
417+
return .noContent(.init())
418+
case 400:
419+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
420+
let body: Components.Responses.bad_request.Body
421+
let chosenContentType = try converter.bestContentType(
422+
received: contentType,
423+
options: [
424+
"application/json",
425+
"application/scim+json"
426+
]
427+
)
428+
switch chosenContentType {
429+
case "application/json":
430+
body = try await converter.getResponseBodyAsJSON(
431+
Components.Schemas.basic_hyphen_error.self,
432+
from: responseBody,
433+
transforming: { value in
434+
.json(value)
435+
}
436+
)
437+
case "application/scim+json":
438+
body = try await converter.getResponseBodyAsJSON(
439+
Components.Schemas.scim_hyphen_error.self,
440+
from: responseBody,
441+
transforming: { value in
442+
.application_scim_plus_json(value)
443+
}
444+
)
445+
default:
446+
preconditionFailure("bestContentType chose an invalid content type.")
447+
}
448+
return .badRequest(.init(body: body))
449+
case 403:
450+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
451+
let body: Components.Responses.forbidden.Body
452+
let chosenContentType = try converter.bestContentType(
453+
received: contentType,
454+
options: [
455+
"application/json"
456+
]
457+
)
458+
switch chosenContentType {
459+
case "application/json":
460+
body = try await converter.getResponseBodyAsJSON(
461+
Components.Schemas.basic_hyphen_error.self,
462+
from: responseBody,
463+
transforming: { value in
464+
.json(value)
465+
}
466+
)
467+
default:
468+
preconditionFailure("bestContentType chose an invalid content type.")
469+
}
470+
return .forbidden(.init(body: body))
471+
case 404:
472+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
473+
let body: Components.Responses.not_found.Body
474+
let chosenContentType = try converter.bestContentType(
475+
received: contentType,
476+
options: [
477+
"application/json"
478+
]
479+
)
480+
switch chosenContentType {
481+
case "application/json":
482+
body = try await converter.getResponseBodyAsJSON(
483+
Components.Schemas.basic_hyphen_error.self,
484+
from: responseBody,
485+
transforming: { value in
486+
.json(value)
487+
}
488+
)
489+
default:
490+
preconditionFailure("bestContentType chose an invalid content type.")
491+
}
492+
return .notFound(.init(body: body))
493+
case 409:
494+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
495+
let body: Components.Responses.conflict.Body
496+
let chosenContentType = try converter.bestContentType(
497+
received: contentType,
498+
options: [
499+
"application/json"
500+
]
501+
)
502+
switch chosenContentType {
503+
case "application/json":
504+
body = try await converter.getResponseBodyAsJSON(
505+
Components.Schemas.basic_hyphen_error.self,
506+
from: responseBody,
507+
transforming: { value in
508+
.json(value)
509+
}
510+
)
511+
default:
512+
preconditionFailure("bestContentType chose an invalid content type.")
513+
}
514+
return .conflict(.init(body: body))
515+
default:
516+
return .undocumented(
517+
statusCode: response.status.code,
518+
.init(
519+
headerFields: response.headerFields,
520+
body: responseBody
521+
)
522+
)
523+
}
524+
}
525+
)
526+
}
372527
/// Get a code security configuration
373528
///
374529
/// Gets a code security configuration available in an organization.

0 commit comments

Comments
 (0)