From 89e3f053d14a0dcf5d6590764824f750efdfa1c3 Mon Sep 17 00:00:00 2001 From: Francis Chuang Date: Thu, 9 Mar 2023 14:32:10 +1100 Subject: [PATCH] Add oci_certificates_certificate_bundle and oci_certificates_certificate_authority_bundle data sources --- go.mod | 8 +- go.sum | 8 + internal/client/certificates_clients.go | 33 ++ ...cates_certificate_authority_bundle_test.go | 61 +++ .../certificates_certificate_bundle_test.go | 64 +++ internal/provider/register_datasource.go | 2 + ...ertificate_authority_bundle_data_source.go | 224 +++++++++++ ...ificates_certificate_bundle_data_source.go | 272 +++++++++++++ .../certificates/register_datasource.go | 11 + .../github.com/google/go-cmp/cmp/compare.go | 83 ++-- .../google/go-cmp/cmp/export_panic.go | 1 + .../google/go-cmp/cmp/export_unsafe.go | 1 + .../go-cmp/cmp/internal/diff/debug_disable.go | 1 + .../go-cmp/cmp/internal/diff/debug_enable.go | 1 + .../google/go-cmp/cmp/internal/diff/diff.go | 44 +- .../cmp/internal/flags/toolchain_legacy.go | 10 - .../cmp/internal/flags/toolchain_recent.go | 10 - .../google/go-cmp/cmp/internal/value/name.go | 7 + .../cmp/internal/value/pointer_purego.go | 1 + .../cmp/internal/value/pointer_unsafe.go | 1 + .../google/go-cmp/cmp/internal/value/zero.go | 48 --- .../github.com/google/go-cmp/cmp/options.go | 10 +- vendor/github.com/google/go-cmp/cmp/path.go | 22 +- .../google/go-cmp/cmp/report_compare.go | 13 +- .../google/go-cmp/cmp/report_reflect.go | 24 +- .../google/go-cmp/cmp/report_slices.go | 31 +- .../google/go-cmp/cmp/report_text.go | 1 + .../hashicorp/go-version/CHANGELOG.md | 20 + .../github.com/hashicorp/go-version/README.md | 2 +- .../hashicorp/go-version/constraint.go | 114 +++++- .../hashicorp/go-version/version.go | 23 +- .../hashicorp/terraform-json/LICENSE | 2 + .../hashicorp/terraform-json/README.md | 1 - .../hashicorp/terraform-json/config.go | 3 + .../hashicorp/terraform-json/metadata.go | 104 +++++ .../hashicorp/terraform-json/plan.go | 37 +- .../hashicorp/terraform-json/schemas.go | 60 ++- .../hashicorp/terraform-json/state.go | 50 ++- .../hashicorp/terraform-json/validate.go | 23 +- .../oci-go-sdk/v65/certificates/ca_bundle.go | 45 +++ .../certificate_authority_bundle.go | 74 ++++ ...ate_authority_bundle_version_collection.go | 39 ++ ...ficate_authority_bundle_version_summary.go | 72 ++++ .../v65/certificates/certificate_bundle.go | 237 +++++++++++ .../certificate_bundle_public_only.go | 145 +++++++ .../certificate_bundle_version_collection.go | 39 ++ .../certificate_bundle_version_summary.go | 72 ++++ .../certificate_bundle_with_private_key.go | 151 +++++++ .../v65/certificates/certificates_client.go | 377 ++++++++++++++++++ .../get_ca_bundle_request_response.go | 93 +++++ ...icate_authority_bundle_request_response.go | 159 ++++++++ ...get_certificate_bundle_request_response.go | 207 ++++++++++ ...hority_bundle_versions_request_response.go | 183 +++++++++ ...ficate_bundle_versions_request_response.go | 183 +++++++++ .../v65/certificates/revocation_reason.go | 80 ++++ .../v65/certificates/revocation_status.go | 45 +++ .../oci-go-sdk/v65/certificates/validity.go | 44 ++ .../v65/certificates/version_stage.go | 72 ++++ .../go-cty/cty/function/stdlib/collection.go | 2 +- .../zclconf/go-cty/cty/function/stdlib/csv.go | 13 +- .../go-cty/cty/function/stdlib/format.go | 2 + .../go-cty/cty/function/stdlib/number.go | 38 +- .../zclconf/go-cty/cty/primitive_type.go | 45 +++ .../zclconf/go-cty/cty/value_ops.go | 12 +- vendor/github.com/zclconf/go-cty/cty/walk.go | 35 +- vendor/modules.txt | 11 +- ...certificate_authority_bundle.html.markdown | 71 ++++ ...tificates_certificate_bundle.html.markdown | 82 ++++ 68 files changed, 3801 insertions(+), 258 deletions(-) create mode 100644 internal/client/certificates_clients.go create mode 100644 internal/integrationtest/certificates_certificate_authority_bundle_test.go create mode 100644 internal/integrationtest/certificates_certificate_bundle_test.go create mode 100644 internal/service/certificates/certificates_certificate_authority_bundle_data_source.go create mode 100644 internal/service/certificates/certificates_certificate_bundle_data_source.go create mode 100644 internal/service/certificates/register_datasource.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_legacy.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_recent.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/internal/value/zero.go create mode 100644 vendor/github.com/hashicorp/terraform-json/metadata.go create mode 100644 vendor/github.com/oracle/oci-go-sdk/v65/certificates/ca_bundle.go create mode 100644 vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_authority_bundle.go create mode 100644 vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_authority_bundle_version_collection.go create mode 100644 vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_authority_bundle_version_summary.go create mode 100644 vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_bundle.go create mode 100644 vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_bundle_public_only.go create mode 100644 vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_bundle_version_collection.go create mode 100644 vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_bundle_version_summary.go create mode 100644 vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_bundle_with_private_key.go create mode 100644 vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificates_client.go create mode 100644 vendor/github.com/oracle/oci-go-sdk/v65/certificates/get_ca_bundle_request_response.go create mode 100644 vendor/github.com/oracle/oci-go-sdk/v65/certificates/get_certificate_authority_bundle_request_response.go create mode 100644 vendor/github.com/oracle/oci-go-sdk/v65/certificates/get_certificate_bundle_request_response.go create mode 100644 vendor/github.com/oracle/oci-go-sdk/v65/certificates/list_certificate_authority_bundle_versions_request_response.go create mode 100644 vendor/github.com/oracle/oci-go-sdk/v65/certificates/list_certificate_bundle_versions_request_response.go create mode 100644 vendor/github.com/oracle/oci-go-sdk/v65/certificates/revocation_reason.go create mode 100644 vendor/github.com/oracle/oci-go-sdk/v65/certificates/revocation_status.go create mode 100644 vendor/github.com/oracle/oci-go-sdk/v65/certificates/validity.go create mode 100644 vendor/github.com/oracle/oci-go-sdk/v65/certificates/version_stage.go create mode 100644 website/docs/d/certificates_certificate_authority_bundle.html.markdown create mode 100644 website/docs/d/certificates_certificate_bundle.html.markdown diff --git a/go.mod b/go.mod index 8f15e5c239d..18fcbda4e0a 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( github.com/gofrs/flock v0.8.1 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/golang/protobuf v1.4.2 // indirect - github.com/google/go-cmp v0.5.6 // indirect + github.com/google/go-cmp v0.5.9 // indirect github.com/googleapis/gax-go/v2 v2.0.5 // indirect github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect @@ -35,10 +35,10 @@ require ( github.com/hashicorp/go-plugin v1.4.1 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect github.com/hashicorp/go-uuid v1.0.1 // indirect - github.com/hashicorp/go-version v1.3.0 + github.com/hashicorp/go-version v1.6.0 github.com/hashicorp/hcl/v2 v2.8.2 // indirect github.com/hashicorp/logutils v1.0.0 // indirect - github.com/hashicorp/terraform-json v0.12.0 // indirect + github.com/hashicorp/terraform-json v0.15.0 // indirect github.com/hashicorp/terraform-plugin-go v0.3.0 // indirect github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect @@ -58,7 +58,7 @@ require ( github.com/sony/gobreaker v0.5.0 // indirect github.com/ulikunitz/xz v0.5.8 // indirect github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect - github.com/zclconf/go-cty v1.8.4 // indirect + github.com/zclconf/go-cty v1.10.0 // indirect go.opencensus.io v0.22.4 // indirect golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect diff --git a/go.sum b/go.sum index 9772923415d..aaaba27b4c4 100644 --- a/go.sum +++ b/go.sum @@ -149,6 +149,8 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0 h1:pMen7vLs8nvgEYhywH3KDWJIJTeEr2ULsVWHWYHQyBs= @@ -195,6 +197,8 @@ github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.3.0 h1:McDWVJIU/y+u1BRV06dPaLfLCaT7fUTJLp5r04x7iNw= github.com/hashicorp/go-version v1.3.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= +github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl/v2 v2.3.0/go.mod h1:d+FwDBbOLvpAM3Z6J7gPj/VoAGkNe/gm352ZhjJ/Zv8= @@ -208,6 +212,8 @@ github.com/hashicorp/terraform-exec v0.14.0 h1:UQoUcxKTZZXhyyK68Cwn4mApT4mnFPmEX github.com/hashicorp/terraform-exec v0.14.0/go.mod h1:qrAASDq28KZiMPDnQ02sFS9udcqEkRly002EA2izXTA= github.com/hashicorp/terraform-json v0.12.0 h1:8czPgEEWWPROStjkWPUnTQDXmpmZPlkQAwYYLETaTvw= github.com/hashicorp/terraform-json v0.12.0/go.mod h1:pmbq9o4EuL43db5+0ogX10Yofv1nozM+wskr/bGFJpI= +github.com/hashicorp/terraform-json v0.15.0 h1:/gIyNtR6SFw6h5yzlbDbACyGvIhKtQi8mTsbkNd79lE= +github.com/hashicorp/terraform-json v0.15.0/go.mod h1:+L1RNzjDU5leLFZkHTFTbJXaoqUC6TqXlFgDoOXrtvk= github.com/hashicorp/terraform-plugin-go v0.3.0 h1:AJqYzP52JFYl9NABRI7smXI1pNjgR5Q/y2WyVJ/BOZA= github.com/hashicorp/terraform-plugin-go v0.3.0/go.mod h1:dFHsQMaTLpON2gWhVWT96fvtlc/MF1vSy3OdMhWBzdM= github.com/hashicorp/terraform-plugin-sdk/v2 v2.7.0 h1:SuI59MqNjYDrL7EfqHX9V6P/24isgqYx/FdglwVs9bg= @@ -340,6 +346,8 @@ github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q github.com/zclconf/go-cty v1.2.1/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= github.com/zclconf/go-cty v1.8.4 h1:pwhhz5P+Fjxse7S7UriBrMu6AUJSZM5pKqGem1PjGAs= github.com/zclconf/go-cty v1.8.4/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= +github.com/zclconf/go-cty v1.10.0 h1:mp9ZXQeIcN8kAwuqorjH+Q+njbJKjLrvB2yIh4q7U+0= +github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= diff --git a/internal/client/certificates_clients.go b/internal/client/certificates_clients.go new file mode 100644 index 00000000000..3956410e043 --- /dev/null +++ b/internal/client/certificates_clients.go @@ -0,0 +1,33 @@ +// Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. +// Licensed under the Mozilla Public License v2.0 + +package client + +import ( + oci_certificates "github.com/oracle/oci-go-sdk/v65/certificates" + oci_common "github.com/oracle/oci-go-sdk/v65/common" +) + +func init() { + RegisterOracleClient("oci_certificates.CertificatesClient", &OracleClient{InitClientFn: initCertificatesCertificatesClient}) +} + +func initCertificatesCertificatesClient(configProvider oci_common.ConfigurationProvider, configureClient ConfigureClient, serviceClientOverrides ServiceClientOverrides) (interface{}, error) { + client, err := oci_certificates.NewCertificatesClientWithConfigurationProvider(configProvider) + if err != nil { + return nil, err + } + err = configureClient(&client.BaseClient) + if err != nil { + return nil, err + } + + if serviceClientOverrides.HostUrlOverride != "" { + client.Host = serviceClientOverrides.HostUrlOverride + } + return &client, nil +} + +func (m *OracleClients) CertificatesClient() *oci_certificates.CertificatesClient { + return m.GetClient("oci_certificates.CertificatesClient").(*oci_certificates.CertificatesClient) +} diff --git a/internal/integrationtest/certificates_certificate_authority_bundle_test.go b/internal/integrationtest/certificates_certificate_authority_bundle_test.go new file mode 100644 index 00000000000..fd5356f6033 --- /dev/null +++ b/internal/integrationtest/certificates_certificate_authority_bundle_test.go @@ -0,0 +1,61 @@ +// Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. +// Licensed under the Mozilla Public License v2.0 + +package integrationtest + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + "github.com/oracle/terraform-provider-oci/httpreplay" + "github.com/oracle/terraform-provider-oci/internal/acctest" + + "github.com/oracle/terraform-provider-oci/internal/utils" +) + +var ( + CertificatesCertificateAuthorityBundleSingularDataSourceRepresentation = map[string]interface{}{ + "certificate_authority_id": acctest.Representation{RepType: acctest.Required, Create: `${oci_certificates_management_certificate_authority.test_certificate_authority.id}`}, + "stage": acctest.Representation{RepType: acctest.Optional, Create: `CURRENT`}, + } + + CertificatesCertificateAuthorityBundleResourceConfig = acctest.GenerateResourceFromRepresentationMap("oci_certificates_management_certificate_authority", "test_certificate_authority", acctest.Required, acctest.Create, certificateAuthorityRepresentation) +) + +// issue-routing-tag: certificates/default +func TestCertificatesCertificateAuthorityBundleResource_basic(t *testing.T) { + httpreplay.SetScenario("TestCertificatesCertificateAuthorityBundleResource_basic") + defer httpreplay.SaveScenario() + + config := acctest.ProviderTestConfig() + + compartmentId := utils.GetEnvSettingWithBlankDefault("compartment_ocid") + compartmentIdVariableStr := fmt.Sprintf("variable \"compartment_id\" { default = \"%s\" }\n", compartmentId) + + singularDatasourceName := "data.oci_certificates_certificate_authority_bundle.test_certificate_authority_bundle" + + acctest.SaveConfigContent("", "", "", t) + acctest.ResourceTest(t, nil, []resource.TestStep{ + // verify singular datasource + { + Config: config + + acctest.GenerateDataSourceFromRepresentationMap("oci_certificates_certificate_authority_bundle", "test_certificate_authority_bundle", acctest.Optional, acctest.Create, CertificatesCertificateAuthorityBundleSingularDataSourceRepresentation) + + compartmentIdVariableStr + CertificatesCertificateAuthorityBundleResourceConfig, + Check: acctest.ComposeAggregateTestCheckFuncWrapper( + resource.TestCheckResourceAttrSet(singularDatasourceName, "cert_chain_pem"), + resource.TestCheckResourceAttrSet(singularDatasourceName, "certificate_authority_id"), + resource.TestCheckResourceAttrSet(singularDatasourceName, "certificate_authority_name"), + resource.TestCheckResourceAttrSet(singularDatasourceName, "certificate_pem"), + resource.TestCheckResourceAttrSet(singularDatasourceName, "serial_number"), + resource.TestCheckResourceAttr(singularDatasourceName, "stages.#", "2"), + resource.TestCheckResourceAttrSet(singularDatasourceName, "time_created"), + resource.TestCheckResourceAttr(singularDatasourceName, "validity.#", "1"), + resource.TestCheckResourceAttrSet(singularDatasourceName, "validity.0.time_of_validity_not_before"), + resource.TestCheckResourceAttrSet(singularDatasourceName, "validity.0.time_of_validity_not_after"), + resource.TestCheckResourceAttr(singularDatasourceName, "version_number", "1"), + ), + }, + }) +} diff --git a/internal/integrationtest/certificates_certificate_bundle_test.go b/internal/integrationtest/certificates_certificate_bundle_test.go new file mode 100644 index 00000000000..d8aae41c73a --- /dev/null +++ b/internal/integrationtest/certificates_certificate_bundle_test.go @@ -0,0 +1,64 @@ +// Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. +// Licensed under the Mozilla Public License v2.0 + +package integrationtest + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + "github.com/oracle/terraform-provider-oci/httpreplay" + "github.com/oracle/terraform-provider-oci/internal/acctest" + + "github.com/oracle/terraform-provider-oci/internal/utils" +) + +var ( + CertificatesCertificateBundleSingularDataSourceRepresentation = map[string]interface{}{ + "certificate_id": acctest.Representation{RepType: acctest.Required, Create: `${oci_certificates_management_certificate.test_certificate.id}`}, + "certificate_bundle_type": acctest.Representation{RepType: acctest.Optional, Create: `CERTIFICATE_CONTENT_WITH_PRIVATE_KEY`}, + "stage": acctest.Representation{RepType: acctest.Optional, Create: `CURRENT`}, + } + + CertificatesCertificateBundleResourceConfig = acctest.GenerateResourceFromRepresentationMap("oci_certificates_management_certificate", "test_certificate", acctest.Required, acctest.Create, certificatesManagementCertificateRepresentation) +) + +// issue-routing-tag: certificates/default +func TestCertificatesCertificateBundleResource_basic(t *testing.T) { + httpreplay.SetScenario("TestCertificatesCertificateBundleResource_basic") + defer httpreplay.SaveScenario() + + config := acctest.ProviderTestConfig() + + compartmentId := utils.GetEnvSettingWithBlankDefault("compartment_ocid") + compartmentIdVariableStr := fmt.Sprintf("variable \"compartment_id\" { default = \"%s\" }\n", compartmentId) + + singularDatasourceName := "data.oci_certificates_certificate_bundle.test_certificate_bundle" + + acctest.SaveConfigContent("", "", "", t) + acctest.ResourceTest(t, nil, []resource.TestStep{ + // verify singular datasource + { + Config: config + + acctest.GenerateDataSourceFromRepresentationMap("oci_certificates_certificate_bundle", "test_certificate_bundle", acctest.Optional, acctest.Create, CertificatesCertificateBundleSingularDataSourceRepresentation) + + compartmentIdVariableStr + CertificatesCertificateBundleResourceConfig, + Check: acctest.ComposeAggregateTestCheckFuncWrapper( + resource.TestCheckResourceAttrSet(singularDatasourceName, "cert_chain_pem"), + resource.TestCheckResourceAttr(singularDatasourceName, "certificate_bundle_type", "CERTIFICATE_CONTENT_WITH_PRIVATE_KEY"), + resource.TestCheckResourceAttrSet(singularDatasourceName, "certificate_id"), + resource.TestCheckResourceAttrSet(singularDatasourceName, "certificate_name"), + resource.TestCheckResourceAttrSet(singularDatasourceName, "certificate_pem"), + resource.TestCheckResourceAttrSet(singularDatasourceName, "private_key_pem"), + resource.TestCheckResourceAttrSet(singularDatasourceName, "serial_number"), + resource.TestCheckResourceAttr(singularDatasourceName, "stages.#", "2"), + resource.TestCheckResourceAttrSet(singularDatasourceName, "time_created"), + resource.TestCheckResourceAttr(singularDatasourceName, "validity.#", "1"), + resource.TestCheckResourceAttrSet(singularDatasourceName, "validity.0.time_of_validity_not_before"), + resource.TestCheckResourceAttrSet(singularDatasourceName, "validity.0.time_of_validity_not_after"), + resource.TestCheckResourceAttr(singularDatasourceName, "version_number", "1"), + ), + }, + }) +} diff --git a/internal/provider/register_datasource.go b/internal/provider/register_datasource.go index 074497c990c..3c2c25d7640 100644 --- a/internal/provider/register_datasource.go +++ b/internal/provider/register_datasource.go @@ -24,6 +24,7 @@ import ( tf_bds "github.com/oracle/terraform-provider-oci/internal/service/bds" tf_blockchain "github.com/oracle/terraform-provider-oci/internal/service/blockchain" tf_budget "github.com/oracle/terraform-provider-oci/internal/service/budget" + tf_certificates "github.com/oracle/terraform-provider-oci/internal/service/certificates" tf_certificates_management "github.com/oracle/terraform-provider-oci/internal/service/certificates_management" tf_cloud_bridge "github.com/oracle/terraform-provider-oci/internal/service/cloud_bridge" tf_cloud_guard "github.com/oracle/terraform-provider-oci/internal/service/cloud_guard" @@ -134,6 +135,7 @@ func init() { tf_bds.RegisterDatasource() tf_blockchain.RegisterDatasource() tf_budget.RegisterDatasource() + tf_certificates.RegisterDatasource() tf_certificates_management.RegisterDatasource() tf_cloud_bridge.RegisterDatasource() tf_cloud_guard.RegisterDatasource() diff --git a/internal/service/certificates/certificates_certificate_authority_bundle_data_source.go b/internal/service/certificates/certificates_certificate_authority_bundle_data_source.go new file mode 100644 index 00000000000..40e665b2268 --- /dev/null +++ b/internal/service/certificates/certificates_certificate_authority_bundle_data_source.go @@ -0,0 +1,224 @@ +// Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. +// Licensed under the Mozilla Public License v2.0 + +package certificates + +import ( + "context" + "fmt" + "strconv" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + oci_certificates "github.com/oracle/oci-go-sdk/v65/certificates" + "github.com/oracle/terraform-provider-oci/internal/client" + "github.com/oracle/terraform-provider-oci/internal/tfresource" +) + +func CertificatesCertificateAuthorityBundleDataSource() *schema.Resource { + return &schema.Resource{ + Read: readCertificatesCertificateAuthorityBundle, + Schema: map[string]*schema.Schema{ + "cert_chain_pem": { + Type: schema.TypeString, + Computed: true, + }, + "certificate_authority_id": { + Type: schema.TypeString, + Required: true, + }, + "certificate_authority_name": { + Type: schema.TypeString, + Computed: true, + }, + "certificate_pem": { + Type: schema.TypeString, + Computed: true, + }, + "certificate_authority_version_name": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "revocation_status": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "time_revoked": { + Type: schema.TypeString, + Required: true, + }, + "revocation_reason": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "serial_number": { + Type: schema.TypeString, + Computed: true, + }, + "stage": { + Type: schema.TypeString, + DiffSuppressFunc: tfresource.EqualIgnoreCaseSuppressDiff, + ValidateFunc: validation.StringInSlice([]string{ + "CURRENT", + "PENDING", + "LATEST", + "PREVIOUS", + "DEPRECATED", + }, true), + Optional: true, + }, + "stages": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "time_created": { + Type: schema.TypeString, + Computed: true, + }, + "validity": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "time_of_validity_not_before": { + Type: schema.TypeString, + Required: true, + }, + "time_of_validity_not_after": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "version_name": { + Type: schema.TypeString, + Computed: true, + }, + "version_number": { + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + }, + } +} + +func readCertificatesCertificateAuthorityBundle(d *schema.ResourceData, m interface{}) error { + sync := &CertificatesCertificateAuthorityBundleDataSourceCrud{} + sync.D = d + sync.Client = m.(*client.OracleClients).CertificatesClient() + + return tfresource.ReadResource(sync) +} + +type CertificatesCertificateAuthorityBundleDataSourceCrud struct { + D *schema.ResourceData + Client *oci_certificates.CertificatesClient + Res *oci_certificates.GetCertificateAuthorityBundleResponse +} + +func (s *CertificatesCertificateAuthorityBundleDataSourceCrud) VoidState() { + s.D.SetId("") +} + +func (s *CertificatesCertificateAuthorityBundleDataSourceCrud) Get() error { + request := oci_certificates.GetCertificateAuthorityBundleRequest{} + + if certificateAuthorityId, ok := s.D.GetOkExists("certificate_authority_id"); ok { + tmp := certificateAuthorityId.(string) + request.CertificateAuthorityId = &tmp + } + + if versionNumber, ok := s.D.GetOkExists("version_number"); ok { + tmp := versionNumber.(string) + tmpInt64, err := strconv.ParseInt(tmp, 10, 64) + if err != nil { + return fmt.Errorf("unable to convert versionNumber string: %s to an int64 and encountered error: %v", tmp, err) + } + request.VersionNumber = &tmpInt64 + } + + if certificateAuthorityVersionName, ok := s.D.GetOkExists("certificate_authority_version_name"); ok { + tmp := certificateAuthorityVersionName.(string) + request.CertificateAuthorityVersionName = &tmp + } + + if stage, ok := s.D.GetOkExists("stage"); ok { + request.Stage = oci_certificates.GetCertificateAuthorityBundleStageEnum(stage.(string)) + } + + request.RequestMetadata.RetryPolicy = tfresource.GetRetryPolicy(false, "certificates") + + response, err := s.Client.GetCertificateAuthorityBundle(context.Background(), request) + if err != nil { + return err + } + + s.Res = &response + return nil +} + +func (s *CertificatesCertificateAuthorityBundleDataSourceCrud) SetData() error { + if s.Res == nil { + return nil + } + + s.D.SetId(*s.Res.CertificateAuthorityId) + + if s.Res.CertChainPem != nil { + s.D.Set("cert_chain_pem", *s.Res.CertChainPem) + } + + if s.Res.CertificateAuthorityName != nil { + s.D.Set("certificate_authority_name", *s.Res.CertificateAuthorityName) + } + + if s.Res.CertificatePem != nil { + s.D.Set("certificate_pem", *s.Res.CertificatePem) + } + + if s.Res.RevocationStatus != nil { + s.D.Set("revocation_status", []interface{}{revocationStatusToMap(s.Res.RevocationStatus)}) + } else { + s.D.Set("revocation_status", nil) + } + + if s.Res.SerialNumber != nil { + s.D.Set("serial_number", *s.Res.SerialNumber) + } + + stages := []interface{}{} + for _, item := range s.Res.Stages { + stages = append(stages, item) + } + s.D.Set("stages", stages) + + if s.Res.TimeCreated != nil { + s.D.Set("time_created", s.Res.TimeCreated.String()) + } + + if s.Res.Validity != nil { + s.D.Set("validity", []interface{}{validityToMap(s.Res.Validity)}) + } else { + s.D.Set("validity", nil) + } + + if s.Res.VersionName != nil { + s.D.Set("version_name", *s.Res.VersionName) + } + + if s.Res.VersionNumber != nil { + s.D.Set("version_number", strconv.FormatInt(*s.Res.VersionNumber, 10)) + } + + return nil +} diff --git a/internal/service/certificates/certificates_certificate_bundle_data_source.go b/internal/service/certificates/certificates_certificate_bundle_data_source.go new file mode 100644 index 00000000000..bca920315fe --- /dev/null +++ b/internal/service/certificates/certificates_certificate_bundle_data_source.go @@ -0,0 +1,272 @@ +// Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. +// Licensed under the Mozilla Public License v2.0 + +package certificates + +import ( + "context" + "fmt" + "strconv" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + oci_certificates "github.com/oracle/oci-go-sdk/v65/certificates" + "github.com/oracle/terraform-provider-oci/internal/client" + "github.com/oracle/terraform-provider-oci/internal/tfresource" +) + +func CertificatesCertificateBundleDataSource() *schema.Resource { + return &schema.Resource{ + Read: readCertificatesCertificateBundle, + Schema: map[string]*schema.Schema{ + "cert_chain_pem": { + Type: schema.TypeString, + Computed: true, + }, + "certificate_bundle_type": { + Type: schema.TypeString, + DiffSuppressFunc: tfresource.EqualIgnoreCaseSuppressDiff, + ValidateFunc: validation.StringInSlice([]string{ + "CERTIFICATE_CONTENT_PUBLIC_ONLY", + "CERTIFICATE_CONTENT_WITH_PRIVATE_KEY", + }, true), + Optional: true, + Computed: true, + }, + "certificate_id": { + Type: schema.TypeString, + Required: true, + }, + "certificate_name": { + Type: schema.TypeString, + Computed: true, + }, + "certificate_pem": { + Type: schema.TypeString, + Computed: true, + }, + "certificate_version_name": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "private_key_pem": { + Type: schema.TypeString, + Computed: true, + }, + "private_key_pem_passphrase": { + Type: schema.TypeString, + Computed: true, + }, + "revocation_status": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "time_revoked": { + Type: schema.TypeString, + Required: true, + }, + "revocation_reason": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "serial_number": { + Type: schema.TypeString, + Computed: true, + }, + "stage": { + Type: schema.TypeString, + DiffSuppressFunc: tfresource.EqualIgnoreCaseSuppressDiff, + ValidateFunc: validation.StringInSlice([]string{ + "CURRENT", + "PENDING", + "LATEST", + "PREVIOUS", + "DEPRECATED", + }, true), + Optional: true, + }, + "stages": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "time_created": { + Type: schema.TypeString, + Computed: true, + }, + "validity": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "time_of_validity_not_before": { + Type: schema.TypeString, + Required: true, + }, + "time_of_validity_not_after": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "version_number": { + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + }, + } +} + +func readCertificatesCertificateBundle(d *schema.ResourceData, m interface{}) error { + sync := &CertificatesCertificateBundleDataSourceCrud{} + sync.D = d + sync.Client = m.(*client.OracleClients).CertificatesClient() + + return tfresource.ReadResource(sync) +} + +type CertificatesCertificateBundleDataSourceCrud struct { + D *schema.ResourceData + Client *oci_certificates.CertificatesClient + Res *oci_certificates.GetCertificateBundleResponse +} + +func (s *CertificatesCertificateBundleDataSourceCrud) VoidState() { + s.D.SetId("") +} + +func (s *CertificatesCertificateBundleDataSourceCrud) Get() error { + request := oci_certificates.GetCertificateBundleRequest{} + + if certificateId, ok := s.D.GetOkExists("certificate_id"); ok { + tmp := certificateId.(string) + request.CertificateId = &tmp + } + + if versionNumber, ok := s.D.GetOkExists("version_number"); ok { + tmp := versionNumber.(string) + tmpInt64, err := strconv.ParseInt(tmp, 10, 64) + if err != nil { + return fmt.Errorf("unable to convert versionNumber string: %s to an int64 and encountered error: %v", tmp, err) + } + request.VersionNumber = &tmpInt64 + } + + if certificateVersionName, ok := s.D.GetOkExists("certificate_version_name"); ok { + tmp := certificateVersionName.(string) + request.CertificateVersionName = &tmp + } + + if stage, ok := s.D.GetOkExists("stage"); ok { + request.Stage = oci_certificates.GetCertificateBundleStageEnum(stage.(string)) + } + + if certificateBundleType, ok := s.D.GetOkExists("certificate_bundle_type"); ok { + request.CertificateBundleType = oci_certificates.GetCertificateBundleCertificateBundleTypeEnum(certificateBundleType.(string)) + } + + request.RequestMetadata.RetryPolicy = tfresource.GetRetryPolicy(false, "certificates") + + response, err := s.Client.GetCertificateBundle(context.Background(), request) + if err != nil { + return err + } + + s.Res = &response + return nil +} + +func (s *CertificatesCertificateBundleDataSourceCrud) SetData() error { + if s.Res == nil { + return nil + } + + s.D.SetId(*s.Res.GetCertificateId()) + + if s.Res.GetCertificateName() != nil { + s.D.Set("certificate_name", *s.Res.GetCertificateName()) + } + + if s.Res.GetVersionNumber() != nil { + s.D.Set("version_number", strconv.FormatInt(*s.Res.GetVersionNumber(), 10)) + } + + if s.Res.GetSerialNumber() != nil { + s.D.Set("serial_number", *s.Res.GetSerialNumber()) + } + + if s.Res.GetTimeCreated() != nil { + s.D.Set("time_created", s.Res.GetTimeCreated().String()) + } + + if s.Res.GetValidity() != nil { + s.D.Set("validity", []interface{}{validityToMap(s.Res.GetValidity())}) + } else { + s.D.Set("validity", nil) + } + + stages := []interface{}{} + for _, item := range s.Res.GetStages() { + stages = append(stages, item) + } + s.D.Set("stages", stages) + + if s.Res.GetCertificatePem() != nil { + s.D.Set("certificate_pem", *s.Res.GetCertificatePem()) + } + + if s.Res.GetCertChainPem() != nil { + s.D.Set("cert_chain_pem", *s.Res.GetCertChainPem()) + } + + if s.Res.GetVersionName() != nil { + s.D.Set("version_name", *s.Res.GetVersionName()) + } + + if s.Res.GetRevocationStatus() != nil { + s.D.Set("revocation_status", []interface{}{revocationStatusToMap(s.Res.GetRevocationStatus())}) + } else { + s.D.Set("revocation_status", nil) + } + + if bundle, ok := s.Res.CertificateBundle.(oci_certificates.CertificateBundleWithPrivateKey); ok { + if bundle.PrivateKeyPem != nil { + s.D.Set("private_key_pem", *bundle.PrivateKeyPem) + } + if bundle.PrivateKeyPemPassphrase != nil { + s.D.Set("private_key_passphrase", *bundle.PrivateKeyPemPassphrase) + } + s.D.Set("certificate_bundle_type", "CERTIFICATE_CONTENT_WITH_PRIVATE_KEY") + } else { + s.D.Set("certificate_bundle_type", "CERTIFICATE_CONTENT_PUBLIC_ONLY") + } + + return nil +} + +func validityToMap(obj *oci_certificates.Validity) map[string]interface{} { + result := map[string]interface{}{ + "time_of_validity_not_before": obj.TimeOfValidityNotBefore.String(), + "time_of_validity_not_after": obj.TimeOfValidityNotAfter.String(), + } + + return result +} + +func revocationStatusToMap(obj *oci_certificates.RevocationStatus) map[string]interface{} { + result := map[string]interface{}{ + "time_revoked": obj.TimeRevoked.String(), + "revocation_reason": obj.RevocationReason, + } + + return result +} diff --git a/internal/service/certificates/register_datasource.go b/internal/service/certificates/register_datasource.go new file mode 100644 index 00000000000..cde593914c8 --- /dev/null +++ b/internal/service/certificates/register_datasource.go @@ -0,0 +1,11 @@ +// Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. +// Licensed under the Mozilla Public License v2.0 + +package certificates + +import "github.com/oracle/terraform-provider-oci/internal/tfresource" + +func RegisterDatasource() { + tfresource.RegisterDatasource("oci_certificates_certificate_bundle", CertificatesCertificateBundleDataSource()) + tfresource.RegisterDatasource("oci_certificates_certificate_authority_bundle", CertificatesCertificateAuthorityBundleDataSource()) +} diff --git a/vendor/github.com/google/go-cmp/cmp/compare.go b/vendor/github.com/google/go-cmp/cmp/compare.go index 86d0903b8b5..087320da7f0 100644 --- a/vendor/github.com/google/go-cmp/cmp/compare.go +++ b/vendor/github.com/google/go-cmp/cmp/compare.go @@ -13,21 +13,21 @@ // // The primary features of cmp are: // -// • When the default behavior of equality does not suit the needs of the test, -// custom equality functions can override the equality operation. -// For example, an equality function may report floats as equal so long as they -// are within some tolerance of each other. +// - When the default behavior of equality does not suit the test's needs, +// custom equality functions can override the equality operation. +// For example, an equality function may report floats as equal so long as +// they are within some tolerance of each other. // -// • Types that have an Equal method may use that method to determine equality. -// This allows package authors to determine the equality operation for the types -// that they define. +// - Types with an Equal method may use that method to determine equality. +// This allows package authors to determine the equality operation +// for the types that they define. // -// • If no custom equality functions are used and no Equal method is defined, -// equality is determined by recursively comparing the primitive kinds on both -// values, much like reflect.DeepEqual. Unlike reflect.DeepEqual, unexported -// fields are not compared by default; they result in panics unless suppressed -// by using an Ignore option (see cmpopts.IgnoreUnexported) or explicitly -// compared using the Exporter option. +// - If no custom equality functions are used and no Equal method is defined, +// equality is determined by recursively comparing the primitive kinds on +// both values, much like reflect.DeepEqual. Unlike reflect.DeepEqual, +// unexported fields are not compared by default; they result in panics +// unless suppressed by using an Ignore option (see cmpopts.IgnoreUnexported) +// or explicitly compared using the Exporter option. package cmp import ( @@ -36,33 +36,34 @@ import ( "strings" "github.com/google/go-cmp/cmp/internal/diff" - "github.com/google/go-cmp/cmp/internal/flags" "github.com/google/go-cmp/cmp/internal/function" "github.com/google/go-cmp/cmp/internal/value" ) +// TODO(≥go1.18): Use any instead of interface{}. + // Equal reports whether x and y are equal by recursively applying the // following rules in the given order to x and y and all of their sub-values: // -// • Let S be the set of all Ignore, Transformer, and Comparer options that -// remain after applying all path filters, value filters, and type filters. -// If at least one Ignore exists in S, then the comparison is ignored. -// If the number of Transformer and Comparer options in S is greater than one, -// then Equal panics because it is ambiguous which option to use. -// If S contains a single Transformer, then use that to transform the current -// values and recursively call Equal on the output values. -// If S contains a single Comparer, then use that to compare the current values. -// Otherwise, evaluation proceeds to the next rule. +// - Let S be the set of all Ignore, Transformer, and Comparer options that +// remain after applying all path filters, value filters, and type filters. +// If at least one Ignore exists in S, then the comparison is ignored. +// If the number of Transformer and Comparer options in S is non-zero, +// then Equal panics because it is ambiguous which option to use. +// If S contains a single Transformer, then use that to transform +// the current values and recursively call Equal on the output values. +// If S contains a single Comparer, then use that to compare the current values. +// Otherwise, evaluation proceeds to the next rule. // -// • If the values have an Equal method of the form "(T) Equal(T) bool" or -// "(T) Equal(I) bool" where T is assignable to I, then use the result of -// x.Equal(y) even if x or y is nil. Otherwise, no such method exists and -// evaluation proceeds to the next rule. +// - If the values have an Equal method of the form "(T) Equal(T) bool" or +// "(T) Equal(I) bool" where T is assignable to I, then use the result of +// x.Equal(y) even if x or y is nil. Otherwise, no such method exists and +// evaluation proceeds to the next rule. // -// • Lastly, try to compare x and y based on their basic kinds. -// Simple kinds like booleans, integers, floats, complex numbers, strings, and -// channels are compared using the equivalent of the == operator in Go. -// Functions are only equal if they are both nil, otherwise they are unequal. +// - Lastly, try to compare x and y based on their basic kinds. +// Simple kinds like booleans, integers, floats, complex numbers, strings, +// and channels are compared using the equivalent of the == operator in Go. +// Functions are only equal if they are both nil, otherwise they are unequal. // // Structs are equal if recursively calling Equal on all fields report equal. // If a struct contains unexported fields, Equal panics unless an Ignore option @@ -143,7 +144,7 @@ func rootStep(x, y interface{}) PathStep { // so that they have the same parent type. var t reflect.Type if !vx.IsValid() || !vy.IsValid() || vx.Type() != vy.Type() { - t = reflect.TypeOf((*interface{})(nil)).Elem() + t = anyType if vx.IsValid() { vvx := reflect.New(t).Elem() vvx.Set(vx) @@ -319,7 +320,6 @@ func (s *state) tryMethod(t reflect.Type, vx, vy reflect.Value) bool { } func (s *state) callTRFunc(f, v reflect.Value, step Transform) reflect.Value { - v = sanitizeValue(v, f.Type().In(0)) if !s.dynChecker.Next() { return f.Call([]reflect.Value{v})[0] } @@ -343,8 +343,6 @@ func (s *state) callTRFunc(f, v reflect.Value, step Transform) reflect.Value { } func (s *state) callTTBFunc(f, x, y reflect.Value) bool { - x = sanitizeValue(x, f.Type().In(0)) - y = sanitizeValue(y, f.Type().In(1)) if !s.dynChecker.Next() { return f.Call([]reflect.Value{x, y})[0].Bool() } @@ -372,19 +370,6 @@ func detectRaces(c chan<- reflect.Value, f reflect.Value, vs ...reflect.Value) { ret = f.Call(vs)[0] } -// sanitizeValue converts nil interfaces of type T to those of type R, -// assuming that T is assignable to R. -// Otherwise, it returns the input value as is. -func sanitizeValue(v reflect.Value, t reflect.Type) reflect.Value { - // TODO(≥go1.10): Workaround for reflect bug (https://golang.org/issue/22143). - if !flags.AtLeastGo110 { - if v.Kind() == reflect.Interface && v.IsNil() && v.Type() != t { - return reflect.New(t).Elem() - } - } - return v -} - func (s *state) compareStruct(t reflect.Type, vx, vy reflect.Value) { var addr bool var vax, vay reflect.Value // Addressable versions of vx and vy @@ -654,7 +639,9 @@ type dynChecker struct{ curr, next int } // Next increments the state and reports whether a check should be performed. // // Checks occur every Nth function call, where N is a triangular number: +// // 0 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 ... +// // See https://en.wikipedia.org/wiki/Triangular_number // // This sequence ensures that the cost of checks drops significantly as diff --git a/vendor/github.com/google/go-cmp/cmp/export_panic.go b/vendor/github.com/google/go-cmp/cmp/export_panic.go index 5ff0b4218c6..ae851fe53f2 100644 --- a/vendor/github.com/google/go-cmp/cmp/export_panic.go +++ b/vendor/github.com/google/go-cmp/cmp/export_panic.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build purego // +build purego package cmp diff --git a/vendor/github.com/google/go-cmp/cmp/export_unsafe.go b/vendor/github.com/google/go-cmp/cmp/export_unsafe.go index 21eb54858e0..e2c0f74e839 100644 --- a/vendor/github.com/google/go-cmp/cmp/export_unsafe.go +++ b/vendor/github.com/google/go-cmp/cmp/export_unsafe.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego // +build !purego package cmp diff --git a/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go b/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go index 1daaaacc5ee..36062a604ca 100644 --- a/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go +++ b/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !cmp_debug // +build !cmp_debug package diff diff --git a/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_enable.go b/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_enable.go index 4b91dbcacae..a3b97a1ad57 100644 --- a/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_enable.go +++ b/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_enable.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build cmp_debug // +build cmp_debug package diff diff --git a/vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go b/vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go index bc196b16cfa..a248e5436d9 100644 --- a/vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go +++ b/vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go @@ -127,9 +127,9 @@ var randBool = rand.New(rand.NewSource(time.Now().Unix())).Intn(2) == 0 // This function returns an edit-script, which is a sequence of operations // needed to convert one list into the other. The following invariants for // the edit-script are maintained: -// • eq == (es.Dist()==0) -// • nx == es.LenX() -// • ny == es.LenY() +// - eq == (es.Dist()==0) +// - nx == es.LenX() +// - ny == es.LenY() // // This algorithm is not guaranteed to be an optimal solution (i.e., one that // produces an edit-script with a minimal Levenshtein distance). This algorithm @@ -169,12 +169,13 @@ func Difference(nx, ny int, f EqualFunc) (es EditScript) { // A diagonal edge is equivalent to a matching symbol between both X and Y. // Invariants: - // • 0 ≤ fwdPath.X ≤ (fwdFrontier.X, revFrontier.X) ≤ revPath.X ≤ nx - // • 0 ≤ fwdPath.Y ≤ (fwdFrontier.Y, revFrontier.Y) ≤ revPath.Y ≤ ny + // - 0 ≤ fwdPath.X ≤ (fwdFrontier.X, revFrontier.X) ≤ revPath.X ≤ nx + // - 0 ≤ fwdPath.Y ≤ (fwdFrontier.Y, revFrontier.Y) ≤ revPath.Y ≤ ny // // In general: - // • fwdFrontier.X < revFrontier.X - // • fwdFrontier.Y < revFrontier.Y + // - fwdFrontier.X < revFrontier.X + // - fwdFrontier.Y < revFrontier.Y + // // Unless, it is time for the algorithm to terminate. fwdPath := path{+1, point{0, 0}, make(EditScript, 0, (nx+ny)/2)} revPath := path{-1, point{nx, ny}, make(EditScript, 0)} @@ -195,19 +196,21 @@ func Difference(nx, ny int, f EqualFunc) (es EditScript) { // computing sub-optimal edit-scripts between two lists. // // The algorithm is approximately as follows: - // • Searching for differences switches back-and-forth between - // a search that starts at the beginning (the top-left corner), and - // a search that starts at the end (the bottom-right corner). The goal of - // the search is connect with the search from the opposite corner. - // • As we search, we build a path in a greedy manner, where the first - // match seen is added to the path (this is sub-optimal, but provides a - // decent result in practice). When matches are found, we try the next pair - // of symbols in the lists and follow all matches as far as possible. - // • When searching for matches, we search along a diagonal going through - // through the "frontier" point. If no matches are found, we advance the - // frontier towards the opposite corner. - // • This algorithm terminates when either the X coordinates or the - // Y coordinates of the forward and reverse frontier points ever intersect. + // - Searching for differences switches back-and-forth between + // a search that starts at the beginning (the top-left corner), and + // a search that starts at the end (the bottom-right corner). + // The goal of the search is connect with the search + // from the opposite corner. + // - As we search, we build a path in a greedy manner, + // where the first match seen is added to the path (this is sub-optimal, + // but provides a decent result in practice). When matches are found, + // we try the next pair of symbols in the lists and follow all matches + // as far as possible. + // - When searching for matches, we search along a diagonal going through + // through the "frontier" point. If no matches are found, + // we advance the frontier towards the opposite corner. + // - This algorithm terminates when either the X coordinates or the + // Y coordinates of the forward and reverse frontier points ever intersect. // This algorithm is correct even if searching only in the forward direction // or in the reverse direction. We do both because it is commonly observed @@ -389,6 +392,7 @@ type point struct{ X, Y int } func (p *point) add(dx, dy int) { p.X += dx; p.Y += dy } // zigzag maps a consecutive sequence of integers to a zig-zag sequence. +// // [0 1 2 3 4 5 ...] => [0 -1 +1 -2 +2 ...] func zigzag(x int) int { if x&1 != 0 { diff --git a/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_legacy.go b/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_legacy.go deleted file mode 100644 index 82d1d7fbf8a..00000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_legacy.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2019, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !go1.10 - -package flags - -// AtLeastGo110 reports whether the Go toolchain is at least Go 1.10. -const AtLeastGo110 = false diff --git a/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_recent.go b/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_recent.go deleted file mode 100644 index 8646f052934..00000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_recent.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2019, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.10 - -package flags - -// AtLeastGo110 reports whether the Go toolchain is at least Go 1.10. -const AtLeastGo110 = true diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/name.go b/vendor/github.com/google/go-cmp/cmp/internal/value/name.go index b6c12cefb47..7b498bb2cb9 100644 --- a/vendor/github.com/google/go-cmp/cmp/internal/value/name.go +++ b/vendor/github.com/google/go-cmp/cmp/internal/value/name.go @@ -9,6 +9,8 @@ import ( "strconv" ) +var anyType = reflect.TypeOf((*interface{})(nil)).Elem() + // TypeString is nearly identical to reflect.Type.String, // but has an additional option to specify that full type names be used. func TypeString(t reflect.Type, qualified bool) string { @@ -20,6 +22,11 @@ func appendTypeName(b []byte, t reflect.Type, qualified, elideFunc bool) []byte // of the same name and within the same package, // but declared within the namespace of different functions. + // Use the "any" alias instead of "interface{}" for better readability. + if t == anyType { + return append(b, "any"...) + } + // Named type. if t.Name() != "" { if qualified && t.PkgPath() != "" { diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go b/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go index 44f4a5afddc..1a71bfcbd39 100644 --- a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go +++ b/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build purego // +build purego package value diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go b/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go index a605953d466..16e6860af6e 100644 --- a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go +++ b/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego // +build !purego package value diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/zero.go b/vendor/github.com/google/go-cmp/cmp/internal/value/zero.go deleted file mode 100644 index 9147a299731..00000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/value/zero.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package value - -import ( - "math" - "reflect" -) - -// IsZero reports whether v is the zero value. -// This does not rely on Interface and so can be used on unexported fields. -func IsZero(v reflect.Value) bool { - switch v.Kind() { - case reflect.Bool: - return v.Bool() == false - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return math.Float64bits(v.Float()) == 0 - case reflect.Complex64, reflect.Complex128: - return math.Float64bits(real(v.Complex())) == 0 && math.Float64bits(imag(v.Complex())) == 0 - case reflect.String: - return v.String() == "" - case reflect.UnsafePointer: - return v.Pointer() == 0 - case reflect.Chan, reflect.Func, reflect.Interface, reflect.Ptr, reflect.Map, reflect.Slice: - return v.IsNil() - case reflect.Array: - for i := 0; i < v.Len(); i++ { - if !IsZero(v.Index(i)) { - return false - } - } - return true - case reflect.Struct: - for i := 0; i < v.NumField(); i++ { - if !IsZero(v.Field(i)) { - return false - } - } - return true - } - return false -} diff --git a/vendor/github.com/google/go-cmp/cmp/options.go b/vendor/github.com/google/go-cmp/cmp/options.go index e57b9eb5392..1f9ca9c4892 100644 --- a/vendor/github.com/google/go-cmp/cmp/options.go +++ b/vendor/github.com/google/go-cmp/cmp/options.go @@ -33,6 +33,7 @@ type Option interface { } // applicableOption represents the following types: +// // Fundamental: ignore | validator | *comparer | *transformer // Grouping: Options type applicableOption interface { @@ -43,6 +44,7 @@ type applicableOption interface { } // coreOption represents the following types: +// // Fundamental: ignore | validator | *comparer | *transformer // Filters: *pathFilter | *valuesFilter type coreOption interface { @@ -336,9 +338,9 @@ func (tr transformer) String() string { // both implement T. // // The equality function must be: -// • Symmetric: equal(x, y) == equal(y, x) -// • Deterministic: equal(x, y) == equal(x, y) -// • Pure: equal(x, y) does not modify x or y +// - Symmetric: equal(x, y) == equal(y, x) +// - Deterministic: equal(x, y) == equal(x, y) +// - Pure: equal(x, y) does not modify x or y func Comparer(f interface{}) Option { v := reflect.ValueOf(f) if !function.IsType(v.Type(), function.Equal) || v.IsNil() { @@ -430,7 +432,7 @@ func AllowUnexported(types ...interface{}) Option { } // Result represents the comparison result for a single node and -// is provided by cmp when calling Result (see Reporter). +// is provided by cmp when calling Report (see Reporter). type Result struct { _ [0]func() // Make Result incomparable flags resultFlags diff --git a/vendor/github.com/google/go-cmp/cmp/path.go b/vendor/github.com/google/go-cmp/cmp/path.go index f01eff318c5..a0a588502ed 100644 --- a/vendor/github.com/google/go-cmp/cmp/path.go +++ b/vendor/github.com/google/go-cmp/cmp/path.go @@ -41,13 +41,13 @@ type PathStep interface { // The type of each valid value is guaranteed to be identical to Type. // // In some cases, one or both may be invalid or have restrictions: - // • For StructField, both are not interface-able if the current field - // is unexported and the struct type is not explicitly permitted by - // an Exporter to traverse unexported fields. - // • For SliceIndex, one may be invalid if an element is missing from - // either the x or y slice. - // • For MapIndex, one may be invalid if an entry is missing from - // either the x or y map. + // - For StructField, both are not interface-able if the current field + // is unexported and the struct type is not explicitly permitted by + // an Exporter to traverse unexported fields. + // - For SliceIndex, one may be invalid if an element is missing from + // either the x or y slice. + // - For MapIndex, one may be invalid if an entry is missing from + // either the x or y map. // // The provided values must not be mutated. Values() (vx, vy reflect.Value) @@ -94,6 +94,7 @@ func (pa Path) Index(i int) PathStep { // The simplified path only contains struct field accesses. // // For example: +// // MyMap.MySlices.MyField func (pa Path) String() string { var ss []string @@ -108,6 +109,7 @@ func (pa Path) String() string { // GoString returns the path to a specific node using Go syntax. // // For example: +// // (*root.MyMap["key"].(*mypkg.MyStruct).MySlices)[2][3].MyField func (pa Path) GoString() string { var ssPre, ssPost []string @@ -159,7 +161,7 @@ func (ps pathStep) String() string { if ps.typ == nil { return "" } - s := ps.typ.String() + s := value.TypeString(ps.typ, false) if s == "" || strings.ContainsAny(s, "{}\n") { return "root" // Type too simple or complex to print } @@ -178,7 +180,7 @@ type structField struct { unexported bool mayForce bool // Forcibly allow visibility paddr bool // Was parent addressable? - pvx, pvy reflect.Value // Parent values (always addressible) + pvx, pvy reflect.Value // Parent values (always addressable) field reflect.StructField // Field information } @@ -282,7 +284,7 @@ type typeAssertion struct { func (ta TypeAssertion) Type() reflect.Type { return ta.typ } func (ta TypeAssertion) Values() (vx, vy reflect.Value) { return ta.vx, ta.vy } -func (ta TypeAssertion) String() string { return fmt.Sprintf(".(%v)", ta.typ) } +func (ta TypeAssertion) String() string { return fmt.Sprintf(".(%v)", value.TypeString(ta.typ, false)) } // Transform is a transformation from the parent type to the current type. type Transform struct{ *transform } diff --git a/vendor/github.com/google/go-cmp/cmp/report_compare.go b/vendor/github.com/google/go-cmp/cmp/report_compare.go index 104bb30538b..2050bf6b46b 100644 --- a/vendor/github.com/google/go-cmp/cmp/report_compare.go +++ b/vendor/github.com/google/go-cmp/cmp/report_compare.go @@ -7,8 +7,6 @@ package cmp import ( "fmt" "reflect" - - "github.com/google/go-cmp/cmp/internal/value" ) // numContextRecords is the number of surrounding equal records to print. @@ -116,7 +114,10 @@ func (opts formatOptions) FormatDiff(v *valueNode, ptrs *pointerReferences) (out } // For leaf nodes, format the value based on the reflect.Values alone. - if v.MaxDepth == 0 { + // As a special case, treat equal []byte as a leaf nodes. + isBytes := v.Type.Kind() == reflect.Slice && v.Type.Elem() == byteType + isEqualBytes := isBytes && v.NumDiff+v.NumIgnored+v.NumTransformed == 0 + if v.MaxDepth == 0 || isEqualBytes { switch opts.DiffMode { case diffUnknown, diffIdentical: // Format Equal. @@ -245,11 +246,11 @@ func (opts formatOptions) formatDiffList(recs []reportRecord, k reflect.Kind, pt var isZero bool switch opts.DiffMode { case diffIdentical: - isZero = value.IsZero(r.Value.ValueX) || value.IsZero(r.Value.ValueY) + isZero = r.Value.ValueX.IsZero() || r.Value.ValueY.IsZero() case diffRemoved: - isZero = value.IsZero(r.Value.ValueX) + isZero = r.Value.ValueX.IsZero() case diffInserted: - isZero = value.IsZero(r.Value.ValueY) + isZero = r.Value.ValueY.IsZero() } if isZero { continue diff --git a/vendor/github.com/google/go-cmp/cmp/report_reflect.go b/vendor/github.com/google/go-cmp/cmp/report_reflect.go index 33f03577f98..2ab41fad3fb 100644 --- a/vendor/github.com/google/go-cmp/cmp/report_reflect.go +++ b/vendor/github.com/google/go-cmp/cmp/report_reflect.go @@ -16,6 +16,13 @@ import ( "github.com/google/go-cmp/cmp/internal/value" ) +var ( + anyType = reflect.TypeOf((*interface{})(nil)).Elem() + stringType = reflect.TypeOf((*string)(nil)).Elem() + bytesType = reflect.TypeOf((*[]byte)(nil)).Elem() + byteType = reflect.TypeOf((*byte)(nil)).Elem() +) + type formatValueOptions struct { // AvoidStringer controls whether to avoid calling custom stringer // methods like error.Error or fmt.Stringer.String. @@ -184,7 +191,7 @@ func (opts formatOptions) FormatValue(v reflect.Value, parentKind reflect.Kind, } for i := 0; i < v.NumField(); i++ { vv := v.Field(i) - if value.IsZero(vv) { + if vv.IsZero() { continue // Elide fields with zero values } if len(list) == maxLen { @@ -205,12 +212,13 @@ func (opts formatOptions) FormatValue(v reflect.Value, parentKind reflect.Kind, } // Check whether this is a []byte of text data. - if t.Elem() == reflect.TypeOf(byte(0)) { + if t.Elem() == byteType { b := v.Bytes() - isPrintSpace := func(r rune) bool { return unicode.IsPrint(r) && unicode.IsSpace(r) } + isPrintSpace := func(r rune) bool { return unicode.IsPrint(r) || unicode.IsSpace(r) } if len(b) > 0 && utf8.Valid(b) && len(bytes.TrimFunc(b, isPrintSpace)) == 0 { out = opts.formatString("", string(b)) - return opts.WithTypeMode(emitType).FormatType(t, out) + skipType = true + return opts.FormatType(t, out) } } @@ -281,7 +289,12 @@ func (opts formatOptions) FormatValue(v reflect.Value, parentKind reflect.Kind, } defer ptrs.Pop() - skipType = true // Let the underlying value print the type instead + // Skip the name only if this is an unnamed pointer type. + // Otherwise taking the address of a value does not reproduce + // the named pointer type. + if v.Type().Name() == "" { + skipType = true // Let the underlying value print the type instead + } out = opts.FormatValue(v.Elem(), t.Kind(), ptrs) out = wrapTrunkReference(ptrRef, opts.PrintAddresses, out) out = &textWrap{Prefix: "&", Value: out} @@ -292,7 +305,6 @@ func (opts formatOptions) FormatValue(v reflect.Value, parentKind reflect.Kind, } // Interfaces accept different concrete types, // so configure the underlying value to explicitly print the type. - skipType = true // Print the concrete type instead return opts.WithTypeMode(emitType).FormatValue(v.Elem(), t.Kind(), ptrs) default: panic(fmt.Sprintf("%v kind not handled", v.Kind())) diff --git a/vendor/github.com/google/go-cmp/cmp/report_slices.go b/vendor/github.com/google/go-cmp/cmp/report_slices.go index 2ad3bc85ba8..23e444f62f3 100644 --- a/vendor/github.com/google/go-cmp/cmp/report_slices.go +++ b/vendor/github.com/google/go-cmp/cmp/report_slices.go @@ -80,7 +80,7 @@ func (opts formatOptions) CanFormatDiffSlice(v *valueNode) bool { } // Use specialized string diffing for longer slices or strings. - const minLength = 64 + const minLength = 32 return vx.Len() >= minLength && vy.Len() >= minLength } @@ -104,7 +104,7 @@ func (opts formatOptions) FormatDiffSlice(v *valueNode) textNode { case t.Kind() == reflect.String: sx, sy = vx.String(), vy.String() isString = true - case t.Kind() == reflect.Slice && t.Elem() == reflect.TypeOf(byte(0)): + case t.Kind() == reflect.Slice && t.Elem() == byteType: sx, sy = string(vx.Bytes()), string(vy.Bytes()) isString = true case t.Kind() == reflect.Array: @@ -147,7 +147,10 @@ func (opts formatOptions) FormatDiffSlice(v *valueNode) textNode { }) efficiencyLines := float64(esLines.Dist()) / float64(len(esLines)) efficiencyBytes := float64(esBytes.Dist()) / float64(len(esBytes)) - isPureLinedText = efficiencyLines < 4*efficiencyBytes + quotedLength := len(strconv.Quote(sx + sy)) + unquotedLength := len(sx) + len(sy) + escapeExpansionRatio := float64(quotedLength) / float64(unquotedLength) + isPureLinedText = efficiencyLines < 4*efficiencyBytes || escapeExpansionRatio > 1.1 } } @@ -171,12 +174,13 @@ func (opts formatOptions) FormatDiffSlice(v *valueNode) textNode { // differences in a string literal. This format is more readable, // but has edge-cases where differences are visually indistinguishable. // This format is avoided under the following conditions: - // • A line starts with `"""` - // • A line starts with "..." - // • A line contains non-printable characters - // • Adjacent different lines differ only by whitespace + // - A line starts with `"""` + // - A line starts with "..." + // - A line contains non-printable characters + // - Adjacent different lines differ only by whitespace // // For example: + // // """ // ... // 3 identical lines // foo @@ -231,7 +235,7 @@ func (opts formatOptions) FormatDiffSlice(v *valueNode) textNode { var out textNode = &textWrap{Prefix: "(", Value: list2, Suffix: ")"} switch t.Kind() { case reflect.String: - if t != reflect.TypeOf(string("")) { + if t != stringType { out = opts.FormatType(t, out) } case reflect.Slice: @@ -326,12 +330,12 @@ func (opts formatOptions) FormatDiffSlice(v *valueNode) textNode { switch t.Kind() { case reflect.String: out = &textWrap{Prefix: "strings.Join(", Value: out, Suffix: fmt.Sprintf(", %q)", delim)} - if t != reflect.TypeOf(string("")) { + if t != stringType { out = opts.FormatType(t, out) } case reflect.Slice: out = &textWrap{Prefix: "bytes.Join(", Value: out, Suffix: fmt.Sprintf(", %q)", delim)} - if t != reflect.TypeOf([]byte(nil)) { + if t != bytesType { out = opts.FormatType(t, out) } } @@ -446,7 +450,6 @@ func (opts formatOptions) formatDiffSlice( // {NumIdentical: 3}, // {NumInserted: 1}, // ] -// func coalesceAdjacentEdits(name string, es diff.EditScript) (groups []diffStats) { var prevMode byte lastStats := func(mode byte) *diffStats { @@ -503,7 +506,6 @@ func coalesceAdjacentEdits(name string, es diff.EditScript) (groups []diffStats) // {NumIdentical: 8, NumRemoved: 12, NumInserted: 3}, // {NumIdentical: 63}, // ] -// func coalesceInterveningIdentical(groups []diffStats, windowSize int) []diffStats { groups, groupsOrig := groups[:0], groups for i, ds := range groupsOrig { @@ -548,7 +550,6 @@ func coalesceInterveningIdentical(groups []diffStats, windowSize int) []diffStat // {NumRemoved: 9}, // {NumIdentical: 64}, // incremented by 10 // ] -// func cleanupSurroundingIdentical(groups []diffStats, eq func(i, j int) bool) []diffStats { var ix, iy int // indexes into sequence x and y for i, ds := range groups { @@ -563,10 +564,10 @@ func cleanupSurroundingIdentical(groups []diffStats, eq func(i, j int) bool) []d nx := ds.NumIdentical + ds.NumRemoved + ds.NumModified ny := ds.NumIdentical + ds.NumInserted + ds.NumModified var numLeadingIdentical, numTrailingIdentical int - for i := 0; i < nx && i < ny && eq(ix+i, iy+i); i++ { + for j := 0; j < nx && j < ny && eq(ix+j, iy+j); j++ { numLeadingIdentical++ } - for i := 0; i < nx && i < ny && eq(ix+nx-1-i, iy+ny-1-i); i++ { + for j := 0; j < nx && j < ny && eq(ix+nx-1-j, iy+ny-1-j); j++ { numTrailingIdentical++ } if numIdentical := numLeadingIdentical + numTrailingIdentical; numIdentical > 0 { diff --git a/vendor/github.com/google/go-cmp/cmp/report_text.go b/vendor/github.com/google/go-cmp/cmp/report_text.go index 0fd46d7ffb6..388fcf57120 100644 --- a/vendor/github.com/google/go-cmp/cmp/report_text.go +++ b/vendor/github.com/google/go-cmp/cmp/report_text.go @@ -393,6 +393,7 @@ func (s diffStats) Append(ds diffStats) diffStats { // String prints a humanly-readable summary of coalesced records. // // Example: +// // diffStats{Name: "Field", NumIgnored: 5}.String() => "5 ignored fields" func (s diffStats) String() string { var ss []string diff --git a/vendor/github.com/hashicorp/go-version/CHANGELOG.md b/vendor/github.com/hashicorp/go-version/CHANGELOG.md index dbae7f7be9c..5f16dd140c3 100644 --- a/vendor/github.com/hashicorp/go-version/CHANGELOG.md +++ b/vendor/github.com/hashicorp/go-version/CHANGELOG.md @@ -1,3 +1,23 @@ +# 1.6.0 (June 28, 2022) + +FEATURES: + +- Add `Prerelease` function to `Constraint` to return true if the version includes a prerelease field ([#100](https://github.com/hashicorp/go-version/pull/100)) + +# 1.5.0 (May 18, 2022) + +FEATURES: + +- Use `encoding` `TextMarshaler` & `TextUnmarshaler` instead of JSON equivalents ([#95](https://github.com/hashicorp/go-version/pull/95)) +- Add JSON handlers to allow parsing from/to JSON ([#93](https://github.com/hashicorp/go-version/pull/93)) + +# 1.4.0 (January 5, 2022) + +FEATURES: + + - Introduce `MustConstraints()` ([#87](https://github.com/hashicorp/go-version/pull/87)) + - `Constraints`: Introduce `Equals()` and `sort.Interface` methods ([#88](https://github.com/hashicorp/go-version/pull/88)) + # 1.3.0 (March 31, 2021) Please note that CHANGELOG.md does not exist in the source code prior to this release. diff --git a/vendor/github.com/hashicorp/go-version/README.md b/vendor/github.com/hashicorp/go-version/README.md index 851a337beb4..4d250509033 100644 --- a/vendor/github.com/hashicorp/go-version/README.md +++ b/vendor/github.com/hashicorp/go-version/README.md @@ -1,5 +1,5 @@ # Versioning Library for Go -[![Build Status](https://circleci.com/gh/hashicorp/go-version/tree/master.svg?style=svg)](https://circleci.com/gh/hashicorp/go-version/tree/master) +[![Build Status](https://circleci.com/gh/hashicorp/go-version/tree/main.svg?style=svg)](https://circleci.com/gh/hashicorp/go-version/tree/main) [![GoDoc](https://godoc.org/github.com/hashicorp/go-version?status.svg)](https://godoc.org/github.com/hashicorp/go-version) go-version is a library for parsing versions and version constraints, diff --git a/vendor/github.com/hashicorp/go-version/constraint.go b/vendor/github.com/hashicorp/go-version/constraint.go index d055759611c..da5d1aca148 100644 --- a/vendor/github.com/hashicorp/go-version/constraint.go +++ b/vendor/github.com/hashicorp/go-version/constraint.go @@ -4,6 +4,7 @@ import ( "fmt" "reflect" "regexp" + "sort" "strings" ) @@ -11,30 +12,40 @@ import ( // ">= 1.0". type Constraint struct { f constraintFunc + op operator check *Version original string } +func (c *Constraint) Equals(con *Constraint) bool { + return c.op == con.op && c.check.Equal(con.check) +} + // Constraints is a slice of constraints. We make a custom type so that // we can add methods to it. type Constraints []*Constraint type constraintFunc func(v, c *Version) bool -var constraintOperators map[string]constraintFunc +var constraintOperators map[string]constraintOperation + +type constraintOperation struct { + op operator + f constraintFunc +} var constraintRegexp *regexp.Regexp func init() { - constraintOperators = map[string]constraintFunc{ - "": constraintEqual, - "=": constraintEqual, - "!=": constraintNotEqual, - ">": constraintGreaterThan, - "<": constraintLessThan, - ">=": constraintGreaterThanEqual, - "<=": constraintLessThanEqual, - "~>": constraintPessimistic, + constraintOperators = map[string]constraintOperation{ + "": {op: equal, f: constraintEqual}, + "=": {op: equal, f: constraintEqual}, + "!=": {op: notEqual, f: constraintNotEqual}, + ">": {op: greaterThan, f: constraintGreaterThan}, + "<": {op: lessThan, f: constraintLessThan}, + ">=": {op: greaterThanEqual, f: constraintGreaterThanEqual}, + "<=": {op: lessThanEqual, f: constraintLessThanEqual}, + "~>": {op: pessimistic, f: constraintPessimistic}, } ops := make([]string, 0, len(constraintOperators)) @@ -66,6 +77,16 @@ func NewConstraint(v string) (Constraints, error) { return Constraints(result), nil } +// MustConstraints is a helper that wraps a call to a function +// returning (Constraints, error) and panics if error is non-nil. +func MustConstraints(c Constraints, err error) Constraints { + if err != nil { + panic(err) + } + + return c +} + // Check tests if a version satisfies all the constraints. func (cs Constraints) Check(v *Version) bool { for _, c := range cs { @@ -77,6 +98,56 @@ func (cs Constraints) Check(v *Version) bool { return true } +// Equals compares Constraints with other Constraints +// for equality. This may not represent logical equivalence +// of compared constraints. +// e.g. even though '>0.1,>0.2' is logically equivalent +// to '>0.2' it is *NOT* treated as equal. +// +// Missing operator is treated as equal to '=', whitespaces +// are ignored and constraints are sorted before comaparison. +func (cs Constraints) Equals(c Constraints) bool { + if len(cs) != len(c) { + return false + } + + // make copies to retain order of the original slices + left := make(Constraints, len(cs)) + copy(left, cs) + sort.Stable(left) + right := make(Constraints, len(c)) + copy(right, c) + sort.Stable(right) + + // compare sorted slices + for i, con := range left { + if !con.Equals(right[i]) { + return false + } + } + + return true +} + +func (cs Constraints) Len() int { + return len(cs) +} + +func (cs Constraints) Less(i, j int) bool { + if cs[i].op < cs[j].op { + return true + } + if cs[i].op > cs[j].op { + return false + } + + return cs[i].check.LessThan(cs[j].check) +} + +func (cs Constraints) Swap(i, j int) { + cs[i], cs[j] = cs[j], cs[i] +} + // Returns the string format of the constraints func (cs Constraints) String() string { csStr := make([]string, len(cs)) @@ -92,6 +163,12 @@ func (c *Constraint) Check(v *Version) bool { return c.f(v, c.check) } +// Prerelease returns true if the version underlying this constraint +// contains a prerelease field. +func (c *Constraint) Prerelease() bool { + return len(c.check.Prerelease()) > 0 +} + func (c *Constraint) String() string { return c.original } @@ -107,8 +184,11 @@ func parseSingle(v string) (*Constraint, error) { return nil, err } + cop := constraintOperators[matches[1]] + return &Constraint{ - f: constraintOperators[matches[1]], + f: cop.f, + op: cop.op, check: check, original: v, }, nil @@ -138,6 +218,18 @@ func prereleaseCheck(v, c *Version) bool { // Constraint functions //------------------------------------------------------------------- +type operator rune + +const ( + equal operator = '=' + notEqual operator = '≠' + greaterThan operator = '>' + lessThan operator = '<' + greaterThanEqual operator = '≥' + lessThanEqual operator = '≤' + pessimistic operator = '~' +) + func constraintEqual(v, c *Version) bool { return v.Equal(c) } diff --git a/vendor/github.com/hashicorp/go-version/version.go b/vendor/github.com/hashicorp/go-version/version.go index 8068834ec84..e87df69906d 100644 --- a/vendor/github.com/hashicorp/go-version/version.go +++ b/vendor/github.com/hashicorp/go-version/version.go @@ -64,7 +64,6 @@ func newVersion(v string, pattern *regexp.Regexp) (*Version, error) { } segmentsStr := strings.Split(matches[1], ".") segments := make([]int64, len(segmentsStr)) - si := 0 for i, str := range segmentsStr { val, err := strconv.ParseInt(str, 10, 64) if err != nil { @@ -72,8 +71,7 @@ func newVersion(v string, pattern *regexp.Regexp) (*Version, error) { "Error parsing version: %s", err) } - segments[i] = int64(val) - si++ + segments[i] = val } // Even though we could support more than three segments, if we @@ -92,7 +90,7 @@ func newVersion(v string, pattern *regexp.Regexp) (*Version, error) { metadata: matches[10], pre: pre, segments: segments, - si: si, + si: len(segmentsStr), original: v, }, nil } @@ -390,3 +388,20 @@ func (v *Version) String() string { func (v *Version) Original() string { return v.original } + +// UnmarshalText implements encoding.TextUnmarshaler interface. +func (v *Version) UnmarshalText(b []byte) error { + temp, err := NewVersion(string(b)) + if err != nil { + return err + } + + *v = *temp + + return nil +} + +// MarshalText implements encoding.TextMarshaler interface. +func (v *Version) MarshalText() ([]byte, error) { + return []byte(v.String()), nil +} diff --git a/vendor/github.com/hashicorp/terraform-json/LICENSE b/vendor/github.com/hashicorp/terraform-json/LICENSE index a612ad9813b..3b97eaf3c31 100644 --- a/vendor/github.com/hashicorp/terraform-json/LICENSE +++ b/vendor/github.com/hashicorp/terraform-json/LICENSE @@ -1,3 +1,5 @@ +Copyright (c) 2019 HashiCorp, Inc. + Mozilla Public License Version 2.0 ================================== diff --git a/vendor/github.com/hashicorp/terraform-json/README.md b/vendor/github.com/hashicorp/terraform-json/README.md index fea0ba26092..4a9cd94a119 100644 --- a/vendor/github.com/hashicorp/terraform-json/README.md +++ b/vendor/github.com/hashicorp/terraform-json/README.md @@ -1,6 +1,5 @@ # terraform-json -[![CircleCI](https://circleci.com/gh/hashicorp/terraform-json/tree/main.svg?style=svg)](https://circleci.com/gh/hashicorp/terraform-json/tree/main) [![GoDoc](https://godoc.org/github.com/hashicorp/terraform-json?status.svg)](https://godoc.org/github.com/hashicorp/terraform-json) This repository houses data types designed to help parse the data produced by diff --git a/vendor/github.com/hashicorp/terraform-json/config.go b/vendor/github.com/hashicorp/terraform-json/config.go index e093cfa8bff..5ebe4bc840c 100644 --- a/vendor/github.com/hashicorp/terraform-json/config.go +++ b/vendor/github.com/hashicorp/terraform-json/config.go @@ -48,6 +48,9 @@ type ProviderConfig struct { // The name of the provider, ie: "aws". Name string `json:"name,omitempty"` + // The fully-specified name of the provider, ie: "registry.terraform.io/hashicorp/aws". + FullName string `json:"full_name,omitempty"` + // The alias of the provider, ie: "us-east-1". Alias string `json:"alias,omitempty"` diff --git a/vendor/github.com/hashicorp/terraform-json/metadata.go b/vendor/github.com/hashicorp/terraform-json/metadata.go new file mode 100644 index 00000000000..70d7ce4380a --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-json/metadata.go @@ -0,0 +1,104 @@ +package tfjson + +import ( + "encoding/json" + "errors" + "fmt" + + "github.com/hashicorp/go-version" + "github.com/zclconf/go-cty/cty" +) + +// MetadataFunctionsFormatVersionConstraints defines the versions of the JSON +// metadata functions format that are supported by this package. +var MetadataFunctionsFormatVersionConstraints = "~> 1.0" + +// MetadataFunctions is the top-level object returned when exporting function +// signatures +type MetadataFunctions struct { + // The version of the format. This should always match the + // MetadataFunctionsFormatVersionConstraints in this package, else + // unmarshaling will fail. + FormatVersion string `json:"format_version"` + + // The signatures of the functions available in a Terraform version. + Signatures map[string]*FunctionSignature `json:"function_signatures,omitempty"` +} + +// Validate checks to ensure that MetadataFunctions is present, and the +// version matches the version supported by this library. +func (f *MetadataFunctions) Validate() error { + if f == nil { + return errors.New("metadata functions data is nil") + } + + if f.FormatVersion == "" { + return errors.New("unexpected metadata functions data, format version is missing") + } + + constraint, err := version.NewConstraint(MetadataFunctionsFormatVersionConstraints) + if err != nil { + return fmt.Errorf("invalid version constraint: %w", err) + } + + version, err := version.NewVersion(f.FormatVersion) + if err != nil { + return fmt.Errorf("invalid format version %q: %w", f.FormatVersion, err) + } + + if !constraint.Check(version) { + return fmt.Errorf("unsupported metadata functions format version: %q does not satisfy %q", + version, constraint) + } + + return nil +} + +func (f *MetadataFunctions) UnmarshalJSON(b []byte) error { + type rawFunctions MetadataFunctions + var functions rawFunctions + + err := json.Unmarshal(b, &functions) + if err != nil { + return err + } + + *f = *(*MetadataFunctions)(&functions) + + return f.Validate() +} + +// FunctionSignature represents a function signature. +type FunctionSignature struct { + // Description is an optional human-readable description + // of the function + Description string `json:"description,omitempty"` + + // ReturnType is the ctyjson representation of the function's + // return types based on supplying all parameters using + // dynamic types. Functions can have dynamic return types. + ReturnType cty.Type `json:"return_type"` + + // Parameters describes the function's fixed positional parameters. + Parameters []*FunctionParameter `json:"parameters,omitempty"` + + // VariadicParameter describes the function's variadic + // parameter if it is supported. + VariadicParameter *FunctionParameter `json:"variadic_parameter,omitempty"` +} + +// FunctionParameter represents a parameter to a function. +type FunctionParameter struct { + // Name is an optional name for the argument. + Name string `json:"name,omitempty"` + + // Description is an optional human-readable description + // of the argument + Description string `json:"description,omitempty"` + + // IsNullable is true if null is acceptable value for the argument + IsNullable bool `json:"is_nullable,omitempty"` + + // A type that any argument for this parameter must conform to. + Type cty.Type `json:"type"` +} diff --git a/vendor/github.com/hashicorp/terraform-json/plan.go b/vendor/github.com/hashicorp/terraform-json/plan.go index 97635bd4733..274006a0180 100644 --- a/vendor/github.com/hashicorp/terraform-json/plan.go +++ b/vendor/github.com/hashicorp/terraform-json/plan.go @@ -4,11 +4,13 @@ import ( "encoding/json" "errors" "fmt" + + "github.com/hashicorp/go-version" ) -// PlanFormatVersions represents versions of the JSON plan format that -// are supported by this package. -var PlanFormatVersions = []string{"0.1", "0.2"} +// PlanFormatVersionConstraints defines the versions of the JSON plan format +// that are supported by this package. +var PlanFormatVersionConstraints = ">= 0.1, < 2.0" // ResourceMode is a string representation of the resource type found // in certain fields in the plan. @@ -53,6 +55,19 @@ type Plan struct { // The Terraform configuration used to make the plan. Config *Config `json:"configuration,omitempty"` + + // RelevantAttributes represents any resource instances and their + // attributes which may have contributed to the planned changes + RelevantAttributes []ResourceAttribute `json:"relevant_attributes,omitempty"` +} + +// ResourceAttribute describes a full path to a resource attribute +type ResourceAttribute struct { + // Resource describes resource instance address (e.g. null_resource.foo) + Resource string `json:"resource"` + // Attribute describes the attribute path using a lossy representation + // of cty.Path. (e.g. ["id"] or ["objects", 0, "val"]). + Attribute []json.RawMessage `json:"attribute"` } // Validate checks to ensure that the plan is present, and the @@ -66,9 +81,19 @@ func (p *Plan) Validate() error { return errors.New("unexpected plan input, format version is missing") } - if !isStringInSlice(PlanFormatVersions, p.FormatVersion) { - return fmt.Errorf("unsupported plan format version: expected %q, got %q", - PlanFormatVersions, p.FormatVersion) + constraint, err := version.NewConstraint(PlanFormatVersionConstraints) + if err != nil { + return fmt.Errorf("invalid version constraint: %w", err) + } + + version, err := version.NewVersion(p.FormatVersion) + if err != nil { + return fmt.Errorf("invalid format version %q: %w", p.FormatVersion, err) + } + + if !constraint.Check(version) { + return fmt.Errorf("unsupported plan format version: %q does not satisfy %q", + version, constraint) } return nil diff --git a/vendor/github.com/hashicorp/terraform-json/schemas.go b/vendor/github.com/hashicorp/terraform-json/schemas.go index 88c2c94bb43..f7c8abd50f6 100644 --- a/vendor/github.com/hashicorp/terraform-json/schemas.go +++ b/vendor/github.com/hashicorp/terraform-json/schemas.go @@ -5,12 +5,13 @@ import ( "errors" "fmt" + "github.com/hashicorp/go-version" "github.com/zclconf/go-cty/cty" ) -// ProviderSchemasFormatVersions represents the versions of -// the JSON provider schema format that are supported by this package. -var ProviderSchemasFormatVersions = []string{"0.1", "0.2"} +// ProviderSchemasFormatVersionConstraints defines the versions of the JSON +// provider schema format that are supported by this package. +var ProviderSchemasFormatVersionConstraints = ">= 0.1, < 2.0" // ProviderSchemas represents the schemas of all providers and // resources in use by the configuration. @@ -38,9 +39,19 @@ func (p *ProviderSchemas) Validate() error { return errors.New("unexpected provider schema data, format version is missing") } - if !isStringInSlice(ProviderSchemasFormatVersions, p.FormatVersion) { - return fmt.Errorf("unsupported provider schema data format version: expected %q, got %q", - ProviderSchemasFormatVersions, p.FormatVersion) + constraint, err := version.NewConstraint(ProviderSchemasFormatVersionConstraints) + if err != nil { + return fmt.Errorf("invalid version constraint: %w", err) + } + + version, err := version.NewVersion(p.FormatVersion) + if err != nil { + return fmt.Errorf("invalid format version %q: %w", p.FormatVersion, err) + } + + if !constraint.Check(version) { + return fmt.Errorf("unsupported provider schema format version: %q does not satisfy %q", + version, constraint) } return nil @@ -212,6 +223,43 @@ type SchemaAttribute struct { Sensitive bool `json:"sensitive,omitempty"` } +// jsonSchemaAttribute describes an attribute within a schema block +// in a middle-step internal representation before marshalled into +// a more useful SchemaAttribute with cty.Type. +// +// This avoid panic on marshalling cty.NilType (from cty upstream) +// which the default Go marshaller cannot ignore because it's a +// not nil-able struct. +type jsonSchemaAttribute struct { + AttributeType json.RawMessage `json:"type,omitempty"` + AttributeNestedType *SchemaNestedAttributeType `json:"nested_type,omitempty"` + Description string `json:"description,omitempty"` + DescriptionKind SchemaDescriptionKind `json:"description_kind,omitempty"` + Deprecated bool `json:"deprecated,omitempty"` + Required bool `json:"required,omitempty"` + Optional bool `json:"optional,omitempty"` + Computed bool `json:"computed,omitempty"` + Sensitive bool `json:"sensitive,omitempty"` +} + +func (as *SchemaAttribute) MarshalJSON() ([]byte, error) { + jsonSa := &jsonSchemaAttribute{ + AttributeNestedType: as.AttributeNestedType, + Description: as.Description, + DescriptionKind: as.DescriptionKind, + Deprecated: as.Deprecated, + Required: as.Required, + Optional: as.Optional, + Computed: as.Computed, + Sensitive: as.Sensitive, + } + if as.AttributeType != cty.NilType { + attrTy, _ := as.AttributeType.MarshalJSON() + jsonSa.AttributeType = attrTy + } + return json.Marshal(jsonSa) +} + // SchemaNestedAttributeType describes a nested attribute // which could also be just expressed simply as cty.Object(...), // cty.List(cty.Object(...)) etc. but this allows tracking additional diff --git a/vendor/github.com/hashicorp/terraform-json/state.go b/vendor/github.com/hashicorp/terraform-json/state.go index ad632e49d5c..3c3f6a4b0aa 100644 --- a/vendor/github.com/hashicorp/terraform-json/state.go +++ b/vendor/github.com/hashicorp/terraform-json/state.go @@ -5,11 +5,14 @@ import ( "encoding/json" "errors" "fmt" + + "github.com/hashicorp/go-version" + "github.com/zclconf/go-cty/cty" ) -// StateFormatVersions represents the versions of the JSON state format +// StateFormatVersionConstraints defines the versions of the JSON state format // that are supported by this package. -var StateFormatVersions = []string{"0.1", "0.2"} +var StateFormatVersionConstraints = ">= 0.1, < 2.0" // State is the top-level representation of a Terraform state. type State struct { @@ -50,9 +53,19 @@ func (s *State) Validate() error { return errors.New("unexpected state input, format version is missing") } - if !isStringInSlice(StateFormatVersions, s.FormatVersion) { - return fmt.Errorf("unsupported state format version: expected %q, got %q", - StateFormatVersions, s.FormatVersion) + constraint, err := version.NewConstraint(StateFormatVersionConstraints) + if err != nil { + return fmt.Errorf("invalid version constraint: %w", err) + } + + version, err := version.NewVersion(s.FormatVersion) + if err != nil { + return fmt.Errorf("invalid format version %q: %w", s.FormatVersion, err) + } + + if !constraint.Check(version) { + return fmt.Errorf("unsupported state format version: %q does not satisfy %q", + version, constraint) } return nil @@ -163,4 +176,31 @@ type StateOutput struct { // The value of the output. Value interface{} `json:"value,omitempty"` + + // The type of the output. + Type cty.Type `json:"type,omitempty"` +} + +// jsonStateOutput describes an output value in a middle-step internal +// representation before marshalled into a more useful StateOutput with cty.Type. +// +// This avoid panic on marshalling cty.NilType (from cty upstream) +// which the default Go marshaller cannot ignore because it's a +// not nil-able struct. +type jsonStateOutput struct { + Sensitive bool `json:"sensitive"` + Value interface{} `json:"value,omitempty"` + Type json.RawMessage `json:"type,omitempty"` +} + +func (so *StateOutput) MarshalJSON() ([]byte, error) { + jsonSa := &jsonStateOutput{ + Sensitive: so.Sensitive, + Value: so.Value, + } + if so.Type != cty.NilType { + outputType, _ := so.Type.MarshalJSON() + jsonSa.Type = outputType + } + return json.Marshal(jsonSa) } diff --git a/vendor/github.com/hashicorp/terraform-json/validate.go b/vendor/github.com/hashicorp/terraform-json/validate.go index db9db1919ce..97b82d0a979 100644 --- a/vendor/github.com/hashicorp/terraform-json/validate.go +++ b/vendor/github.com/hashicorp/terraform-json/validate.go @@ -4,8 +4,14 @@ import ( "encoding/json" "errors" "fmt" + + "github.com/hashicorp/go-version" ) +// ValidateFormatVersionConstraints defines the versions of the JSON +// validate format that are supported by this package. +var ValidateFormatVersionConstraints = ">= 0.1, < 2.0" + // Pos represents a position in a config file type Pos struct { Line int `json:"line"` @@ -110,10 +116,19 @@ func (vo *ValidateOutput) Validate() error { return nil } - supportedVersion := "0.1" - if vo.FormatVersion != supportedVersion { - return fmt.Errorf("unsupported validation output format version: expected %q, got %q", - supportedVersion, vo.FormatVersion) + constraint, err := version.NewConstraint(ValidateFormatVersionConstraints) + if err != nil { + return fmt.Errorf("invalid version constraint: %w", err) + } + + version, err := version.NewVersion(vo.FormatVersion) + if err != nil { + return fmt.Errorf("invalid format version %q: %w", vo.FormatVersion, err) + } + + if !constraint.Check(version) { + return fmt.Errorf("unsupported validation output format version: %q does not satisfy %q", + version, constraint) } return nil diff --git a/vendor/github.com/oracle/oci-go-sdk/v65/certificates/ca_bundle.go b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/ca_bundle.go new file mode 100644 index 00000000000..8f9bf795641 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/ca_bundle.go @@ -0,0 +1,45 @@ +// Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Certificates Service Retrieval API +// +// API for retrieving certificates. +// + +package certificates + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// CaBundle The contents of the CA bundle (root and intermediate certificates), properties of the CA bundle, and user-provided contextual metadata for the CA bundle. +type CaBundle struct { + + // The OCID of the CA bundle. + Id *string `mandatory:"true" json:"id"` + + // A user-friendly name for the CA bundle. Names are unique within a compartment. Valid characters include uppercase or lowercase letters, numbers, hyphens, underscores, and periods. + Name *string `mandatory:"true" json:"name"` + + // Certificates (in PEM format) in the CA bundle. Can be of arbitrary length. + CaBundlePem *string `mandatory:"true" json:"caBundlePem"` +} + +func (m CaBundle) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m CaBundle) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_authority_bundle.go b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_authority_bundle.go new file mode 100644 index 00000000000..d5baf83e096 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_authority_bundle.go @@ -0,0 +1,74 @@ +// Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Certificates Service Retrieval API +// +// API for retrieving certificates. +// + +package certificates + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// CertificateAuthorityBundle The contents of the certificate, properties of the certificate (and certificate version), and user-provided contextual metadata for the certificate. +type CertificateAuthorityBundle struct { + + // The OCID of the certificate authority (CA). + CertificateAuthorityId *string `mandatory:"true" json:"certificateAuthorityId"` + + // The name of the CA. + CertificateAuthorityName *string `mandatory:"true" json:"certificateAuthorityName"` + + // A unique certificate identifier used in certificate revocation tracking, formatted as octets. + // Example: `03 AC FC FA CC B3 CB 02 B8 F8 DE F5 85 E7 7B FF` + SerialNumber *string `mandatory:"true" json:"serialNumber"` + + // The certificate (in PEM format) for this CA version. + CertificatePem *string `mandatory:"true" json:"certificatePem"` + + // A property indicating when the CA was created, expressed in RFC 3339 (https://tools.ietf.org/html/rfc3339) timestamp format. + // Example: `2019-04-03T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The version number of the CA. + VersionNumber *int64 `mandatory:"true" json:"versionNumber"` + + Validity *Validity `mandatory:"true" json:"validity"` + + // A list of rotation states for this CA. + Stages []VersionStageEnum `mandatory:"true" json:"stages"` + + // The certificate chain (in PEM format) for this CA version. + CertChainPem *string `mandatory:"false" json:"certChainPem"` + + // The name of the CA. + VersionName *string `mandatory:"false" json:"versionName"` + + RevocationStatus *RevocationStatus `mandatory:"false" json:"revocationStatus"` +} + +func (m CertificateAuthorityBundle) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m CertificateAuthorityBundle) ValidateEnumValue() (bool, error) { + errMessage := []string{} + for _, val := range m.Stages { + if _, ok := GetMappingVersionStageEnum(string(val)); !ok && val != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Stages: %s. Supported values are: %s.", val, strings.Join(GetVersionStageEnumStringValues(), ","))) + } + } + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_authority_bundle_version_collection.go b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_authority_bundle_version_collection.go new file mode 100644 index 00000000000..fad700a4655 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_authority_bundle_version_collection.go @@ -0,0 +1,39 @@ +// Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Certificates Service Retrieval API +// +// API for retrieving certificates. +// + +package certificates + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// CertificateAuthorityBundleVersionCollection The results of a certificate authority (CA) version search. Results contain CA version summary objects and other data. +type CertificateAuthorityBundleVersionCollection struct { + + // A list of CA version summary objects. + Items []CertificateAuthorityBundleVersionSummary `mandatory:"true" json:"items"` +} + +func (m CertificateAuthorityBundleVersionCollection) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m CertificateAuthorityBundleVersionCollection) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_authority_bundle_version_summary.go b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_authority_bundle_version_summary.go new file mode 100644 index 00000000000..e866c4858d7 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_authority_bundle_version_summary.go @@ -0,0 +1,72 @@ +// Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Certificates Service Retrieval API +// +// API for retrieving certificates. +// + +package certificates + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// CertificateAuthorityBundleVersionSummary The properties of a version of a bundle for a certificate authority (CA). Certificate authority bundle version summary objects do not include the actual contents of the certificate. +type CertificateAuthorityBundleVersionSummary struct { + + // The OCID of the certificate authority (CA). + CertificateAuthorityId *string `mandatory:"true" json:"certificateAuthorityId"` + + // An optional property indicating when the CA version was created, expressed in RFC 3339 (https://tools.ietf.org/html/rfc3339) timestamp format. + // Example: `2019-04-03T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The version number of the CA. + VersionNumber *int64 `mandatory:"true" json:"versionNumber"` + + // The name of the CA. + CertificateAuthorityName *string `mandatory:"true" json:"certificateAuthorityName"` + + // A list of rotation states for this CA version. + Stages []VersionStageEnum `mandatory:"true" json:"stages"` + + // A unique certificate identifier used in certificate revocation tracking, formatted as octets. + // Example: `03 AC FC FA CC B3 CB 02 B8 F8 DE F5 85 E7 7B FF` + SerialNumber *string `mandatory:"false" json:"serialNumber"` + + // The name of the CA version. When this value is not null, the name is unique across CA versions for a given CA. + VersionName *string `mandatory:"false" json:"versionName"` + + // An optional property indicating when to delete the CA version, expressed in RFC 3339 (https://tools.ietf.org/html/rfc3339) timestamp format. + // Example: `2019-04-03T21:10:29.600Z` + TimeOfDeletion *common.SDKTime `mandatory:"false" json:"timeOfDeletion"` + + Validity *Validity `mandatory:"false" json:"validity"` + + RevocationStatus *RevocationStatus `mandatory:"false" json:"revocationStatus"` +} + +func (m CertificateAuthorityBundleVersionSummary) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m CertificateAuthorityBundleVersionSummary) ValidateEnumValue() (bool, error) { + errMessage := []string{} + for _, val := range m.Stages { + if _, ok := GetMappingVersionStageEnum(string(val)); !ok && val != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Stages: %s. Supported values are: %s.", val, strings.Join(GetVersionStageEnumStringValues(), ","))) + } + } + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_bundle.go b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_bundle.go new file mode 100644 index 00000000000..6aa7b7aff92 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_bundle.go @@ -0,0 +1,237 @@ +// Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Certificates Service Retrieval API +// +// API for retrieving certificates. +// + +package certificates + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// CertificateBundle The contents of the certificate, properties of the certificate (and certificate version), and user-provided contextual metadata for the certificate. +type CertificateBundle interface { + + // The OCID of the certificate. + GetCertificateId() *string + + // The name of the certificate. + GetCertificateName() *string + + // The version number of the certificate. + GetVersionNumber() *int64 + + // A unique certificate identifier used in certificate revocation tracking, formatted as octets. + // Example: `03 AC FC FA CC B3 CB 02 B8 F8 DE F5 85 E7 7B FF` + GetSerialNumber() *string + + // An optional property indicating when the certificate version was created, expressed in RFC 3339 (https://tools.ietf.org/html/rfc3339) timestamp format. + // Example: `2019-04-03T21:10:29.600Z` + GetTimeCreated() *common.SDKTime + + GetValidity() *Validity + + // A list of rotation states for the certificate bundle. + GetStages() []VersionStageEnum + + // The certificate in PEM format. + GetCertificatePem() *string + + // The certificate chain (in PEM format) for the certificate bundle. + GetCertChainPem() *string + + // The name of the certificate version. + GetVersionName() *string + + GetRevocationStatus() *RevocationStatus +} + +type certificatebundle struct { + JsonData []byte + CertificateId *string `mandatory:"true" json:"certificateId"` + CertificateName *string `mandatory:"true" json:"certificateName"` + VersionNumber *int64 `mandatory:"true" json:"versionNumber"` + SerialNumber *string `mandatory:"true" json:"serialNumber"` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + Validity *Validity `mandatory:"true" json:"validity"` + Stages []VersionStageEnum `mandatory:"true" json:"stages"` + CertificatePem *string `mandatory:"false" json:"certificatePem"` + CertChainPem *string `mandatory:"false" json:"certChainPem"` + VersionName *string `mandatory:"false" json:"versionName"` + RevocationStatus *RevocationStatus `mandatory:"false" json:"revocationStatus"` + CertificateBundleType string `json:"certificateBundleType"` +} + +// UnmarshalJSON unmarshals json +func (m *certificatebundle) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalercertificatebundle certificatebundle + s := struct { + Model Unmarshalercertificatebundle + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.CertificateId = s.Model.CertificateId + m.CertificateName = s.Model.CertificateName + m.VersionNumber = s.Model.VersionNumber + m.SerialNumber = s.Model.SerialNumber + m.TimeCreated = s.Model.TimeCreated + m.Validity = s.Model.Validity + m.Stages = s.Model.Stages + m.CertificatePem = s.Model.CertificatePem + m.CertChainPem = s.Model.CertChainPem + m.VersionName = s.Model.VersionName + m.RevocationStatus = s.Model.RevocationStatus + m.CertificateBundleType = s.Model.CertificateBundleType + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *certificatebundle) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + + if data == nil || string(data) == "null" { + return nil, nil + } + + var err error + switch m.CertificateBundleType { + case "CERTIFICATE_CONTENT_PUBLIC_ONLY": + mm := CertificateBundlePublicOnly{} + err = json.Unmarshal(data, &mm) + return mm, err + case "CERTIFICATE_CONTENT_WITH_PRIVATE_KEY": + mm := CertificateBundleWithPrivateKey{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + return *m, nil + } +} + +//GetCertificateId returns CertificateId +func (m certificatebundle) GetCertificateId() *string { + return m.CertificateId +} + +//GetCertificateName returns CertificateName +func (m certificatebundle) GetCertificateName() *string { + return m.CertificateName +} + +//GetVersionNumber returns VersionNumber +func (m certificatebundle) GetVersionNumber() *int64 { + return m.VersionNumber +} + +//GetSerialNumber returns SerialNumber +func (m certificatebundle) GetSerialNumber() *string { + return m.SerialNumber +} + +//GetTimeCreated returns TimeCreated +func (m certificatebundle) GetTimeCreated() *common.SDKTime { + return m.TimeCreated +} + +//GetValidity returns Validity +func (m certificatebundle) GetValidity() *Validity { + return m.Validity +} + +//GetStages returns Stages +func (m certificatebundle) GetStages() []VersionStageEnum { + return m.Stages +} + +//GetCertificatePem returns CertificatePem +func (m certificatebundle) GetCertificatePem() *string { + return m.CertificatePem +} + +//GetCertChainPem returns CertChainPem +func (m certificatebundle) GetCertChainPem() *string { + return m.CertChainPem +} + +//GetVersionName returns VersionName +func (m certificatebundle) GetVersionName() *string { + return m.VersionName +} + +//GetRevocationStatus returns RevocationStatus +func (m certificatebundle) GetRevocationStatus() *RevocationStatus { + return m.RevocationStatus +} + +func (m certificatebundle) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m certificatebundle) ValidateEnumValue() (bool, error) { + errMessage := []string{} + for _, val := range m.Stages { + if _, ok := GetMappingVersionStageEnum(string(val)); !ok && val != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Stages: %s. Supported values are: %s.", val, strings.Join(GetVersionStageEnumStringValues(), ","))) + } + } + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// CertificateBundleCertificateBundleTypeEnum Enum with underlying type: string +type CertificateBundleCertificateBundleTypeEnum string + +// Set of constants representing the allowable values for CertificateBundleCertificateBundleTypeEnum +const ( + CertificateBundleCertificateBundleTypePublicOnly CertificateBundleCertificateBundleTypeEnum = "CERTIFICATE_CONTENT_PUBLIC_ONLY" + CertificateBundleCertificateBundleTypeWithPrivateKey CertificateBundleCertificateBundleTypeEnum = "CERTIFICATE_CONTENT_WITH_PRIVATE_KEY" +) + +var mappingCertificateBundleCertificateBundleTypeEnum = map[string]CertificateBundleCertificateBundleTypeEnum{ + "CERTIFICATE_CONTENT_PUBLIC_ONLY": CertificateBundleCertificateBundleTypePublicOnly, + "CERTIFICATE_CONTENT_WITH_PRIVATE_KEY": CertificateBundleCertificateBundleTypeWithPrivateKey, +} + +var mappingCertificateBundleCertificateBundleTypeEnumLowerCase = map[string]CertificateBundleCertificateBundleTypeEnum{ + "certificate_content_public_only": CertificateBundleCertificateBundleTypePublicOnly, + "certificate_content_with_private_key": CertificateBundleCertificateBundleTypeWithPrivateKey, +} + +// GetCertificateBundleCertificateBundleTypeEnumValues Enumerates the set of values for CertificateBundleCertificateBundleTypeEnum +func GetCertificateBundleCertificateBundleTypeEnumValues() []CertificateBundleCertificateBundleTypeEnum { + values := make([]CertificateBundleCertificateBundleTypeEnum, 0) + for _, v := range mappingCertificateBundleCertificateBundleTypeEnum { + values = append(values, v) + } + return values +} + +// GetCertificateBundleCertificateBundleTypeEnumStringValues Enumerates the set of values in String for CertificateBundleCertificateBundleTypeEnum +func GetCertificateBundleCertificateBundleTypeEnumStringValues() []string { + return []string{ + "CERTIFICATE_CONTENT_PUBLIC_ONLY", + "CERTIFICATE_CONTENT_WITH_PRIVATE_KEY", + } +} + +// GetMappingCertificateBundleCertificateBundleTypeEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingCertificateBundleCertificateBundleTypeEnum(val string) (CertificateBundleCertificateBundleTypeEnum, bool) { + enum, ok := mappingCertificateBundleCertificateBundleTypeEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_bundle_public_only.go b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_bundle_public_only.go new file mode 100644 index 00000000000..f3d5699bebe --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_bundle_public_only.go @@ -0,0 +1,145 @@ +// Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Certificates Service Retrieval API +// +// API for retrieving certificates. +// + +package certificates + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// CertificateBundlePublicOnly A certificate bundle, not including the private key. +type CertificateBundlePublicOnly struct { + + // The OCID of the certificate. + CertificateId *string `mandatory:"true" json:"certificateId"` + + // The name of the certificate. + CertificateName *string `mandatory:"true" json:"certificateName"` + + // The version number of the certificate. + VersionNumber *int64 `mandatory:"true" json:"versionNumber"` + + // A unique certificate identifier used in certificate revocation tracking, formatted as octets. + // Example: `03 AC FC FA CC B3 CB 02 B8 F8 DE F5 85 E7 7B FF` + SerialNumber *string `mandatory:"true" json:"serialNumber"` + + // An optional property indicating when the certificate version was created, expressed in RFC 3339 (https://tools.ietf.org/html/rfc3339) timestamp format. + // Example: `2019-04-03T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + Validity *Validity `mandatory:"true" json:"validity"` + + // The certificate in PEM format. + CertificatePem *string `mandatory:"false" json:"certificatePem"` + + // The certificate chain (in PEM format) for the certificate bundle. + CertChainPem *string `mandatory:"false" json:"certChainPem"` + + // The name of the certificate version. + VersionName *string `mandatory:"false" json:"versionName"` + + RevocationStatus *RevocationStatus `mandatory:"false" json:"revocationStatus"` + + // A list of rotation states for the certificate bundle. + Stages []VersionStageEnum `mandatory:"true" json:"stages"` +} + +//GetCertificateId returns CertificateId +func (m CertificateBundlePublicOnly) GetCertificateId() *string { + return m.CertificateId +} + +//GetCertificateName returns CertificateName +func (m CertificateBundlePublicOnly) GetCertificateName() *string { + return m.CertificateName +} + +//GetVersionNumber returns VersionNumber +func (m CertificateBundlePublicOnly) GetVersionNumber() *int64 { + return m.VersionNumber +} + +//GetSerialNumber returns SerialNumber +func (m CertificateBundlePublicOnly) GetSerialNumber() *string { + return m.SerialNumber +} + +//GetCertificatePem returns CertificatePem +func (m CertificateBundlePublicOnly) GetCertificatePem() *string { + return m.CertificatePem +} + +//GetCertChainPem returns CertChainPem +func (m CertificateBundlePublicOnly) GetCertChainPem() *string { + return m.CertChainPem +} + +//GetTimeCreated returns TimeCreated +func (m CertificateBundlePublicOnly) GetTimeCreated() *common.SDKTime { + return m.TimeCreated +} + +//GetValidity returns Validity +func (m CertificateBundlePublicOnly) GetValidity() *Validity { + return m.Validity +} + +//GetVersionName returns VersionName +func (m CertificateBundlePublicOnly) GetVersionName() *string { + return m.VersionName +} + +//GetStages returns Stages +func (m CertificateBundlePublicOnly) GetStages() []VersionStageEnum { + return m.Stages +} + +//GetRevocationStatus returns RevocationStatus +func (m CertificateBundlePublicOnly) GetRevocationStatus() *RevocationStatus { + return m.RevocationStatus +} + +func (m CertificateBundlePublicOnly) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m CertificateBundlePublicOnly) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + for _, val := range m.Stages { + if _, ok := GetMappingVersionStageEnum(string(val)); !ok && val != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Stages: %s. Supported values are: %s.", val, strings.Join(GetVersionStageEnumStringValues(), ","))) + } + } + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// MarshalJSON marshals to json representation +func (m CertificateBundlePublicOnly) MarshalJSON() (buff []byte, e error) { + type MarshalTypeCertificateBundlePublicOnly CertificateBundlePublicOnly + s := struct { + DiscriminatorParam string `json:"certificateBundleType"` + MarshalTypeCertificateBundlePublicOnly + }{ + "CERTIFICATE_CONTENT_PUBLIC_ONLY", + (MarshalTypeCertificateBundlePublicOnly)(m), + } + + return json.Marshal(&s) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_bundle_version_collection.go b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_bundle_version_collection.go new file mode 100644 index 00000000000..30f6dae7806 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_bundle_version_collection.go @@ -0,0 +1,39 @@ +// Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Certificates Service Retrieval API +// +// API for retrieving certificates. +// + +package certificates + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// CertificateBundleVersionCollection The results of a certificate bundle versions search. Results contain certificate bundle version summary objects. +type CertificateBundleVersionCollection struct { + + // A list of certificate bundle version summary objects. + Items []CertificateBundleVersionSummary `mandatory:"true" json:"items"` +} + +func (m CertificateBundleVersionCollection) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m CertificateBundleVersionCollection) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_bundle_version_summary.go b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_bundle_version_summary.go new file mode 100644 index 00000000000..16eed0432ef --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_bundle_version_summary.go @@ -0,0 +1,72 @@ +// Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Certificates Service Retrieval API +// +// API for retrieving certificates. +// + +package certificates + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// CertificateBundleVersionSummary The properties of the certificate bundle. Certificate bundle version summary objects do not include the actual contents of the certificate. +type CertificateBundleVersionSummary struct { + + // The OCID of the certificate. + CertificateId *string `mandatory:"true" json:"certificateId"` + + // The name of the certificate. + CertificateName *string `mandatory:"true" json:"certificateName"` + + // The version number of the certificate. + VersionNumber *int64 `mandatory:"true" json:"versionNumber"` + + // An optional property indicating when the certificate version was created, expressed in RFC 3339 (https://tools.ietf.org/html/rfc3339) timestamp format. + // Example: `2019-04-03T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // A list of rotation states for this certificate bundle version. + Stages []VersionStageEnum `mandatory:"true" json:"stages"` + + // A unique certificate identifier used in certificate revocation tracking, formatted as octets. + // Example: `03 AC FC FA CC B3 CB 02 B8 F8 DE F5 85 E7 7B FF` + SerialNumber *string `mandatory:"false" json:"serialNumber"` + + // The name of the certificate version. + VersionName *string `mandatory:"false" json:"versionName"` + + Validity *Validity `mandatory:"false" json:"validity"` + + // An optional property indicating when to delete the certificate version, expressed in RFC 3339 (https://tools.ietf.org/html/rfc3339) timestamp format. + // Example: `2019-04-03T21:10:29.600Z` + TimeOfDeletion *common.SDKTime `mandatory:"false" json:"timeOfDeletion"` + + RevocationStatus *RevocationStatus `mandatory:"false" json:"revocationStatus"` +} + +func (m CertificateBundleVersionSummary) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m CertificateBundleVersionSummary) ValidateEnumValue() (bool, error) { + errMessage := []string{} + for _, val := range m.Stages { + if _, ok := GetMappingVersionStageEnum(string(val)); !ok && val != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Stages: %s. Supported values are: %s.", val, strings.Join(GetVersionStageEnumStringValues(), ","))) + } + } + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_bundle_with_private_key.go b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_bundle_with_private_key.go new file mode 100644 index 00000000000..dec96e902ce --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificate_bundle_with_private_key.go @@ -0,0 +1,151 @@ +// Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Certificates Service Retrieval API +// +// API for retrieving certificates. +// + +package certificates + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// CertificateBundleWithPrivateKey A certificate bundle, including the private key. +type CertificateBundleWithPrivateKey struct { + + // The OCID of the certificate. + CertificateId *string `mandatory:"true" json:"certificateId"` + + // The name of the certificate. + CertificateName *string `mandatory:"true" json:"certificateName"` + + // The version number of the certificate. + VersionNumber *int64 `mandatory:"true" json:"versionNumber"` + + // A unique certificate identifier used in certificate revocation tracking, formatted as octets. + // Example: `03 AC FC FA CC B3 CB 02 B8 F8 DE F5 85 E7 7B FF` + SerialNumber *string `mandatory:"true" json:"serialNumber"` + + // An optional property indicating when the certificate version was created, expressed in RFC 3339 (https://tools.ietf.org/html/rfc3339) timestamp format. + // Example: `2019-04-03T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + Validity *Validity `mandatory:"true" json:"validity"` + + // The private key (in PEM format) for the certificate. + PrivateKeyPem *string `mandatory:"true" json:"privateKeyPem"` + + // The certificate in PEM format. + CertificatePem *string `mandatory:"false" json:"certificatePem"` + + // The certificate chain (in PEM format) for the certificate bundle. + CertChainPem *string `mandatory:"false" json:"certChainPem"` + + // The name of the certificate version. + VersionName *string `mandatory:"false" json:"versionName"` + + RevocationStatus *RevocationStatus `mandatory:"false" json:"revocationStatus"` + + // An optional passphrase for the private key. + PrivateKeyPemPassphrase *string `mandatory:"false" json:"privateKeyPemPassphrase"` + + // A list of rotation states for the certificate bundle. + Stages []VersionStageEnum `mandatory:"true" json:"stages"` +} + +//GetCertificateId returns CertificateId +func (m CertificateBundleWithPrivateKey) GetCertificateId() *string { + return m.CertificateId +} + +//GetCertificateName returns CertificateName +func (m CertificateBundleWithPrivateKey) GetCertificateName() *string { + return m.CertificateName +} + +//GetVersionNumber returns VersionNumber +func (m CertificateBundleWithPrivateKey) GetVersionNumber() *int64 { + return m.VersionNumber +} + +//GetSerialNumber returns SerialNumber +func (m CertificateBundleWithPrivateKey) GetSerialNumber() *string { + return m.SerialNumber +} + +//GetCertificatePem returns CertificatePem +func (m CertificateBundleWithPrivateKey) GetCertificatePem() *string { + return m.CertificatePem +} + +//GetCertChainPem returns CertChainPem +func (m CertificateBundleWithPrivateKey) GetCertChainPem() *string { + return m.CertChainPem +} + +//GetTimeCreated returns TimeCreated +func (m CertificateBundleWithPrivateKey) GetTimeCreated() *common.SDKTime { + return m.TimeCreated +} + +//GetValidity returns Validity +func (m CertificateBundleWithPrivateKey) GetValidity() *Validity { + return m.Validity +} + +//GetVersionName returns VersionName +func (m CertificateBundleWithPrivateKey) GetVersionName() *string { + return m.VersionName +} + +//GetStages returns Stages +func (m CertificateBundleWithPrivateKey) GetStages() []VersionStageEnum { + return m.Stages +} + +//GetRevocationStatus returns RevocationStatus +func (m CertificateBundleWithPrivateKey) GetRevocationStatus() *RevocationStatus { + return m.RevocationStatus +} + +func (m CertificateBundleWithPrivateKey) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m CertificateBundleWithPrivateKey) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + for _, val := range m.Stages { + if _, ok := GetMappingVersionStageEnum(string(val)); !ok && val != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Stages: %s. Supported values are: %s.", val, strings.Join(GetVersionStageEnumStringValues(), ","))) + } + } + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// MarshalJSON marshals to json representation +func (m CertificateBundleWithPrivateKey) MarshalJSON() (buff []byte, e error) { + type MarshalTypeCertificateBundleWithPrivateKey CertificateBundleWithPrivateKey + s := struct { + DiscriminatorParam string `json:"certificateBundleType"` + MarshalTypeCertificateBundleWithPrivateKey + }{ + "CERTIFICATE_CONTENT_WITH_PRIVATE_KEY", + (MarshalTypeCertificateBundleWithPrivateKey)(m), + } + + return json.Marshal(&s) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificates_client.go b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificates_client.go new file mode 100644 index 00000000000..91f98272a76 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/certificates_client.go @@ -0,0 +1,377 @@ +// Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Certificates Service Retrieval API +// +// API for retrieving certificates. +// + +package certificates + +import ( + "context" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "github.com/oracle/oci-go-sdk/v65/common/auth" + "net/http" +) + +//CertificatesClient a client for Certificates +type CertificatesClient struct { + common.BaseClient + config *common.ConfigurationProvider +} + +// NewCertificatesClientWithConfigurationProvider Creates a new default Certificates client with the given configuration provider. +// the configuration provider will be used for the default signer as well as reading the region +func NewCertificatesClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client CertificatesClient, err error) { + provider, err := auth.GetGenericConfigurationProvider(configProvider) + if err != nil { + return client, err + } + baseClient, e := common.NewClientWithConfig(provider) + if e != nil { + return client, e + } + return newCertificatesClientFromBaseClient(baseClient, provider) +} + +// NewCertificatesClientWithOboToken Creates a new default Certificates client with the given configuration provider. +// The obotoken will be added to default headers and signed; the configuration provider will be used for the signer +// as well as reading the region +func NewCertificatesClientWithOboToken(configProvider common.ConfigurationProvider, oboToken string) (client CertificatesClient, err error) { + baseClient, err := common.NewClientWithOboToken(configProvider, oboToken) + if err != nil { + return client, err + } + + return newCertificatesClientFromBaseClient(baseClient, configProvider) +} + +func newCertificatesClientFromBaseClient(baseClient common.BaseClient, configProvider common.ConfigurationProvider) (client CertificatesClient, err error) { + // Certificates service default circuit breaker is enabled + baseClient.Configuration.CircuitBreaker = common.NewCircuitBreaker(common.DefaultCircuitBreakerSettingWithServiceName("Certificates")) + common.ConfigCircuitBreakerFromEnvVar(&baseClient) + common.ConfigCircuitBreakerFromGlobalVar(&baseClient) + + client = CertificatesClient{BaseClient: baseClient} + client.BasePath = "20210224" + err = client.setConfigurationProvider(configProvider) + return +} + +// SetRegion overrides the region of this client. +func (client *CertificatesClient) SetRegion(region string) { + client.Host = common.StringToRegion(region).EndpointForTemplate("certificates", "https://certificates.{region}.oci.{secondLevelDomain}") +} + +// SetConfigurationProvider sets the configuration provider including the region, returns an error if is not valid +func (client *CertificatesClient) setConfigurationProvider(configProvider common.ConfigurationProvider) error { + if ok, err := common.IsConfigurationProviderValid(configProvider); !ok { + return err + } + + // Error has been checked already + region, _ := configProvider.Region() + client.SetRegion(region) + if client.Host == "" { + return fmt.Errorf("Invalid region or Host. Endpoint cannot be constructed without endpointServiceName or serviceEndpointTemplate for a dotted region") + } + client.config = &configProvider + return nil +} + +// ConfigurationProvider the ConfigurationProvider used in this client, or null if none set +func (client *CertificatesClient) ConfigurationProvider() *common.ConfigurationProvider { + return client.config +} + +// GetCaBundle Gets a ca-bundle bundle. +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/certificates/GetCaBundle.go.html to see an example of how to use GetCaBundle API. +func (client CertificatesClient) GetCaBundle(ctx context.Context, request GetCaBundleRequest) (response GetCaBundleResponse, err error) { + var ociResponse common.OCIResponse + policy := common.NoRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.getCaBundle, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = GetCaBundleResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = GetCaBundleResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(GetCaBundleResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into GetCaBundleResponse") + } + return +} + +// getCaBundle implements the OCIOperation interface (enables retrying operations) +func (client CertificatesClient) getCaBundle(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodGet, "/caBundles/{caBundleId}", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response GetCaBundleResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "https://docs.oracle.com/iaas/api/#/en/certificates/20210224/CaBundle/GetCaBundle" + err = common.PostProcessServiceError(err, "Certificates", "GetCaBundle", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// GetCertificateAuthorityBundle Gets a certificate authority bundle that matches either the specified `stage`, `name`, or `versionNumber` parameter. +// If none of these parameters are provided, the bundle for the certificate authority version marked as `CURRENT` will be returned. +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/certificates/GetCertificateAuthorityBundle.go.html to see an example of how to use GetCertificateAuthorityBundle API. +func (client CertificatesClient) GetCertificateAuthorityBundle(ctx context.Context, request GetCertificateAuthorityBundleRequest) (response GetCertificateAuthorityBundleResponse, err error) { + var ociResponse common.OCIResponse + policy := common.NoRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.getCertificateAuthorityBundle, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = GetCertificateAuthorityBundleResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = GetCertificateAuthorityBundleResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(GetCertificateAuthorityBundleResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into GetCertificateAuthorityBundleResponse") + } + return +} + +// getCertificateAuthorityBundle implements the OCIOperation interface (enables retrying operations) +func (client CertificatesClient) getCertificateAuthorityBundle(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodGet, "/certificateAuthorityBundles/{certificateAuthorityId}", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response GetCertificateAuthorityBundleResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "https://docs.oracle.com/iaas/api/#/en/certificates/20210224/CertificateAuthorityBundle/GetCertificateAuthorityBundle" + err = common.PostProcessServiceError(err, "Certificates", "GetCertificateAuthorityBundle", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// GetCertificateBundle Gets a certificate bundle that matches either the specified `stage`, `versionName`, or `versionNumber` parameter. +// If none of these parameters are provided, the bundle for the certificate version marked as `CURRENT` will be returned. +// By default, the private key is not included in the query result, and a CertificateBundlePublicOnly is returned. +// If the private key is needed, use the CertificateBundleTypeQueryParam parameter to get a CertificateBundleWithPrivateKey response. +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/certificates/GetCertificateBundle.go.html to see an example of how to use GetCertificateBundle API. +func (client CertificatesClient) GetCertificateBundle(ctx context.Context, request GetCertificateBundleRequest) (response GetCertificateBundleResponse, err error) { + var ociResponse common.OCIResponse + policy := common.NoRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.getCertificateBundle, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = GetCertificateBundleResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = GetCertificateBundleResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(GetCertificateBundleResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into GetCertificateBundleResponse") + } + return +} + +// getCertificateBundle implements the OCIOperation interface (enables retrying operations) +func (client CertificatesClient) getCertificateBundle(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodGet, "/certificateBundles/{certificateId}", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response GetCertificateBundleResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "https://docs.oracle.com/iaas/api/#/en/certificates/20210224/CertificateBundle/GetCertificateBundle" + err = common.PostProcessServiceError(err, "Certificates", "GetCertificateBundle", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponseWithPolymorphicBody(httpResponse, &response, &certificatebundle{}) + return response, err +} + +// ListCertificateAuthorityBundleVersions Lists all certificate authority bundle versions for the specified certificate authority. +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/certificates/ListCertificateAuthorityBundleVersions.go.html to see an example of how to use ListCertificateAuthorityBundleVersions API. +func (client CertificatesClient) ListCertificateAuthorityBundleVersions(ctx context.Context, request ListCertificateAuthorityBundleVersionsRequest) (response ListCertificateAuthorityBundleVersionsResponse, err error) { + var ociResponse common.OCIResponse + policy := common.NoRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.listCertificateAuthorityBundleVersions, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = ListCertificateAuthorityBundleVersionsResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = ListCertificateAuthorityBundleVersionsResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(ListCertificateAuthorityBundleVersionsResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into ListCertificateAuthorityBundleVersionsResponse") + } + return +} + +// listCertificateAuthorityBundleVersions implements the OCIOperation interface (enables retrying operations) +func (client CertificatesClient) listCertificateAuthorityBundleVersions(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodGet, "/certificateAuthorityBundles/{certificateAuthorityId}/versions", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response ListCertificateAuthorityBundleVersionsResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "https://docs.oracle.com/iaas/api/#/en/certificates/20210224/CertificateAuthorityBundleVersionSummary/ListCertificateAuthorityBundleVersions" + err = common.PostProcessServiceError(err, "Certificates", "ListCertificateAuthorityBundleVersions", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// ListCertificateBundleVersions Lists all certificate bundle versions for the specified certificate. +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/certificates/ListCertificateBundleVersions.go.html to see an example of how to use ListCertificateBundleVersions API. +func (client CertificatesClient) ListCertificateBundleVersions(ctx context.Context, request ListCertificateBundleVersionsRequest) (response ListCertificateBundleVersionsResponse, err error) { + var ociResponse common.OCIResponse + policy := common.NoRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.listCertificateBundleVersions, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = ListCertificateBundleVersionsResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = ListCertificateBundleVersionsResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(ListCertificateBundleVersionsResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into ListCertificateBundleVersionsResponse") + } + return +} + +// listCertificateBundleVersions implements the OCIOperation interface (enables retrying operations) +func (client CertificatesClient) listCertificateBundleVersions(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodGet, "/certificateBundles/{certificateId}/versions", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response ListCertificateBundleVersionsResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "https://docs.oracle.com/iaas/api/#/en/certificates/20210224/CertificateBundleVersionSummary/ListCertificateBundleVersions" + err = common.PostProcessServiceError(err, "Certificates", "ListCertificateBundleVersions", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} diff --git a/vendor/github.com/oracle/oci-go-sdk/v65/certificates/get_ca_bundle_request_response.go b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/get_ca_bundle_request_response.go new file mode 100644 index 00000000000..9f1959031b8 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/get_ca_bundle_request_response.go @@ -0,0 +1,93 @@ +// Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package certificates + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// GetCaBundleRequest wrapper for the GetCaBundle operation +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/certificates/GetCaBundle.go.html to see an example of how to use GetCaBundleRequest. +type GetCaBundleRequest struct { + + // The OCID of the CA bundle. + CaBundleId *string `mandatory:"true" contributesTo:"path" name:"caBundleId"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, + // please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request GetCaBundleRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request GetCaBundleRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request GetCaBundleRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request GetCaBundleRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request GetCaBundleRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// GetCaBundleResponse wrapper for the GetCaBundle operation +type GetCaBundleResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The CaBundle instance + CaBundle `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetCaBundleResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response GetCaBundleResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/vendor/github.com/oracle/oci-go-sdk/v65/certificates/get_certificate_authority_bundle_request_response.go b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/get_certificate_authority_bundle_request_response.go new file mode 100644 index 00000000000..c166667cc8e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/get_certificate_authority_bundle_request_response.go @@ -0,0 +1,159 @@ +// Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package certificates + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// GetCertificateAuthorityBundleRequest wrapper for the GetCertificateAuthorityBundle operation +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/certificates/GetCertificateAuthorityBundle.go.html to see an example of how to use GetCertificateAuthorityBundleRequest. +type GetCertificateAuthorityBundleRequest struct { + + // The OCID of the certificate authority (CA). + CertificateAuthorityId *string `mandatory:"true" contributesTo:"path" name:"certificateAuthorityId"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, + // please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // The version number of the certificate authority (CA). + VersionNumber *int64 `mandatory:"false" contributesTo:"query" name:"versionNumber"` + + // The name of the certificate authority (CA). (This might be referred to as the name of the CA version, as every CA consists of at least one version.) Names are unique across versions of a given CA. + CertificateAuthorityVersionName *string `mandatory:"false" contributesTo:"query" name:"certificateAuthorityVersionName"` + + // The rotation state of the certificate version. + Stage GetCertificateAuthorityBundleStageEnum `mandatory:"false" contributesTo:"query" name:"stage" omitEmpty:"true"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request GetCertificateAuthorityBundleRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request GetCertificateAuthorityBundleRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request GetCertificateAuthorityBundleRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request GetCertificateAuthorityBundleRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request GetCertificateAuthorityBundleRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if _, ok := GetMappingGetCertificateAuthorityBundleStageEnum(string(request.Stage)); !ok && request.Stage != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Stage: %s. Supported values are: %s.", request.Stage, strings.Join(GetGetCertificateAuthorityBundleStageEnumStringValues(), ","))) + } + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// GetCertificateAuthorityBundleResponse wrapper for the GetCertificateAuthorityBundle operation +type GetCertificateAuthorityBundleResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The CertificateAuthorityBundle instance + CertificateAuthorityBundle `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetCertificateAuthorityBundleResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response GetCertificateAuthorityBundleResponse) HTTPResponse() *http.Response { + return response.RawResponse +} + +// GetCertificateAuthorityBundleStageEnum Enum with underlying type: string +type GetCertificateAuthorityBundleStageEnum string + +// Set of constants representing the allowable values for GetCertificateAuthorityBundleStageEnum +const ( + GetCertificateAuthorityBundleStageCurrent GetCertificateAuthorityBundleStageEnum = "CURRENT" + GetCertificateAuthorityBundleStagePending GetCertificateAuthorityBundleStageEnum = "PENDING" + GetCertificateAuthorityBundleStageLatest GetCertificateAuthorityBundleStageEnum = "LATEST" + GetCertificateAuthorityBundleStagePrevious GetCertificateAuthorityBundleStageEnum = "PREVIOUS" + GetCertificateAuthorityBundleStageDeprecated GetCertificateAuthorityBundleStageEnum = "DEPRECATED" +) + +var mappingGetCertificateAuthorityBundleStageEnum = map[string]GetCertificateAuthorityBundleStageEnum{ + "CURRENT": GetCertificateAuthorityBundleStageCurrent, + "PENDING": GetCertificateAuthorityBundleStagePending, + "LATEST": GetCertificateAuthorityBundleStageLatest, + "PREVIOUS": GetCertificateAuthorityBundleStagePrevious, + "DEPRECATED": GetCertificateAuthorityBundleStageDeprecated, +} + +var mappingGetCertificateAuthorityBundleStageEnumLowerCase = map[string]GetCertificateAuthorityBundleStageEnum{ + "current": GetCertificateAuthorityBundleStageCurrent, + "pending": GetCertificateAuthorityBundleStagePending, + "latest": GetCertificateAuthorityBundleStageLatest, + "previous": GetCertificateAuthorityBundleStagePrevious, + "deprecated": GetCertificateAuthorityBundleStageDeprecated, +} + +// GetGetCertificateAuthorityBundleStageEnumValues Enumerates the set of values for GetCertificateAuthorityBundleStageEnum +func GetGetCertificateAuthorityBundleStageEnumValues() []GetCertificateAuthorityBundleStageEnum { + values := make([]GetCertificateAuthorityBundleStageEnum, 0) + for _, v := range mappingGetCertificateAuthorityBundleStageEnum { + values = append(values, v) + } + return values +} + +// GetGetCertificateAuthorityBundleStageEnumStringValues Enumerates the set of values in String for GetCertificateAuthorityBundleStageEnum +func GetGetCertificateAuthorityBundleStageEnumStringValues() []string { + return []string{ + "CURRENT", + "PENDING", + "LATEST", + "PREVIOUS", + "DEPRECATED", + } +} + +// GetMappingGetCertificateAuthorityBundleStageEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingGetCertificateAuthorityBundleStageEnum(val string) (GetCertificateAuthorityBundleStageEnum, bool) { + enum, ok := mappingGetCertificateAuthorityBundleStageEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/vendor/github.com/oracle/oci-go-sdk/v65/certificates/get_certificate_bundle_request_response.go b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/get_certificate_bundle_request_response.go new file mode 100644 index 00000000000..3bd35c42f04 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/get_certificate_bundle_request_response.go @@ -0,0 +1,207 @@ +// Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package certificates + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// GetCertificateBundleRequest wrapper for the GetCertificateBundle operation +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/certificates/GetCertificateBundle.go.html to see an example of how to use GetCertificateBundleRequest. +type GetCertificateBundleRequest struct { + + // The OCID of the certificate. + CertificateId *string `mandatory:"true" contributesTo:"path" name:"certificateId"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, + // please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // The version number of the certificate. The default value is 0, which means that this query parameter is ignored. + VersionNumber *int64 `mandatory:"false" contributesTo:"query" name:"versionNumber"` + + // The name of the certificate. (This might be referred to as the name of the certificate version, as every certificate consists of at least one version.) Names are unique across versions of a given certificate. + CertificateVersionName *string `mandatory:"false" contributesTo:"query" name:"certificateVersionName"` + + // The rotation state of the certificate version. + Stage GetCertificateBundleStageEnum `mandatory:"false" contributesTo:"query" name:"stage" omitEmpty:"true"` + + // The type of certificate bundle. By default, the private key fields are not returned. When querying for certificate bundles, to return results with certificate contents, the private key in PEM format, and the private key passphrase, specify the value of this parameter as `CERTIFICATE_CONTENT_WITH_PRIVATE_KEY`. + CertificateBundleType GetCertificateBundleCertificateBundleTypeEnum `mandatory:"false" contributesTo:"query" name:"certificateBundleType" omitEmpty:"true"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request GetCertificateBundleRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request GetCertificateBundleRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request GetCertificateBundleRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request GetCertificateBundleRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request GetCertificateBundleRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if _, ok := GetMappingGetCertificateBundleStageEnum(string(request.Stage)); !ok && request.Stage != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Stage: %s. Supported values are: %s.", request.Stage, strings.Join(GetGetCertificateBundleStageEnumStringValues(), ","))) + } + if _, ok := GetMappingGetCertificateBundleCertificateBundleTypeEnum(string(request.CertificateBundleType)); !ok && request.CertificateBundleType != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for CertificateBundleType: %s. Supported values are: %s.", request.CertificateBundleType, strings.Join(GetGetCertificateBundleCertificateBundleTypeEnumStringValues(), ","))) + } + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// GetCertificateBundleResponse wrapper for the GetCertificateBundle operation +type GetCertificateBundleResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The CertificateBundle instance + CertificateBundle `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetCertificateBundleResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response GetCertificateBundleResponse) HTTPResponse() *http.Response { + return response.RawResponse +} + +// GetCertificateBundleStageEnum Enum with underlying type: string +type GetCertificateBundleStageEnum string + +// Set of constants representing the allowable values for GetCertificateBundleStageEnum +const ( + GetCertificateBundleStageCurrent GetCertificateBundleStageEnum = "CURRENT" + GetCertificateBundleStagePending GetCertificateBundleStageEnum = "PENDING" + GetCertificateBundleStageLatest GetCertificateBundleStageEnum = "LATEST" + GetCertificateBundleStagePrevious GetCertificateBundleStageEnum = "PREVIOUS" + GetCertificateBundleStageDeprecated GetCertificateBundleStageEnum = "DEPRECATED" +) + +var mappingGetCertificateBundleStageEnum = map[string]GetCertificateBundleStageEnum{ + "CURRENT": GetCertificateBundleStageCurrent, + "PENDING": GetCertificateBundleStagePending, + "LATEST": GetCertificateBundleStageLatest, + "PREVIOUS": GetCertificateBundleStagePrevious, + "DEPRECATED": GetCertificateBundleStageDeprecated, +} + +var mappingGetCertificateBundleStageEnumLowerCase = map[string]GetCertificateBundleStageEnum{ + "current": GetCertificateBundleStageCurrent, + "pending": GetCertificateBundleStagePending, + "latest": GetCertificateBundleStageLatest, + "previous": GetCertificateBundleStagePrevious, + "deprecated": GetCertificateBundleStageDeprecated, +} + +// GetGetCertificateBundleStageEnumValues Enumerates the set of values for GetCertificateBundleStageEnum +func GetGetCertificateBundleStageEnumValues() []GetCertificateBundleStageEnum { + values := make([]GetCertificateBundleStageEnum, 0) + for _, v := range mappingGetCertificateBundleStageEnum { + values = append(values, v) + } + return values +} + +// GetGetCertificateBundleStageEnumStringValues Enumerates the set of values in String for GetCertificateBundleStageEnum +func GetGetCertificateBundleStageEnumStringValues() []string { + return []string{ + "CURRENT", + "PENDING", + "LATEST", + "PREVIOUS", + "DEPRECATED", + } +} + +// GetMappingGetCertificateBundleStageEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingGetCertificateBundleStageEnum(val string) (GetCertificateBundleStageEnum, bool) { + enum, ok := mappingGetCertificateBundleStageEnumLowerCase[strings.ToLower(val)] + return enum, ok +} + +// GetCertificateBundleCertificateBundleTypeEnum Enum with underlying type: string +type GetCertificateBundleCertificateBundleTypeEnum string + +// Set of constants representing the allowable values for GetCertificateBundleCertificateBundleTypeEnum +const ( + GetCertificateBundleCertificateBundleTypePublicOnly GetCertificateBundleCertificateBundleTypeEnum = "CERTIFICATE_CONTENT_PUBLIC_ONLY" + GetCertificateBundleCertificateBundleTypeWithPrivateKey GetCertificateBundleCertificateBundleTypeEnum = "CERTIFICATE_CONTENT_WITH_PRIVATE_KEY" +) + +var mappingGetCertificateBundleCertificateBundleTypeEnum = map[string]GetCertificateBundleCertificateBundleTypeEnum{ + "CERTIFICATE_CONTENT_PUBLIC_ONLY": GetCertificateBundleCertificateBundleTypePublicOnly, + "CERTIFICATE_CONTENT_WITH_PRIVATE_KEY": GetCertificateBundleCertificateBundleTypeWithPrivateKey, +} + +var mappingGetCertificateBundleCertificateBundleTypeEnumLowerCase = map[string]GetCertificateBundleCertificateBundleTypeEnum{ + "certificate_content_public_only": GetCertificateBundleCertificateBundleTypePublicOnly, + "certificate_content_with_private_key": GetCertificateBundleCertificateBundleTypeWithPrivateKey, +} + +// GetGetCertificateBundleCertificateBundleTypeEnumValues Enumerates the set of values for GetCertificateBundleCertificateBundleTypeEnum +func GetGetCertificateBundleCertificateBundleTypeEnumValues() []GetCertificateBundleCertificateBundleTypeEnum { + values := make([]GetCertificateBundleCertificateBundleTypeEnum, 0) + for _, v := range mappingGetCertificateBundleCertificateBundleTypeEnum { + values = append(values, v) + } + return values +} + +// GetGetCertificateBundleCertificateBundleTypeEnumStringValues Enumerates the set of values in String for GetCertificateBundleCertificateBundleTypeEnum +func GetGetCertificateBundleCertificateBundleTypeEnumStringValues() []string { + return []string{ + "CERTIFICATE_CONTENT_PUBLIC_ONLY", + "CERTIFICATE_CONTENT_WITH_PRIVATE_KEY", + } +} + +// GetMappingGetCertificateBundleCertificateBundleTypeEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingGetCertificateBundleCertificateBundleTypeEnum(val string) (GetCertificateBundleCertificateBundleTypeEnum, bool) { + enum, ok := mappingGetCertificateBundleCertificateBundleTypeEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/vendor/github.com/oracle/oci-go-sdk/v65/certificates/list_certificate_authority_bundle_versions_request_response.go b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/list_certificate_authority_bundle_versions_request_response.go new file mode 100644 index 00000000000..16cb070ce1f --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/list_certificate_authority_bundle_versions_request_response.go @@ -0,0 +1,183 @@ +// Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package certificates + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// ListCertificateAuthorityBundleVersionsRequest wrapper for the ListCertificateAuthorityBundleVersions operation +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/certificates/ListCertificateAuthorityBundleVersions.go.html to see an example of how to use ListCertificateAuthorityBundleVersionsRequest. +type ListCertificateAuthorityBundleVersionsRequest struct { + + // The OCID of the certificate authority (CA). + CertificateAuthorityId *string `mandatory:"true" contributesTo:"path" name:"certificateAuthorityId"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, + // please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // The field to sort by. You can specify only one sort order. The default + // order for `VERSION_NUMBER` is ascending. + SortBy ListCertificateAuthorityBundleVersionsSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // The sort order to use, either ascending (`ASC`) or descending (`DESC`). + SortOrder ListCertificateAuthorityBundleVersionsSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request ListCertificateAuthorityBundleVersionsRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request ListCertificateAuthorityBundleVersionsRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request ListCertificateAuthorityBundleVersionsRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request ListCertificateAuthorityBundleVersionsRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request ListCertificateAuthorityBundleVersionsRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if _, ok := GetMappingListCertificateAuthorityBundleVersionsSortByEnum(string(request.SortBy)); !ok && request.SortBy != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for SortBy: %s. Supported values are: %s.", request.SortBy, strings.Join(GetListCertificateAuthorityBundleVersionsSortByEnumStringValues(), ","))) + } + if _, ok := GetMappingListCertificateAuthorityBundleVersionsSortOrderEnum(string(request.SortOrder)); !ok && request.SortOrder != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for SortOrder: %s. Supported values are: %s.", request.SortOrder, strings.Join(GetListCertificateAuthorityBundleVersionsSortOrderEnumStringValues(), ","))) + } + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// ListCertificateAuthorityBundleVersionsResponse wrapper for the ListCertificateAuthorityBundleVersions operation +type ListCertificateAuthorityBundleVersionsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The CertificateAuthorityBundleVersionCollection instance + CertificateAuthorityBundleVersionCollection `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListCertificateAuthorityBundleVersionsResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response ListCertificateAuthorityBundleVersionsResponse) HTTPResponse() *http.Response { + return response.RawResponse +} + +// ListCertificateAuthorityBundleVersionsSortByEnum Enum with underlying type: string +type ListCertificateAuthorityBundleVersionsSortByEnum string + +// Set of constants representing the allowable values for ListCertificateAuthorityBundleVersionsSortByEnum +const ( + ListCertificateAuthorityBundleVersionsSortByVersionNumber ListCertificateAuthorityBundleVersionsSortByEnum = "VERSION_NUMBER" +) + +var mappingListCertificateAuthorityBundleVersionsSortByEnum = map[string]ListCertificateAuthorityBundleVersionsSortByEnum{ + "VERSION_NUMBER": ListCertificateAuthorityBundleVersionsSortByVersionNumber, +} + +var mappingListCertificateAuthorityBundleVersionsSortByEnumLowerCase = map[string]ListCertificateAuthorityBundleVersionsSortByEnum{ + "version_number": ListCertificateAuthorityBundleVersionsSortByVersionNumber, +} + +// GetListCertificateAuthorityBundleVersionsSortByEnumValues Enumerates the set of values for ListCertificateAuthorityBundleVersionsSortByEnum +func GetListCertificateAuthorityBundleVersionsSortByEnumValues() []ListCertificateAuthorityBundleVersionsSortByEnum { + values := make([]ListCertificateAuthorityBundleVersionsSortByEnum, 0) + for _, v := range mappingListCertificateAuthorityBundleVersionsSortByEnum { + values = append(values, v) + } + return values +} + +// GetListCertificateAuthorityBundleVersionsSortByEnumStringValues Enumerates the set of values in String for ListCertificateAuthorityBundleVersionsSortByEnum +func GetListCertificateAuthorityBundleVersionsSortByEnumStringValues() []string { + return []string{ + "VERSION_NUMBER", + } +} + +// GetMappingListCertificateAuthorityBundleVersionsSortByEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingListCertificateAuthorityBundleVersionsSortByEnum(val string) (ListCertificateAuthorityBundleVersionsSortByEnum, bool) { + enum, ok := mappingListCertificateAuthorityBundleVersionsSortByEnumLowerCase[strings.ToLower(val)] + return enum, ok +} + +// ListCertificateAuthorityBundleVersionsSortOrderEnum Enum with underlying type: string +type ListCertificateAuthorityBundleVersionsSortOrderEnum string + +// Set of constants representing the allowable values for ListCertificateAuthorityBundleVersionsSortOrderEnum +const ( + ListCertificateAuthorityBundleVersionsSortOrderAsc ListCertificateAuthorityBundleVersionsSortOrderEnum = "ASC" + ListCertificateAuthorityBundleVersionsSortOrderDesc ListCertificateAuthorityBundleVersionsSortOrderEnum = "DESC" +) + +var mappingListCertificateAuthorityBundleVersionsSortOrderEnum = map[string]ListCertificateAuthorityBundleVersionsSortOrderEnum{ + "ASC": ListCertificateAuthorityBundleVersionsSortOrderAsc, + "DESC": ListCertificateAuthorityBundleVersionsSortOrderDesc, +} + +var mappingListCertificateAuthorityBundleVersionsSortOrderEnumLowerCase = map[string]ListCertificateAuthorityBundleVersionsSortOrderEnum{ + "asc": ListCertificateAuthorityBundleVersionsSortOrderAsc, + "desc": ListCertificateAuthorityBundleVersionsSortOrderDesc, +} + +// GetListCertificateAuthorityBundleVersionsSortOrderEnumValues Enumerates the set of values for ListCertificateAuthorityBundleVersionsSortOrderEnum +func GetListCertificateAuthorityBundleVersionsSortOrderEnumValues() []ListCertificateAuthorityBundleVersionsSortOrderEnum { + values := make([]ListCertificateAuthorityBundleVersionsSortOrderEnum, 0) + for _, v := range mappingListCertificateAuthorityBundleVersionsSortOrderEnum { + values = append(values, v) + } + return values +} + +// GetListCertificateAuthorityBundleVersionsSortOrderEnumStringValues Enumerates the set of values in String for ListCertificateAuthorityBundleVersionsSortOrderEnum +func GetListCertificateAuthorityBundleVersionsSortOrderEnumStringValues() []string { + return []string{ + "ASC", + "DESC", + } +} + +// GetMappingListCertificateAuthorityBundleVersionsSortOrderEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingListCertificateAuthorityBundleVersionsSortOrderEnum(val string) (ListCertificateAuthorityBundleVersionsSortOrderEnum, bool) { + enum, ok := mappingListCertificateAuthorityBundleVersionsSortOrderEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/vendor/github.com/oracle/oci-go-sdk/v65/certificates/list_certificate_bundle_versions_request_response.go b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/list_certificate_bundle_versions_request_response.go new file mode 100644 index 00000000000..dd4fa3614e7 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/list_certificate_bundle_versions_request_response.go @@ -0,0 +1,183 @@ +// Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package certificates + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// ListCertificateBundleVersionsRequest wrapper for the ListCertificateBundleVersions operation +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/certificates/ListCertificateBundleVersions.go.html to see an example of how to use ListCertificateBundleVersionsRequest. +type ListCertificateBundleVersionsRequest struct { + + // The OCID of the certificate. + CertificateId *string `mandatory:"true" contributesTo:"path" name:"certificateId"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, + // please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // The field to sort by. You can specify only one sort order. The default + // order for `VERSION_NUMBER` is ascending. + SortBy ListCertificateBundleVersionsSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // The sort order to use, either ascending (`ASC`) or descending (`DESC`). + SortOrder ListCertificateBundleVersionsSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request ListCertificateBundleVersionsRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request ListCertificateBundleVersionsRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request ListCertificateBundleVersionsRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request ListCertificateBundleVersionsRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request ListCertificateBundleVersionsRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if _, ok := GetMappingListCertificateBundleVersionsSortByEnum(string(request.SortBy)); !ok && request.SortBy != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for SortBy: %s. Supported values are: %s.", request.SortBy, strings.Join(GetListCertificateBundleVersionsSortByEnumStringValues(), ","))) + } + if _, ok := GetMappingListCertificateBundleVersionsSortOrderEnum(string(request.SortOrder)); !ok && request.SortOrder != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for SortOrder: %s. Supported values are: %s.", request.SortOrder, strings.Join(GetListCertificateBundleVersionsSortOrderEnumStringValues(), ","))) + } + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// ListCertificateBundleVersionsResponse wrapper for the ListCertificateBundleVersions operation +type ListCertificateBundleVersionsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The CertificateBundleVersionCollection instance + CertificateBundleVersionCollection `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListCertificateBundleVersionsResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response ListCertificateBundleVersionsResponse) HTTPResponse() *http.Response { + return response.RawResponse +} + +// ListCertificateBundleVersionsSortByEnum Enum with underlying type: string +type ListCertificateBundleVersionsSortByEnum string + +// Set of constants representing the allowable values for ListCertificateBundleVersionsSortByEnum +const ( + ListCertificateBundleVersionsSortByVersionNumber ListCertificateBundleVersionsSortByEnum = "VERSION_NUMBER" +) + +var mappingListCertificateBundleVersionsSortByEnum = map[string]ListCertificateBundleVersionsSortByEnum{ + "VERSION_NUMBER": ListCertificateBundleVersionsSortByVersionNumber, +} + +var mappingListCertificateBundleVersionsSortByEnumLowerCase = map[string]ListCertificateBundleVersionsSortByEnum{ + "version_number": ListCertificateBundleVersionsSortByVersionNumber, +} + +// GetListCertificateBundleVersionsSortByEnumValues Enumerates the set of values for ListCertificateBundleVersionsSortByEnum +func GetListCertificateBundleVersionsSortByEnumValues() []ListCertificateBundleVersionsSortByEnum { + values := make([]ListCertificateBundleVersionsSortByEnum, 0) + for _, v := range mappingListCertificateBundleVersionsSortByEnum { + values = append(values, v) + } + return values +} + +// GetListCertificateBundleVersionsSortByEnumStringValues Enumerates the set of values in String for ListCertificateBundleVersionsSortByEnum +func GetListCertificateBundleVersionsSortByEnumStringValues() []string { + return []string{ + "VERSION_NUMBER", + } +} + +// GetMappingListCertificateBundleVersionsSortByEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingListCertificateBundleVersionsSortByEnum(val string) (ListCertificateBundleVersionsSortByEnum, bool) { + enum, ok := mappingListCertificateBundleVersionsSortByEnumLowerCase[strings.ToLower(val)] + return enum, ok +} + +// ListCertificateBundleVersionsSortOrderEnum Enum with underlying type: string +type ListCertificateBundleVersionsSortOrderEnum string + +// Set of constants representing the allowable values for ListCertificateBundleVersionsSortOrderEnum +const ( + ListCertificateBundleVersionsSortOrderAsc ListCertificateBundleVersionsSortOrderEnum = "ASC" + ListCertificateBundleVersionsSortOrderDesc ListCertificateBundleVersionsSortOrderEnum = "DESC" +) + +var mappingListCertificateBundleVersionsSortOrderEnum = map[string]ListCertificateBundleVersionsSortOrderEnum{ + "ASC": ListCertificateBundleVersionsSortOrderAsc, + "DESC": ListCertificateBundleVersionsSortOrderDesc, +} + +var mappingListCertificateBundleVersionsSortOrderEnumLowerCase = map[string]ListCertificateBundleVersionsSortOrderEnum{ + "asc": ListCertificateBundleVersionsSortOrderAsc, + "desc": ListCertificateBundleVersionsSortOrderDesc, +} + +// GetListCertificateBundleVersionsSortOrderEnumValues Enumerates the set of values for ListCertificateBundleVersionsSortOrderEnum +func GetListCertificateBundleVersionsSortOrderEnumValues() []ListCertificateBundleVersionsSortOrderEnum { + values := make([]ListCertificateBundleVersionsSortOrderEnum, 0) + for _, v := range mappingListCertificateBundleVersionsSortOrderEnum { + values = append(values, v) + } + return values +} + +// GetListCertificateBundleVersionsSortOrderEnumStringValues Enumerates the set of values in String for ListCertificateBundleVersionsSortOrderEnum +func GetListCertificateBundleVersionsSortOrderEnumStringValues() []string { + return []string{ + "ASC", + "DESC", + } +} + +// GetMappingListCertificateBundleVersionsSortOrderEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingListCertificateBundleVersionsSortOrderEnum(val string) (ListCertificateBundleVersionsSortOrderEnum, bool) { + enum, ok := mappingListCertificateBundleVersionsSortOrderEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/vendor/github.com/oracle/oci-go-sdk/v65/certificates/revocation_reason.go b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/revocation_reason.go new file mode 100644 index 00000000000..cf1da2df2ce --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/revocation_reason.go @@ -0,0 +1,80 @@ +// Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Certificates Service Retrieval API +// +// API for retrieving certificates. +// + +package certificates + +import ( + "strings" +) + +// RevocationReasonEnum Enum with underlying type: string +type RevocationReasonEnum string + +// Set of constants representing the allowable values for RevocationReasonEnum +const ( + RevocationReasonUnspecified RevocationReasonEnum = "UNSPECIFIED" + RevocationReasonKeyCompromise RevocationReasonEnum = "KEY_COMPROMISE" + RevocationReasonCaCompromise RevocationReasonEnum = "CA_COMPROMISE" + RevocationReasonAffiliationChanged RevocationReasonEnum = "AFFILIATION_CHANGED" + RevocationReasonSuperseded RevocationReasonEnum = "SUPERSEDED" + RevocationReasonCessationOfOperation RevocationReasonEnum = "CESSATION_OF_OPERATION" + RevocationReasonPrivilegeWithdrawn RevocationReasonEnum = "PRIVILEGE_WITHDRAWN" + RevocationReasonAaCompromise RevocationReasonEnum = "AA_COMPROMISE" +) + +var mappingRevocationReasonEnum = map[string]RevocationReasonEnum{ + "UNSPECIFIED": RevocationReasonUnspecified, + "KEY_COMPROMISE": RevocationReasonKeyCompromise, + "CA_COMPROMISE": RevocationReasonCaCompromise, + "AFFILIATION_CHANGED": RevocationReasonAffiliationChanged, + "SUPERSEDED": RevocationReasonSuperseded, + "CESSATION_OF_OPERATION": RevocationReasonCessationOfOperation, + "PRIVILEGE_WITHDRAWN": RevocationReasonPrivilegeWithdrawn, + "AA_COMPROMISE": RevocationReasonAaCompromise, +} + +var mappingRevocationReasonEnumLowerCase = map[string]RevocationReasonEnum{ + "unspecified": RevocationReasonUnspecified, + "key_compromise": RevocationReasonKeyCompromise, + "ca_compromise": RevocationReasonCaCompromise, + "affiliation_changed": RevocationReasonAffiliationChanged, + "superseded": RevocationReasonSuperseded, + "cessation_of_operation": RevocationReasonCessationOfOperation, + "privilege_withdrawn": RevocationReasonPrivilegeWithdrawn, + "aa_compromise": RevocationReasonAaCompromise, +} + +// GetRevocationReasonEnumValues Enumerates the set of values for RevocationReasonEnum +func GetRevocationReasonEnumValues() []RevocationReasonEnum { + values := make([]RevocationReasonEnum, 0) + for _, v := range mappingRevocationReasonEnum { + values = append(values, v) + } + return values +} + +// GetRevocationReasonEnumStringValues Enumerates the set of values in String for RevocationReasonEnum +func GetRevocationReasonEnumStringValues() []string { + return []string{ + "UNSPECIFIED", + "KEY_COMPROMISE", + "CA_COMPROMISE", + "AFFILIATION_CHANGED", + "SUPERSEDED", + "CESSATION_OF_OPERATION", + "PRIVILEGE_WITHDRAWN", + "AA_COMPROMISE", + } +} + +// GetMappingRevocationReasonEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingRevocationReasonEnum(val string) (RevocationReasonEnum, bool) { + enum, ok := mappingRevocationReasonEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/vendor/github.com/oracle/oci-go-sdk/v65/certificates/revocation_status.go b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/revocation_status.go new file mode 100644 index 00000000000..17e0d2f6e72 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/revocation_status.go @@ -0,0 +1,45 @@ +// Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Certificates Service Retrieval API +// +// API for retrieving certificates. +// + +package certificates + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// RevocationStatus The current revocation status of the certificate or certificate authority (CA). +type RevocationStatus struct { + + // The time when the certificate or CA was revoked. + TimeRevoked *common.SDKTime `mandatory:"true" json:"timeRevoked"` + + // The reason that the certificate or CA was revoked. + RevocationReason RevocationReasonEnum `mandatory:"true" json:"revocationReason"` +} + +func (m RevocationStatus) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m RevocationStatus) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if _, ok := GetMappingRevocationReasonEnum(string(m.RevocationReason)); !ok && m.RevocationReason != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for RevocationReason: %s. Supported values are: %s.", m.RevocationReason, strings.Join(GetRevocationReasonEnumStringValues(), ","))) + } + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/vendor/github.com/oracle/oci-go-sdk/v65/certificates/validity.go b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/validity.go new file mode 100644 index 00000000000..3eef35e7dec --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/validity.go @@ -0,0 +1,44 @@ +// Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Certificates Service Retrieval API +// +// API for retrieving certificates. +// + +package certificates + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// Validity An object that describes a period of time during which an entity is valid. +type Validity struct { + + // The date on which the certificate validity period begins, expressed in RFC 3339 (https://tools.ietf.org/html/rfc3339) timestamp format. + // Example: `2019-04-03T21:10:29.600Z` + TimeOfValidityNotBefore *common.SDKTime `mandatory:"true" json:"timeOfValidityNotBefore"` + + // The date on which the certificate validity period ends, expressed in RFC 3339 (https://tools.ietf.org/html/rfc3339) timestamp format. + // Example: `2019-04-03T21:10:29.600Z` + TimeOfValidityNotAfter *common.SDKTime `mandatory:"true" json:"timeOfValidityNotAfter"` +} + +func (m Validity) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m Validity) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/vendor/github.com/oracle/oci-go-sdk/v65/certificates/version_stage.go b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/version_stage.go new file mode 100644 index 00000000000..82ac5eb07b2 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/v65/certificates/version_stage.go @@ -0,0 +1,72 @@ +// Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Certificates Service Retrieval API +// +// API for retrieving certificates. +// + +package certificates + +import ( + "strings" +) + +// VersionStageEnum Enum with underlying type: string +type VersionStageEnum string + +// Set of constants representing the allowable values for VersionStageEnum +const ( + VersionStageCurrent VersionStageEnum = "CURRENT" + VersionStagePending VersionStageEnum = "PENDING" + VersionStageLatest VersionStageEnum = "LATEST" + VersionStagePrevious VersionStageEnum = "PREVIOUS" + VersionStageDeprecated VersionStageEnum = "DEPRECATED" + VersionStageFailed VersionStageEnum = "FAILED" +) + +var mappingVersionStageEnum = map[string]VersionStageEnum{ + "CURRENT": VersionStageCurrent, + "PENDING": VersionStagePending, + "LATEST": VersionStageLatest, + "PREVIOUS": VersionStagePrevious, + "DEPRECATED": VersionStageDeprecated, + "FAILED": VersionStageFailed, +} + +var mappingVersionStageEnumLowerCase = map[string]VersionStageEnum{ + "current": VersionStageCurrent, + "pending": VersionStagePending, + "latest": VersionStageLatest, + "previous": VersionStagePrevious, + "deprecated": VersionStageDeprecated, + "failed": VersionStageFailed, +} + +// GetVersionStageEnumValues Enumerates the set of values for VersionStageEnum +func GetVersionStageEnumValues() []VersionStageEnum { + values := make([]VersionStageEnum, 0) + for _, v := range mappingVersionStageEnum { + values = append(values, v) + } + return values +} + +// GetVersionStageEnumStringValues Enumerates the set of values in String for VersionStageEnum +func GetVersionStageEnumStringValues() []string { + return []string{ + "CURRENT", + "PENDING", + "LATEST", + "PREVIOUS", + "DEPRECATED", + "FAILED", + } +} + +// GetMappingVersionStageEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingVersionStageEnum(val string) (VersionStageEnum, bool) { + enum, ok := mappingVersionStageEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/vendor/github.com/zclconf/go-cty/cty/function/stdlib/collection.go b/vendor/github.com/zclconf/go-cty/cty/function/stdlib/collection.go index f50f196e2ca..279a20ee535 100644 --- a/vendor/github.com/zclconf/go-cty/cty/function/stdlib/collection.go +++ b/vendor/github.com/zclconf/go-cty/cty/function/stdlib/collection.go @@ -538,7 +538,7 @@ func flattener(flattenList cty.Value) ([]cty.Value, []cty.ValueMarks, bool) { // Any dynamic types could result in more collections that need to be // flattened, so the type cannot be known. - if val.Type().Equals(cty.DynamicPseudoType) { + if val == cty.DynamicVal { isKnown = false } diff --git a/vendor/github.com/zclconf/go-cty/cty/function/stdlib/csv.go b/vendor/github.com/zclconf/go-cty/cty/function/stdlib/csv.go index 5070a5adf57..339d04dbdbd 100644 --- a/vendor/github.com/zclconf/go-cty/cty/function/stdlib/csv.go +++ b/vendor/github.com/zclconf/go-cty/cty/function/stdlib/csv.go @@ -30,7 +30,7 @@ var CSVDecodeFunc = function.New(&function.Spec{ return cty.DynamicPseudoType, fmt.Errorf("missing header line") } if err != nil { - return cty.DynamicPseudoType, err + return cty.DynamicPseudoType, csvError(err) } atys := make(map[string]cty.Type, len(headers)) @@ -64,7 +64,7 @@ var CSVDecodeFunc = function.New(&function.Spec{ break } if err != nil { - return cty.DynamicVal, err + return cty.DynamicVal, csvError(err) } vals := make(map[string]cty.Value, len(cols)) @@ -91,3 +91,12 @@ var CSVDecodeFunc = function.New(&function.Spec{ func CSVDecode(str cty.Value) (cty.Value, error) { return CSVDecodeFunc.Call([]cty.Value{str}) } + +func csvError(err error) error { + switch err := err.(type) { + case *csv.ParseError: + return fmt.Errorf("CSV parse error on line %d: %w", err.Line, err.Err) + default: + return err + } +} diff --git a/vendor/github.com/zclconf/go-cty/cty/function/stdlib/format.go b/vendor/github.com/zclconf/go-cty/cty/function/stdlib/format.go index 63881f58531..8b17758950c 100644 --- a/vendor/github.com/zclconf/go-cty/cty/function/stdlib/format.go +++ b/vendor/github.com/zclconf/go-cty/cty/function/stdlib/format.go @@ -114,6 +114,8 @@ var FormatListFunc = function.New(&function.Spec{ continue } iterators[i] = arg.ElementIterator() + case arg == cty.DynamicVal: + unknowns[i] = true default: singleVals[i] = arg } diff --git a/vendor/github.com/zclconf/go-cty/cty/function/stdlib/number.go b/vendor/github.com/zclconf/go-cty/cty/function/stdlib/number.go index 7bbe584b0a1..4effeb7bb8d 100644 --- a/vendor/github.com/zclconf/go-cty/cty/function/stdlib/number.go +++ b/vendor/github.com/zclconf/go-cty/cty/function/stdlib/number.go @@ -371,14 +371,21 @@ var CeilFunc = function.New(&function.Spec{ }, Type: function.StaticReturnType(cty.Number), Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { - var val float64 - if err := gocty.FromCtyValue(args[0], &val); err != nil { - return cty.UnknownVal(cty.String), err + f := args[0].AsBigFloat() + + if f.IsInf() { + return cty.NumberVal(f), nil } - if math.IsInf(val, 0) { - return cty.NumberFloatVal(val), nil + + i, acc := f.Int(nil) + switch acc { + case big.Exact, big.Above: + // Done. + case big.Below: + i.Add(i, big.NewInt(1)) } - return cty.NumberIntVal(int64(math.Ceil(val))), nil + + return cty.NumberVal(f.SetInt(i)), nil }, }) @@ -393,14 +400,21 @@ var FloorFunc = function.New(&function.Spec{ }, Type: function.StaticReturnType(cty.Number), Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { - var val float64 - if err := gocty.FromCtyValue(args[0], &val); err != nil { - return cty.UnknownVal(cty.String), err + f := args[0].AsBigFloat() + + if f.IsInf() { + return cty.NumberVal(f), nil } - if math.IsInf(val, 0) { - return cty.NumberFloatVal(val), nil + + i, acc := f.Int(nil) + switch acc { + case big.Exact, big.Below: + // Done. + case big.Above: + i.Sub(i, big.NewInt(1)) } - return cty.NumberIntVal(int64(math.Floor(val))), nil + + return cty.NumberVal(f.SetInt(i)), nil }, }) diff --git a/vendor/github.com/zclconf/go-cty/cty/primitive_type.go b/vendor/github.com/zclconf/go-cty/cty/primitive_type.go index 7b3d1196cd0..603901732b1 100644 --- a/vendor/github.com/zclconf/go-cty/cty/primitive_type.go +++ b/vendor/github.com/zclconf/go-cty/cty/primitive_type.go @@ -52,6 +52,51 @@ func (t primitiveType) GoString() string { } } +// rawNumberEqual is our cty-specific definition of whether two big floats +// underlying cty.Number are "equal" for the purposes of the Value.Equals and +// Value.RawEquals methods. +// +// The built-in equality for big.Float is a direct comparison of the mantissa +// bits and the exponent, but that's too precise a check for cty because we +// routinely send numbers through decimal approximations and back and so +// we only promise to accurately represent the subset of binary floating point +// numbers that can be derived from a decimal string representation. +// +// In respect of the fact that cty only tries to preserve numbers that can +// reasonably be written in JSON documents, we use the string representation of +// a decimal approximation of the number as our comparison, relying on the +// big.Float type's heuristic for discarding extraneous mantissa bits that seem +// likely to only be there as a result of an earlier decimal-to-binary +// approximation during parsing, e.g. in ParseNumberVal. +func rawNumberEqual(a, b *big.Float) bool { + switch { + case (a == nil) != (b == nil): + return false + case a == nil: // b == nil too then, due to previous case + return true + default: + // This format and precision matches that used by cty/json.Marshal, + // and thus achieves our definition of "two numbers are equal if + // we'd use the same JSON serialization for both of them". + const format = 'f' + const prec = -1 + aStr := a.Text(format, prec) + bStr := b.Text(format, prec) + + // The one exception to our rule about equality-by-stringification is + // negative zero, because we want -0 to always be equal to +0. + const posZero = "0" + const negZero = "-0" + if aStr == negZero { + aStr = posZero + } + if bStr == negZero { + bStr = posZero + } + return aStr == bStr + } +} + // Number is the numeric type. Number values are arbitrary-precision // decimal numbers, which can then be converted into Go's various numeric // types only if they are in the appropriate range. diff --git a/vendor/github.com/zclconf/go-cty/cty/value_ops.go b/vendor/github.com/zclconf/go-cty/cty/value_ops.go index 8c37535c885..cdcc1506f01 100644 --- a/vendor/github.com/zclconf/go-cty/cty/value_ops.go +++ b/vendor/github.com/zclconf/go-cty/cty/value_ops.go @@ -116,9 +116,9 @@ func (val Value) GoString() string { // Use RawEquals to compare if two values are equal *ignoring* the // short-circuit rules and the exception for null values. func (val Value) Equals(other Value) Value { - if val.IsMarked() || other.IsMarked() { - val, valMarks := val.Unmark() - other, otherMarks := other.Unmark() + if val.ContainsMarked() || other.ContainsMarked() { + val, valMarks := val.UnmarkDeep() + other, otherMarks := other.UnmarkDeep() return val.Equals(other).WithMarks(valMarks, otherMarks) } @@ -191,7 +191,7 @@ func (val Value) Equals(other Value) Value { switch { case ty == Number: - result = val.v.(*big.Float).Cmp(other.v.(*big.Float)) == 0 + result = rawNumberEqual(val.v.(*big.Float), other.v.(*big.Float)) case ty == Bool: result = val.v.(bool) == other.v.(bool) case ty == String: @@ -1283,9 +1283,7 @@ func (val Value) AsBigFloat() *big.Float { } // Copy the float so that callers can't mutate our internal state - ret := *(val.v.(*big.Float)) - - return &ret + return new(big.Float).Copy(val.v.(*big.Float)) } // AsValueSlice returns a []cty.Value representation of a non-null, non-unknown diff --git a/vendor/github.com/zclconf/go-cty/cty/walk.go b/vendor/github.com/zclconf/go-cty/cty/walk.go index d17f48ccd1e..87ba32e796b 100644 --- a/vendor/github.com/zclconf/go-cty/cty/walk.go +++ b/vendor/github.com/zclconf/go-cty/cty/walk.go @@ -33,10 +33,15 @@ func walk(path Path, val Value, cb func(Path, Value) (bool, error)) error { return nil } + // The callback already got a chance to see the mark in our + // call above, so can safely strip it off here in order to + // visit the child elements, which might still have their own marks. + rawVal, _ := val.Unmark() + ty := val.Type() switch { case ty.IsObjectType(): - for it := val.ElementIterator(); it.Next(); { + for it := rawVal.ElementIterator(); it.Next(); { nameVal, av := it.Element() path := append(path, GetAttrStep{ Name: nameVal.AsString(), @@ -46,8 +51,8 @@ func walk(path Path, val Value, cb func(Path, Value) (bool, error)) error { return err } } - case val.CanIterateElements(): - for it := val.ElementIterator(); it.Next(); { + case rawVal.CanIterateElements(): + for it := rawVal.ElementIterator(); it.Next(); { kv, ev := it.Element() path := append(path, IndexStep{ Key: kv, @@ -134,6 +139,12 @@ func transform(path Path, val Value, t Transformer) (Value, error) { ty := val.Type() var newVal Value + // We need to peel off any marks here so that we can dig around + // inside any collection values. We'll reapply these to any + // new collections we construct, but the transformer's Exit + // method gets the final say on what to do with those. + rawVal, marks := val.Unmark() + switch { case val.IsNull() || !val.IsKnown(): @@ -141,14 +152,14 @@ func transform(path Path, val Value, t Transformer) (Value, error) { newVal = val case ty.IsListType() || ty.IsSetType() || ty.IsTupleType(): - l := val.LengthInt() + l := rawVal.LengthInt() switch l { case 0: // No deep transform for an empty sequence newVal = val default: elems := make([]Value, 0, l) - for it := val.ElementIterator(); it.Next(); { + for it := rawVal.ElementIterator(); it.Next(); { kv, ev := it.Element() path := append(path, IndexStep{ Key: kv, @@ -161,25 +172,25 @@ func transform(path Path, val Value, t Transformer) (Value, error) { } switch { case ty.IsListType(): - newVal = ListVal(elems) + newVal = ListVal(elems).WithMarks(marks) case ty.IsSetType(): - newVal = SetVal(elems) + newVal = SetVal(elems).WithMarks(marks) case ty.IsTupleType(): - newVal = TupleVal(elems) + newVal = TupleVal(elems).WithMarks(marks) default: panic("unknown sequence type") // should never happen because of the case we are in } } case ty.IsMapType(): - l := val.LengthInt() + l := rawVal.LengthInt() switch l { case 0: // No deep transform for an empty map newVal = val default: elems := make(map[string]Value) - for it := val.ElementIterator(); it.Next(); { + for it := rawVal.ElementIterator(); it.Next(); { kv, ev := it.Element() path := append(path, IndexStep{ Key: kv, @@ -190,7 +201,7 @@ func transform(path Path, val Value, t Transformer) (Value, error) { } elems[kv.AsString()] = newEv } - newVal = MapVal(elems) + newVal = MapVal(elems).WithMarks(marks) } case ty.IsObjectType(): @@ -212,7 +223,7 @@ func transform(path Path, val Value, t Transformer) (Value, error) { } newAVs[name] = newAV } - newVal = ObjectVal(newAVs) + newVal = ObjectVal(newAVs).WithMarks(marks) } default: diff --git a/vendor/modules.txt b/vendor/modules.txt index 94a44d10609..74faec27098 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -99,8 +99,8 @@ github.com/golang/protobuf/ptypes/any github.com/golang/protobuf/ptypes/duration github.com/golang/protobuf/ptypes/empty github.com/golang/protobuf/ptypes/timestamp -# github.com/google/go-cmp v0.5.6 -## explicit; go 1.8 +# github.com/google/go-cmp v0.5.9 +## explicit; go 1.13 github.com/google/go-cmp/cmp github.com/google/go-cmp/cmp/internal/diff github.com/google/go-cmp/cmp/internal/flags @@ -146,7 +146,7 @@ github.com/hashicorp/go-safetemp # github.com/hashicorp/go-uuid v1.0.1 ## explicit github.com/hashicorp/go-uuid -# github.com/hashicorp/go-version v1.3.0 +# github.com/hashicorp/go-version v1.6.0 ## explicit github.com/hashicorp/go-version # github.com/hashicorp/hcl/v2 v2.8.2 @@ -167,7 +167,7 @@ github.com/hashicorp/logutils github.com/hashicorp/terraform-exec/internal/version github.com/hashicorp/terraform-exec/tfexec github.com/hashicorp/terraform-exec/tfinstall -# github.com/hashicorp/terraform-json v0.12.0 +# github.com/hashicorp/terraform-json v0.15.0 ## explicit; go 1.13 github.com/hashicorp/terraform-json # github.com/hashicorp/terraform-plugin-go v0.3.0 @@ -270,6 +270,7 @@ github.com/oracle/oci-go-sdk/v65/bastion github.com/oracle/oci-go-sdk/v65/bds github.com/oracle/oci-go-sdk/v65/blockchain github.com/oracle/oci-go-sdk/v65/budget +github.com/oracle/oci-go-sdk/v65/certificates github.com/oracle/oci-go-sdk/v65/certificatesmanagement github.com/oracle/oci-go-sdk/v65/cloudbridge github.com/oracle/oci-go-sdk/v65/cloudguard @@ -382,7 +383,7 @@ github.com/ulikunitz/xz/lzma ## explicit github.com/vmihailenco/msgpack github.com/vmihailenco/msgpack/codes -# github.com/zclconf/go-cty v1.8.4 +# github.com/zclconf/go-cty v1.10.0 ## explicit; go 1.12 github.com/zclconf/go-cty/cty github.com/zclconf/go-cty/cty/convert diff --git a/website/docs/d/certificates_certificate_authority_bundle.html.markdown b/website/docs/d/certificates_certificate_authority_bundle.html.markdown new file mode 100644 index 00000000000..01b5d2a81a4 --- /dev/null +++ b/website/docs/d/certificates_certificate_authority_bundle.html.markdown @@ -0,0 +1,71 @@ +--- +subcategory: "Certificates" +layout: "oci" +page_title: "Oracle Cloud Infrastructure: oci_certificates_certificate_authority_bundle" +sidebar_current: "docs-oci-datasource-certificates-certificate_authority_bundle" +description: |- +Provides details about a certificate authority bundle in Oracle Cloud Infrastructure Certificates Retrieval service +--- + +# Data Source: oci_certificates_certificate_bundle +This data source provides details about a specific certificate authority bundle in Oracle Cloud Infrastructure Certificates Retrieval service. + +Gets details about the specified certificate authority bundle. + +## Example Usage + +```hcl +data "oci_certificates_certificate_authority_bundle" "test_certificate_authority_bundle" { + #Required + certificate_authority_id = oci_certificates_management_certificate_authority.test_certificate_authority.id + + #Optional + certificate_version_name = oci_certificates_management_certificate_authority.test_certificate_authority.current_version.version_name + stage = "CURRENT" + version_number = oci_certificates_management_certificate_authority.test_certificate_authority.current_version.version_number +} +``` + +## Argument Reference + +The following arguments are supported: + +* `certificate_authority_id` - (Required) The OCID of the certificate authority (CA). +* `certificate_version_name` - (Optional) The name of the certificate authority (CA). (This might be referred to as the +name of the CA version, as every CA consists of at least one version.) Names are unique across versions of a given CA. +* `stage` - (Optional) The rotation state of the certificate authority version. Valid values are: `CURRENT`, `PENDING`, +`LATEST`, `PREVIOUS` or `DEPRECATED`. +* `version_number` - (Optional) The version number of the certificate authority (CA). + +## Attributes Reference + +The following attributes are exported: + +* `cert_chain_pem` - The certificate chain (in PEM format) for this CA version. +* `certificate_authority_id` - The OCID of the certificate authority (CA). +* `certificate_authority_name` - The name of the CA. +* `certificate_pem` - The certificate (in PEM format) for this CA version. +* `revocation_status` - The revocation status of the certificate. +* `serial_number` - A unique certificate identifier used in certificate revocation tracking, formatted as octets. +* `stages` - A list of rotation states for this CA. +* `time_created` - An optional property indicating when the certificate version was created, expressed in RFC 3339 +timestamp format. +* `validity` - The validity of the certificate. +* `version_name` - The name of the CA version. +* `version_number` - The version number of the CA. + +### Revocation Status Reference + +The following attributes are exported: + +* `revocation_reason` - The reason that the CA was revoked. +* `time_revoked` - The time when the CA was revoked. + +### Validity Reference + +The following attributes are exported: + +* `time_of_validity_not_after` - The date on which the CA validity period ends, expressed in RFC 3339 timestamp +format. +* `time_of_validity_not_before` - The date on which the CA validity period begins, expressed in RFC 3339 +timestamp format. diff --git a/website/docs/d/certificates_certificate_bundle.html.markdown b/website/docs/d/certificates_certificate_bundle.html.markdown new file mode 100644 index 00000000000..b0d0a5e1805 --- /dev/null +++ b/website/docs/d/certificates_certificate_bundle.html.markdown @@ -0,0 +1,82 @@ +--- +subcategory: "Certificates" +layout: "oci" +page_title: "Oracle Cloud Infrastructure: oci_certificates_certificate_bundle" +sidebar_current: "docs-oci-datasource-certificates-certificate_bundle" +description: |- +Provides details about a certificate bundle in Oracle Cloud Infrastructure Certificates Retrieval service +--- + +# Data Source: oci_certificates_certificate_bundle +This data source provides details about a specific certificate bundle in Oracle Cloud Infrastructure Certificates Retrieval service. + +Gets details about the specified certificate bundle. + +## Example Usage + +```hcl +data "oci_certificates_certificate_bundle" "test_certificate_bundle" { + #Required + certificate_id = oci_certificates_management_certificate.test_certificate.id + + #Optional + certificate_bundle_type = "CERTIFICATE_CONTENT_WITH_PRIVATE_KEY" + certificate_version_name = oci_certificates_management_certificate.test_certificate.current_version.version_name + stage = "CURRENT" + version_number = oci_certificates_management_certificate.test_certificate.current_version.version_number +} +``` + +## Argument Reference + +The following arguments are supported: + +* `certificate_id` - (Required) The OCID of the certificate. +* `certificate_bundle_type` - (Optional) The type of certificate bundle. By default, the private key fields are not +returned. When querying for certificate bundles, to return results with certificate contents, the private key in PEM +format, and the private key passphrase, specify the value of this parameter as CERTIFICATE_CONTENT_WITH_PRIVATE_KEY. +Valid values are: `CERTIFICATE_CONTENT_PUBLIC_ONLY` or `CERTIFICATE_CONTENT_WITH_PRIVATE_KEY`. +* `certificate_version_name` - (Optional) The name of the certificate. (This might be referred to as the name of the +certificate version, as every certificate consists of at least one version.) Names are unique across versions of a +given certificate. +* `stage` - (Optional) The rotation state of the certificate version. Valid values are: `CURRENT`, `PENDING`, `LATEST`, +`PREVIOUS` or `DEPRECATED`. +* `version_number` - (Optional) The version number of the certificate. + +## Attributes Reference + +The following attributes are exported: + +* `cert_chain_pem` - The certificate chain (in PEM format) for the certificate bundle. +* `certificate_bundle_type` - The type of certificate bundle, which indicates whether the private key fields are included. +* `certificate_id` - The OCID of the certificate. +* `certificate_name` - The name of the certificate. +* `certificate_pem` - The certificate (in PEM format) for the certificate bundle. +* `private_key_pem` - The private key (in PEM format) for the certificate. This is only set if `certificate_bundle_type` +is set to `CERTIFICATE_CONTENT_WITH_PRIVATE_KEY`. +* `private_key_pem_passphrase` - The passphrase for the private key. This is only set if `certificate_bundle_type` +is set to `CERTIFICATE_CONTENT_WITH_PRIVATE_KEY`. +* `revocation_status` - The revocation status of the certificate. +* `serial_number` - A unique certificate identifier used in certificate revocation tracking, formatted as octets. +* `stages` - A list of rotation states for the certificate bundle. +* `time_created` - An optional property indicating when the certificate version was created, expressed in RFC 3339 +timestamp format. +* `validity` - The validity of the certificate. +* `version_name` - The name of the certificate version. +* `version_number` - The version number of the certificate. + +### Revocation Status Reference + +The following attributes are exported: + +* `revocation_reason` - The reason that the certificate was revoked. +* `time_revoked` - The time when the certificate was revoked. + +### Validity Reference + +The following attributes are exported: + +* `time_of_validity_not_after` - The date on which the certificate validity period ends, expressed in RFC 3339 timestamp +format. +* `time_of_validity_not_before` - The date on which the certificate validity period begins, expressed in RFC 3339 +timestamp format.