Skip to content

Commit

Permalink
Added Certificates API (#112)
Browse files Browse the repository at this point in the history
* Added Certificates API

Signed-off-by: Alen Abeshov <[email protected]>

* Moved structures and updated operation group.

Signed-off-by: Alen Abeshov <[email protected]>

* Added operations to opensearch.smithy

Signed-off-by: Alen Abeshov <[email protected]>

* Spotless apply.

Signed-off-by: Alen Abeshov <[email protected]>

* fixed name

Signed-off-by: Alen Abeshov <[email protected]>

* Update model/security/get_certificates/structures.smithy

Co-authored-by: Thomas Farr <[email protected]>
Signed-off-by: Alen <[email protected]>

* Update model/security/get_certificates/operations.smithy

Co-authored-by: Thomas Farr <[email protected]>
Signed-off-by: Alen <[email protected]>

* Update model/security/reload_transport_certificates/operations.smithy

Co-authored-by: Thomas Farr <[email protected]>
Signed-off-by: Alen <[email protected]>

* Update model/security/reload_http_certificates/operations.smithy

Co-authored-by: Thomas Farr <[email protected]>
Signed-off-by: Alen <[email protected]>

---------

Signed-off-by: Alen Abeshov <[email protected]>
Signed-off-by: Alen <[email protected]>
Co-authored-by: Alen Abeshov <[email protected]>
Co-authored-by: Thomas Farr <[email protected]>
  • Loading branch information
3 people committed Jun 30, 2023
1 parent b5c891e commit 9c438fd
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 0 deletions.
3 changes: 3 additions & 0 deletions model/opensearch.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ service OpenSearch {
Get,
GetAccountDetails,
GetAllPits,
GetCertificates,
GetScript,
GetScriptContext,
GetScriptLanguages,
Expand Down Expand Up @@ -298,6 +299,8 @@ service OpenSearch {
RankEval_Post_WithIndex,
Reindex,
ReindexRethrottle,
ReloadHttpCertificates,
ReloadTransportCertificates,
RemoteStoreRestore,
RenderSearchTemplate_Get,
RenderSearchTemplate_Get_WithId,
Expand Down
20 changes: 20 additions & 0 deletions model/security/certificate.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: Apache-2.0
//
// The OpenSearch Contributors require contributions made to
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

list CertificatesList {
member: CertificatesDetail
}

structure CertificatesDetail {
issuer_dn: String,
subject_dn: String,
san: String,
not_before: String,
not_after: String
}
26 changes: 26 additions & 0 deletions model/security/get_certificates/operations.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// SPDX-License-Identifier: Apache-2.0
//
// The OpenSearch Contributors require contributions made to
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch
use opensearch.openapi#vendorExtensions

@externalDocumentation(
"API Reference": "https://opensearch.org/docs/latest/security/access-control/api/#get-certificates"
)

@vendorExtensions(
"x-operation-group": "security.get_certificates",
"x-version-added": "1.0",
)
@idempotent
@suppress(["HttpUriConflict"])
@http(method: "GET", uri: "/_plugins/_security/api/ssl/certs")
@documentation("Returns the cluster’s security certificates.")
operation GetCertificates {
input: GetCertificates_Input,
output: GetCertificates_Output
}
17 changes: 17 additions & 0 deletions model/security/get_certificates/structures.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
//
// The OpenSearch Contributors require contributions made to
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

@input
structure GetCertificates_Input {}

@output
structure GetCertificates_Output {
http_certificates_list: CertificatesList,
transport_certificates_list: CertificatesList
}
26 changes: 26 additions & 0 deletions model/security/reload_http_certificates/operations.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// SPDX-License-Identifier: Apache-2.0
//
// The OpenSearch Contributors require contributions made to
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch
use opensearch.openapi#vendorExtensions

@externalDocumentation(
"API Reference": "https://opensearch.org/docs/latest/security/access-control/api/#reload-certificates"
)

@vendorExtensions(
"x-operation-group": "security.reload_http_certificates",
"x-version-added": "1.0",
)
@readonly
@suppress(["HttpUriConflict", "HttpMethodSemantics.UnexpectedPayload"])
@http(method: "PUT", uri: "/_opendistro/_security/api/ssl/http/reloadcerts")
@documentation("Reloads SSL certificates that are about to expire without restarting the OpenSearch node.")
operation ReloadHttpCertificates {
input: ReloadHttpCertificates_Input,
output: ReloadHttpCertificates_Output
}
16 changes: 16 additions & 0 deletions model/security/reload_http_certificates/structures.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: Apache-2.0
//
// The OpenSearch Contributors require contributions made to
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

@input
structure ReloadHttpCertificates_Input {}

@output
structure ReloadHttpCertificates_Output {
message: Message
}
26 changes: 26 additions & 0 deletions model/security/reload_transport_certificates/operations.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// SPDX-License-Identifier: Apache-2.0
//
// The OpenSearch Contributors require contributions made to
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch
use opensearch.openapi#vendorExtensions

@externalDocumentation(
"API Reference": "https://opensearch.org/docs/latest/security/access-control/api/#reload-certificates"
)

@vendorExtensions(
"x-operation-group": "security.reload_transport_certificates",
"x-version-added": "1.0",
)
@readonly
@suppress(["HttpUriConflict"])
@http(method: "PUT", uri: "/_opendistro/_security/api/ssl/transport/reloadcerts")
@documentation("Reloads SSL certificates that are about to expire without restarting the OpenSearch node.")
operation ReloadTransportCertificates {
input: ReloadTransportCertificates_Input,
output: ReloadTransportCertificates_Output
}
16 changes: 16 additions & 0 deletions model/security/reload_transport_certificates/structures.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: Apache-2.0
//
// The OpenSearch Contributors require contributions made to
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

@input
structure ReloadTransportCertificates_Input {}

@output
structure ReloadTransportCertificates_Output {
message: Message
}

0 comments on commit 9c438fd

Please sign in to comment.