Skip to content

Commit 68ac24f

Browse files
Commit via running ake Sources/code-scanning
1 parent 0853d01 commit 68ac24f

File tree

2 files changed

+1597
-0
lines changed

2 files changed

+1597
-0
lines changed

Sources/code-scanning/Client.swift

Lines changed: 373 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1729,6 +1729,379 @@ public struct Client: APIProtocol {
17291729
}
17301730
)
17311731
}
1732+
/// Create a CodeQL variant analysis
1733+
///
1734+
/// Creates a new CodeQL variant analysis, which will run a CodeQL query against one or more repositories.
1735+
///
1736+
/// Get started by learning more about [running CodeQL queries at scale with Multi-Repository Variant Analysis](https://docs.github.com/code-security/codeql-for-vs-code/getting-started-with-codeql-for-vs-code/running-codeql-queries-at-scale-with-multi-repository-variant-analysis).
1737+
///
1738+
/// Use the `owner` and `repo` parameters in the URL to specify the controller repository that
1739+
/// will be used for running GitHub Actions workflows and storing the results of the CodeQL variant analysis.
1740+
///
1741+
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
1742+
///
1743+
/// - Remark: HTTP `POST /repos/{owner}/{repo}/code-scanning/codeql/variant-analyses`.
1744+
/// - Remark: Generated from `#/paths//repos/{owner}/{repo}/code-scanning/codeql/variant-analyses/post(code-scanning/create-variant-analysis)`.
1745+
public func code_hyphen_scanning_sol_create_hyphen_variant_hyphen_analysis(_ input: Operations.code_hyphen_scanning_sol_create_hyphen_variant_hyphen_analysis.Input) async throws -> Operations.code_hyphen_scanning_sol_create_hyphen_variant_hyphen_analysis.Output {
1746+
try await client.send(
1747+
input: input,
1748+
forOperation: Operations.code_hyphen_scanning_sol_create_hyphen_variant_hyphen_analysis.id,
1749+
serializer: { input in
1750+
let path = try converter.renderedPath(
1751+
template: "/repos/{}/{}/code-scanning/codeql/variant-analyses",
1752+
parameters: [
1753+
input.path.owner,
1754+
input.path.repo
1755+
]
1756+
)
1757+
var request: HTTPTypes.HTTPRequest = .init(
1758+
soar_path: path,
1759+
method: .post
1760+
)
1761+
suppressMutabilityWarning(&request)
1762+
converter.setAcceptHeader(
1763+
in: &request.headerFields,
1764+
contentTypes: input.headers.accept
1765+
)
1766+
let body: OpenAPIRuntime.HTTPBody?
1767+
switch input.body {
1768+
case let .json(value):
1769+
body = try converter.setRequiredRequestBodyAsJSON(
1770+
value,
1771+
headerFields: &request.headerFields,
1772+
contentType: "application/json; charset=utf-8"
1773+
)
1774+
}
1775+
return (request, body)
1776+
},
1777+
deserializer: { response, responseBody in
1778+
switch response.status.code {
1779+
case 201:
1780+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1781+
let body: Operations.code_hyphen_scanning_sol_create_hyphen_variant_hyphen_analysis.Output.Created.Body
1782+
let chosenContentType = try converter.bestContentType(
1783+
received: contentType,
1784+
options: [
1785+
"application/json"
1786+
]
1787+
)
1788+
switch chosenContentType {
1789+
case "application/json":
1790+
body = try await converter.getResponseBodyAsJSON(
1791+
Components.Schemas.code_hyphen_scanning_hyphen_variant_hyphen_analysis.self,
1792+
from: responseBody,
1793+
transforming: { value in
1794+
.json(value)
1795+
}
1796+
)
1797+
default:
1798+
preconditionFailure("bestContentType chose an invalid content type.")
1799+
}
1800+
return .created(.init(body: body))
1801+
case 404:
1802+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1803+
let body: Components.Responses.not_found.Body
1804+
let chosenContentType = try converter.bestContentType(
1805+
received: contentType,
1806+
options: [
1807+
"application/json"
1808+
]
1809+
)
1810+
switch chosenContentType {
1811+
case "application/json":
1812+
body = try await converter.getResponseBodyAsJSON(
1813+
Components.Schemas.basic_hyphen_error.self,
1814+
from: responseBody,
1815+
transforming: { value in
1816+
.json(value)
1817+
}
1818+
)
1819+
default:
1820+
preconditionFailure("bestContentType chose an invalid content type.")
1821+
}
1822+
return .notFound(.init(body: body))
1823+
case 422:
1824+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1825+
let body: Operations.code_hyphen_scanning_sol_create_hyphen_variant_hyphen_analysis.Output.UnprocessableContent.Body
1826+
let chosenContentType = try converter.bestContentType(
1827+
received: contentType,
1828+
options: [
1829+
"application/json"
1830+
]
1831+
)
1832+
switch chosenContentType {
1833+
case "application/json":
1834+
body = try await converter.getResponseBodyAsJSON(
1835+
Components.Schemas.basic_hyphen_error.self,
1836+
from: responseBody,
1837+
transforming: { value in
1838+
.json(value)
1839+
}
1840+
)
1841+
default:
1842+
preconditionFailure("bestContentType chose an invalid content type.")
1843+
}
1844+
return .unprocessableContent(.init(body: body))
1845+
case 503:
1846+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1847+
let body: Components.Responses.service_unavailable.Body
1848+
let chosenContentType = try converter.bestContentType(
1849+
received: contentType,
1850+
options: [
1851+
"application/json"
1852+
]
1853+
)
1854+
switch chosenContentType {
1855+
case "application/json":
1856+
body = try await converter.getResponseBodyAsJSON(
1857+
Components.Responses.service_unavailable.Body.jsonPayload.self,
1858+
from: responseBody,
1859+
transforming: { value in
1860+
.json(value)
1861+
}
1862+
)
1863+
default:
1864+
preconditionFailure("bestContentType chose an invalid content type.")
1865+
}
1866+
return .serviceUnavailable(.init(body: body))
1867+
default:
1868+
return .undocumented(
1869+
statusCode: response.status.code,
1870+
.init(
1871+
headerFields: response.headerFields,
1872+
body: responseBody
1873+
)
1874+
)
1875+
}
1876+
}
1877+
)
1878+
}
1879+
/// Get the summary of a CodeQL variant analysis
1880+
///
1881+
/// Gets the summary of a CodeQL variant analysis.
1882+
///
1883+
/// OAuth app tokens and personal access tokens (classic) need the `security_events` scope to use this endpoint with private or public repositories, or the `public_repo` scope to use this endpoint with only public repositories.
1884+
///
1885+
/// - Remark: HTTP `GET /repos/{owner}/{repo}/code-scanning/codeql/variant-analyses/{codeql_variant_analysis_id}`.
1886+
/// - Remark: Generated from `#/paths//repos/{owner}/{repo}/code-scanning/codeql/variant-analyses/{codeql_variant_analysis_id}/get(code-scanning/get-variant-analysis)`.
1887+
public func code_hyphen_scanning_sol_get_hyphen_variant_hyphen_analysis(_ input: Operations.code_hyphen_scanning_sol_get_hyphen_variant_hyphen_analysis.Input) async throws -> Operations.code_hyphen_scanning_sol_get_hyphen_variant_hyphen_analysis.Output {
1888+
try await client.send(
1889+
input: input,
1890+
forOperation: Operations.code_hyphen_scanning_sol_get_hyphen_variant_hyphen_analysis.id,
1891+
serializer: { input in
1892+
let path = try converter.renderedPath(
1893+
template: "/repos/{}/{}/code-scanning/codeql/variant-analyses/{}",
1894+
parameters: [
1895+
input.path.owner,
1896+
input.path.repo,
1897+
input.path.codeql_variant_analysis_id
1898+
]
1899+
)
1900+
var request: HTTPTypes.HTTPRequest = .init(
1901+
soar_path: path,
1902+
method: .get
1903+
)
1904+
suppressMutabilityWarning(&request)
1905+
converter.setAcceptHeader(
1906+
in: &request.headerFields,
1907+
contentTypes: input.headers.accept
1908+
)
1909+
return (request, nil)
1910+
},
1911+
deserializer: { response, responseBody in
1912+
switch response.status.code {
1913+
case 200:
1914+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1915+
let body: Operations.code_hyphen_scanning_sol_get_hyphen_variant_hyphen_analysis.Output.Ok.Body
1916+
let chosenContentType = try converter.bestContentType(
1917+
received: contentType,
1918+
options: [
1919+
"application/json"
1920+
]
1921+
)
1922+
switch chosenContentType {
1923+
case "application/json":
1924+
body = try await converter.getResponseBodyAsJSON(
1925+
Components.Schemas.code_hyphen_scanning_hyphen_variant_hyphen_analysis.self,
1926+
from: responseBody,
1927+
transforming: { value in
1928+
.json(value)
1929+
}
1930+
)
1931+
default:
1932+
preconditionFailure("bestContentType chose an invalid content type.")
1933+
}
1934+
return .ok(.init(body: body))
1935+
case 404:
1936+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1937+
let body: Components.Responses.not_found.Body
1938+
let chosenContentType = try converter.bestContentType(
1939+
received: contentType,
1940+
options: [
1941+
"application/json"
1942+
]
1943+
)
1944+
switch chosenContentType {
1945+
case "application/json":
1946+
body = try await converter.getResponseBodyAsJSON(
1947+
Components.Schemas.basic_hyphen_error.self,
1948+
from: responseBody,
1949+
transforming: { value in
1950+
.json(value)
1951+
}
1952+
)
1953+
default:
1954+
preconditionFailure("bestContentType chose an invalid content type.")
1955+
}
1956+
return .notFound(.init(body: body))
1957+
case 503:
1958+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1959+
let body: Components.Responses.service_unavailable.Body
1960+
let chosenContentType = try converter.bestContentType(
1961+
received: contentType,
1962+
options: [
1963+
"application/json"
1964+
]
1965+
)
1966+
switch chosenContentType {
1967+
case "application/json":
1968+
body = try await converter.getResponseBodyAsJSON(
1969+
Components.Responses.service_unavailable.Body.jsonPayload.self,
1970+
from: responseBody,
1971+
transforming: { value in
1972+
.json(value)
1973+
}
1974+
)
1975+
default:
1976+
preconditionFailure("bestContentType chose an invalid content type.")
1977+
}
1978+
return .serviceUnavailable(.init(body: body))
1979+
default:
1980+
return .undocumented(
1981+
statusCode: response.status.code,
1982+
.init(
1983+
headerFields: response.headerFields,
1984+
body: responseBody
1985+
)
1986+
)
1987+
}
1988+
}
1989+
)
1990+
}
1991+
/// Get the analysis status of a repository in a CodeQL variant analysis
1992+
///
1993+
/// Gets the analysis status of a repository in a CodeQL variant analysis.
1994+
///
1995+
/// OAuth app tokens and personal access tokens (classic) need the `security_events` scope to use this endpoint with private or public repositories, or the `public_repo` scope to use this endpoint with only public repositories.
1996+
///
1997+
/// - Remark: HTTP `GET /repos/{owner}/{repo}/code-scanning/codeql/variant-analyses/{codeql_variant_analysis_id}/repos/{repo_owner}/{repo_name}`.
1998+
/// - Remark: Generated from `#/paths//repos/{owner}/{repo}/code-scanning/codeql/variant-analyses/{codeql_variant_analysis_id}/repos/{repo_owner}/{repo_name}/get(code-scanning/get-variant-analysis-repo-task)`.
1999+
public func code_hyphen_scanning_sol_get_hyphen_variant_hyphen_analysis_hyphen_repo_hyphen_task(_ input: Operations.code_hyphen_scanning_sol_get_hyphen_variant_hyphen_analysis_hyphen_repo_hyphen_task.Input) async throws -> Operations.code_hyphen_scanning_sol_get_hyphen_variant_hyphen_analysis_hyphen_repo_hyphen_task.Output {
2000+
try await client.send(
2001+
input: input,
2002+
forOperation: Operations.code_hyphen_scanning_sol_get_hyphen_variant_hyphen_analysis_hyphen_repo_hyphen_task.id,
2003+
serializer: { input in
2004+
let path = try converter.renderedPath(
2005+
template: "/repos/{}/{}/code-scanning/codeql/variant-analyses/{}/repos/{}/{}",
2006+
parameters: [
2007+
input.path.owner,
2008+
input.path.repo,
2009+
input.path.codeql_variant_analysis_id,
2010+
input.path.repo_owner,
2011+
input.path.repo_name
2012+
]
2013+
)
2014+
var request: HTTPTypes.HTTPRequest = .init(
2015+
soar_path: path,
2016+
method: .get
2017+
)
2018+
suppressMutabilityWarning(&request)
2019+
converter.setAcceptHeader(
2020+
in: &request.headerFields,
2021+
contentTypes: input.headers.accept
2022+
)
2023+
return (request, nil)
2024+
},
2025+
deserializer: { response, responseBody in
2026+
switch response.status.code {
2027+
case 200:
2028+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2029+
let body: Operations.code_hyphen_scanning_sol_get_hyphen_variant_hyphen_analysis_hyphen_repo_hyphen_task.Output.Ok.Body
2030+
let chosenContentType = try converter.bestContentType(
2031+
received: contentType,
2032+
options: [
2033+
"application/json"
2034+
]
2035+
)
2036+
switch chosenContentType {
2037+
case "application/json":
2038+
body = try await converter.getResponseBodyAsJSON(
2039+
Components.Schemas.code_hyphen_scanning_hyphen_variant_hyphen_analysis_hyphen_repo_hyphen_task.self,
2040+
from: responseBody,
2041+
transforming: { value in
2042+
.json(value)
2043+
}
2044+
)
2045+
default:
2046+
preconditionFailure("bestContentType chose an invalid content type.")
2047+
}
2048+
return .ok(.init(body: body))
2049+
case 404:
2050+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2051+
let body: Components.Responses.not_found.Body
2052+
let chosenContentType = try converter.bestContentType(
2053+
received: contentType,
2054+
options: [
2055+
"application/json"
2056+
]
2057+
)
2058+
switch chosenContentType {
2059+
case "application/json":
2060+
body = try await converter.getResponseBodyAsJSON(
2061+
Components.Schemas.basic_hyphen_error.self,
2062+
from: responseBody,
2063+
transforming: { value in
2064+
.json(value)
2065+
}
2066+
)
2067+
default:
2068+
preconditionFailure("bestContentType chose an invalid content type.")
2069+
}
2070+
return .notFound(.init(body: body))
2071+
case 503:
2072+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2073+
let body: Components.Responses.service_unavailable.Body
2074+
let chosenContentType = try converter.bestContentType(
2075+
received: contentType,
2076+
options: [
2077+
"application/json"
2078+
]
2079+
)
2080+
switch chosenContentType {
2081+
case "application/json":
2082+
body = try await converter.getResponseBodyAsJSON(
2083+
Components.Responses.service_unavailable.Body.jsonPayload.self,
2084+
from: responseBody,
2085+
transforming: { value in
2086+
.json(value)
2087+
}
2088+
)
2089+
default:
2090+
preconditionFailure("bestContentType chose an invalid content type.")
2091+
}
2092+
return .serviceUnavailable(.init(body: body))
2093+
default:
2094+
return .undocumented(
2095+
statusCode: response.status.code,
2096+
.init(
2097+
headerFields: response.headerFields,
2098+
body: responseBody
2099+
)
2100+
)
2101+
}
2102+
}
2103+
)
2104+
}
17322105
/// Get a code scanning default setup configuration
17332106
///
17342107
/// Gets a code scanning default setup configuration.

0 commit comments

Comments
 (0)