From 515ec56470e963778eed62ddc973dd680b5a32f0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 7 May 2024 04:19:36 +0000 Subject: [PATCH] feat(api): update via SDK Studio (#1963) --- accounts/member.go | 10 +- acm/totaltls.go | 16 +-- acm/totaltls_test.go | 2 +- addressing/addressmap.go | 14 +-- api.md | 25 ++-- client_certificates/clientcertificate.go | 22 +--- custom_certificates/customcertificate.go | 19 +++ custom_hostnames/customhostname.go | 12 +- custom_hostnames/customhostname_test.go | 4 +- origin_ca_certificates/origincacertificate.go | 8 +- .../origincacertificate_test.go | 4 +- ssl/certificatepack.go | 114 +++++++++--------- ssl/certificatepackorder.go | 2 +- ssl/verification.go | 2 +- user/organization.go | 4 +- 15 files changed, 130 insertions(+), 128 deletions(-) diff --git a/accounts/member.go b/accounts/member.go index f6f2d5f8594..5d4a833b983 100644 --- a/accounts/member.go +++ b/accounts/member.go @@ -110,16 +110,16 @@ func (r *MemberService) Get(ctx context.Context, memberID string, query MemberGe } // Whether the user is a member of the organization or has an inivitation pending. -type MemberStatus string +type Status string const ( - MemberStatusMember MemberStatus = "member" - MemberStatusInvited MemberStatus = "invited" + StatusMember Status = "member" + StatusInvited Status = "invited" ) -func (r MemberStatus) IsKnown() bool { +func (r Status) IsKnown() bool { switch r { - case MemberStatusMember, MemberStatusInvited: + case StatusMember, StatusInvited: return true } return false diff --git a/acm/totaltls.go b/acm/totaltls.go index ae6836eeeaa..d29d7a8c614 100644 --- a/acm/totaltls.go +++ b/acm/totaltls.go @@ -58,16 +58,16 @@ func (r *TotalTLSService) Get(ctx context.Context, query TotalTLSGetParams, opts } // The Certificate Authority that Total TLS certificates will be issued through. -type TotalTLSCertificateAuthority string +type CertificateAuthority string const ( - TotalTLSCertificateAuthorityGoogle TotalTLSCertificateAuthority = "google" - TotalTLSCertificateAuthorityLetsEncrypt TotalTLSCertificateAuthority = "lets_encrypt" + CertificateAuthorityGoogle CertificateAuthority = "google" + CertificateAuthorityLetsEncrypt CertificateAuthority = "lets_encrypt" ) -func (r TotalTLSCertificateAuthority) IsKnown() bool { +func (r CertificateAuthority) IsKnown() bool { switch r { - case TotalTLSCertificateAuthorityGoogle, TotalTLSCertificateAuthorityLetsEncrypt: + case CertificateAuthorityGoogle, CertificateAuthorityLetsEncrypt: return true } return false @@ -75,7 +75,7 @@ func (r TotalTLSCertificateAuthority) IsKnown() bool { type TotalTLSNewResponse struct { // The Certificate Authority that Total TLS certificates will be issued through. - CertificateAuthority TotalTLSCertificateAuthority `json:"certificate_authority"` + CertificateAuthority CertificateAuthority `json:"certificate_authority"` // If enabled, Total TLS will order a hostname specific TLS certificate for any // proxied A, AAAA, or CNAME record in your zone. Enabled bool `json:"enabled"` @@ -119,7 +119,7 @@ func (r TotalTLSNewResponseValidityDays) IsKnown() bool { type TotalTLSGetResponse struct { // The Certificate Authority that Total TLS certificates will be issued through. - CertificateAuthority TotalTLSCertificateAuthority `json:"certificate_authority"` + CertificateAuthority CertificateAuthority `json:"certificate_authority"` // If enabled, Total TLS will order a hostname specific TLS certificate for any // proxied A, AAAA, or CNAME record in your zone. Enabled bool `json:"enabled"` @@ -168,7 +168,7 @@ type TotalTLSNewParams struct { // proxied A, AAAA, or CNAME record in your zone. Enabled param.Field[bool] `json:"enabled,required"` // The Certificate Authority that Total TLS certificates will be issued through. - CertificateAuthority param.Field[TotalTLSCertificateAuthority] `json:"certificate_authority"` + CertificateAuthority param.Field[CertificateAuthority] `json:"certificate_authority"` } func (r TotalTLSNewParams) MarshalJSON() (data []byte, err error) { diff --git a/acm/totaltls_test.go b/acm/totaltls_test.go index 58acf876d7d..4dd85e14508 100644 --- a/acm/totaltls_test.go +++ b/acm/totaltls_test.go @@ -30,7 +30,7 @@ func TestTotalTLSNewWithOptionalParams(t *testing.T) { _, err := client.ACM.TotalTLS.New(context.TODO(), acm.TotalTLSNewParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Enabled: cloudflare.F(true), - CertificateAuthority: cloudflare.F(acm.TotalTLSCertificateAuthorityGoogle), + CertificateAuthority: cloudflare.F(acm.CertificateAuthorityGoogle), }) if err != nil { var apierr *cloudflare.Error diff --git a/addressing/addressmap.go b/addressing/addressmap.go index 5f5bed06479..e1df0209c8f 100644 --- a/addressing/addressmap.go +++ b/addressing/addressmap.go @@ -164,16 +164,16 @@ func (r addressMapJSON) RawJSON() string { } // The type of the membership. -type AddressMapKind string +type Kind string const ( - AddressMapKindZone AddressMapKind = "zone" - AddressMapKindAccount AddressMapKind = "account" + KindZone Kind = "zone" + KindAccount Kind = "account" ) -func (r AddressMapKind) IsKnown() bool { +func (r Kind) IsKnown() bool { switch r { - case AddressMapKindZone, AddressMapKindAccount: + case KindZone, KindAccount: return true } return false @@ -266,7 +266,7 @@ type AddressMapNewResponseMembership struct { // Identifier Identifier string `json:"identifier"` // The type of the membership. - Kind AddressMapKind `json:"kind"` + Kind Kind `json:"kind"` JSON addressMapNewResponseMembershipJSON `json:"-"` } @@ -378,7 +378,7 @@ type AddressMapGetResponseMembership struct { // Identifier Identifier string `json:"identifier"` // The type of the membership. - Kind AddressMapKind `json:"kind"` + Kind Kind `json:"kind"` JSON addressMapGetResponseMembershipJSON `json:"-"` } diff --git a/api.md b/api.md index 6c879c8f871..3f3395ce991 100644 --- a/api.md +++ b/api.md @@ -39,7 +39,7 @@ Methods: Response Types: -- accounts.MemberStatus +- accounts.Status - accounts.UserWithInviteCode - accounts.MemberListResponse - accounts.MemberDeleteResponse @@ -1165,19 +1165,19 @@ Methods: Params Types: -- ssl.CertificatePackCA -- ssl.CertificatePackRequestType -- ssl.CertificatePackRequestValidity +- ssl.CertificateAuthority - ssl.HostParam +- ssl.RequestType +- ssl.RequestValidity Response Types: -- ssl.CertificatePackCA -- ssl.CertificatePackRequestType -- ssl.CertificatePackRequestValidity -- ssl.CertificatePackStatus -- ssl.CertificatePackValidationMethod +- ssl.CertificateAuthority - ssl.Host +- ssl.RequestType +- ssl.RequestValidity +- ssl.Status +- ssl.ValidationMethod - ssl.CertificatePackListResponse - ssl.CertificatePackDeleteResponse - ssl.CertificatePackEditResponse @@ -1272,11 +1272,11 @@ Methods: Params Types: -- acm.TotalTLSCertificateAuthority +- acm.CertificateAuthority Response Types: -- acm.TotalTLSCertificateAuthority +- acm.CertificateAuthority - acm.TotalTLSNewResponse - acm.TotalTLSGetResponse @@ -1376,6 +1376,7 @@ Response Types: - custom_certificates.CustomCertificate - custom_certificates.GeoRestrictions +- custom_certificates.Status - custom_certificates.CustomCertificateNewResponseUnion - custom_certificates.CustomCertificateDeleteResponse - custom_certificates.CustomCertificateEditResponseUnion @@ -2995,7 +2996,7 @@ Methods: Response Types: - addressing.AddressMap -- addressing.AddressMapKind +- addressing.Kind - addressing.AddressMapNewResponse - addressing.AddressMapDeleteResponse - addressing.AddressMapGetResponse diff --git a/client_certificates/clientcertificate.go b/client_certificates/clientcertificate.go index 799a2033f52..5069f10323f 100644 --- a/client_certificates/clientcertificate.go +++ b/client_certificates/clientcertificate.go @@ -8,6 +8,7 @@ import ( "net/http" "net/url" + "github.com/cloudflare/cloudflare-go/v2/custom_certificates" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/pagination" @@ -149,7 +150,7 @@ type ClientCertificate struct { State string `json:"state"` // Client Certificates may be active or revoked, and the pending_reactivation or // pending_revocation represent in-progress asynchronous transitions - Status ClientCertificateStatus `json:"status"` + Status custom_certificates.Status `json:"status"` // The number of days the Client Certificate will be valid after the issued_on date ValidityDays int64 `json:"validity_days"` JSON clientCertificateJSON `json:"-"` @@ -212,25 +213,6 @@ func (r clientCertificateCertificateAuthorityJSON) RawJSON() string { return r.raw } -// Client Certificates may be active or revoked, and the pending_reactivation or -// pending_revocation represent in-progress asynchronous transitions -type ClientCertificateStatus string - -const ( - ClientCertificateStatusActive ClientCertificateStatus = "active" - ClientCertificateStatusPendingReactivation ClientCertificateStatus = "pending_reactivation" - ClientCertificateStatusPendingRevocation ClientCertificateStatus = "pending_revocation" - ClientCertificateStatusRevoked ClientCertificateStatus = "revoked" -) - -func (r ClientCertificateStatus) IsKnown() bool { - switch r { - case ClientCertificateStatusActive, ClientCertificateStatusPendingReactivation, ClientCertificateStatusPendingRevocation, ClientCertificateStatusRevoked: - return true - } - return false -} - type ClientCertificateNewParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` diff --git a/custom_certificates/customcertificate.go b/custom_certificates/customcertificate.go index 9c06f332710..6b04f11e558 100644 --- a/custom_certificates/customcertificate.go +++ b/custom_certificates/customcertificate.go @@ -279,6 +279,25 @@ func (r GeoRestrictionsParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +// Client Certificates may be active or revoked, and the pending_reactivation or +// pending_revocation represent in-progress asynchronous transitions +type Status string + +const ( + StatusActive Status = "active" + StatusPendingReactivation Status = "pending_reactivation" + StatusPendingRevocation Status = "pending_revocation" + StatusRevoked Status = "revoked" +) + +func (r Status) IsKnown() bool { + switch r { + case StatusActive, StatusPendingReactivation, StatusPendingRevocation, StatusRevoked: + return true + } + return false +} + // Union satisfied by [custom_certificates.CustomCertificateNewResponseUnknown] or // [shared.UnionString]. type CustomCertificateNewResponseUnion interface { diff --git a/custom_hostnames/customhostname.go b/custom_hostnames/customhostname.go index 54d19acd62c..ec1d8d8f81a 100644 --- a/custom_hostnames/customhostname.go +++ b/custom_hostnames/customhostname.go @@ -239,7 +239,7 @@ type CustomHostnameNewResponseSSL struct { // chain, but does not otherwise modify it. BundleMethod BundleMethod `json:"bundle_method"` // The Certificate Authority that will issue the certificate - CertificateAuthority ssl.CertificatePackCA `json:"certificate_authority"` + CertificateAuthority ssl.CertificateAuthority `json:"certificate_authority"` // If a custom uploaded certificate is used. CustomCertificate string `json:"custom_certificate"` // The identifier for the Custom CSR that was used. @@ -701,7 +701,7 @@ type CustomHostnameListResponseSSL struct { // chain, but does not otherwise modify it. BundleMethod BundleMethod `json:"bundle_method"` // The Certificate Authority that will issue the certificate - CertificateAuthority ssl.CertificatePackCA `json:"certificate_authority"` + CertificateAuthority ssl.CertificateAuthority `json:"certificate_authority"` // If a custom uploaded certificate is used. CustomCertificate string `json:"custom_certificate"` // The identifier for the Custom CSR that was used. @@ -1185,7 +1185,7 @@ type CustomHostnameEditResponseSSL struct { // chain, but does not otherwise modify it. BundleMethod BundleMethod `json:"bundle_method"` // The Certificate Authority that will issue the certificate - CertificateAuthority ssl.CertificatePackCA `json:"certificate_authority"` + CertificateAuthority ssl.CertificateAuthority `json:"certificate_authority"` // If a custom uploaded certificate is used. CustomCertificate string `json:"custom_certificate"` // The identifier for the Custom CSR that was used. @@ -1647,7 +1647,7 @@ type CustomHostnameGetResponseSSL struct { // chain, but does not otherwise modify it. BundleMethod BundleMethod `json:"bundle_method"` // The Certificate Authority that will issue the certificate - CertificateAuthority ssl.CertificatePackCA `json:"certificate_authority"` + CertificateAuthority ssl.CertificateAuthority `json:"certificate_authority"` // If a custom uploaded certificate is used. CustomCertificate string `json:"custom_certificate"` // The identifier for the Custom CSR that was used. @@ -2064,7 +2064,7 @@ type CustomHostnameNewParamsSSL struct { // chain, but does not otherwise modify it. BundleMethod param.Field[BundleMethod] `json:"bundle_method"` // The Certificate Authority that will issue the certificate - CertificateAuthority param.Field[ssl.CertificatePackCA] `json:"certificate_authority"` + CertificateAuthority param.Field[ssl.CertificateAuthority] `json:"certificate_authority"` // If a custom uploaded certificate is used. CustomCertificate param.Field[string] `json:"custom_certificate"` // The key for a custom uploaded certificate. @@ -2346,7 +2346,7 @@ type CustomHostnameEditParamsSSL struct { // chain, but does not otherwise modify it. BundleMethod param.Field[BundleMethod] `json:"bundle_method"` // The Certificate Authority that will issue the certificate - CertificateAuthority param.Field[ssl.CertificatePackCA] `json:"certificate_authority"` + CertificateAuthority param.Field[ssl.CertificateAuthority] `json:"certificate_authority"` // If a custom uploaded certificate is used. CustomCertificate param.Field[string] `json:"custom_certificate"` // The key for a custom uploaded certificate. diff --git a/custom_hostnames/customhostname_test.go b/custom_hostnames/customhostname_test.go index 555dbd77e75..e76d1c95be1 100644 --- a/custom_hostnames/customhostname_test.go +++ b/custom_hostnames/customhostname_test.go @@ -33,7 +33,7 @@ func TestCustomHostnameNewWithOptionalParams(t *testing.T) { Hostname: cloudflare.F("app.example.com"), SSL: cloudflare.F(custom_hostnames.CustomHostnameNewParamsSSL{ BundleMethod: cloudflare.F(custom_hostnames.BundleMethodUbiquitous), - CertificateAuthority: cloudflare.F(ssl.CertificatePackCAGoogle), + CertificateAuthority: cloudflare.F(ssl.CertificateAuthorityGoogle), CustomCertificate: cloudflare.F("-----BEGIN CERTIFICATE-----\\nMIIFJDCCBAygAwIBAgIQD0ifmj/Yi5NP/2gdUySbfzANBgkqhkiG9w0BAQsFADBN\\nMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMScwJQYDVQQDEx5E...SzSHfXp5lnu/3V08I72q1QNzOCgY1XeL4GKVcj4or6cT6tX6oJH7ePPmfrBfqI/O\\nOeH8gMJ+FuwtXYEPa4hBf38M5eU5xWG7\\n-----END CERTIFICATE-----\\n"), CustomKey: cloudflare.F("-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmG\ndtcGbg/1CGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKn\nabIRuGvBKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpid\ntnKX/a+50GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+py\nFxIXjbEIdZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pE\newooaeO2izNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABAoIBACb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yVT0tEQS\nfhRqaQKBgAcWPokmJ7EbYQGeMbS7HC8eWO/RyamlnSffdCdSc7ue3zdVJxpAkQ8W\nqu80pEIF6raIQfAf8MXiiZ7auFOSnHQTXUbhCpvDLKi0Mwq3G8Pl07l+2s6dQG6T\nlv6XTQaMyf6n1yjzL+fzDrH3qXMxHMO/b13EePXpDMpY7HQpoLDi\n-----END RSA PRIVATE KEY-----\n"), Method: cloudflare.F(custom_hostnames.DCVMethodHTTP), @@ -146,7 +146,7 @@ func TestCustomHostnameEditWithOptionalParams(t *testing.T) { CustomOriginSNI: cloudflare.F("sni.example.com"), SSL: cloudflare.F(custom_hostnames.CustomHostnameEditParamsSSL{ BundleMethod: cloudflare.F(custom_hostnames.BundleMethodUbiquitous), - CertificateAuthority: cloudflare.F(ssl.CertificatePackCAGoogle), + CertificateAuthority: cloudflare.F(ssl.CertificateAuthorityGoogle), CustomCertificate: cloudflare.F("-----BEGIN CERTIFICATE-----\\nMIIFJDCCBAygAwIBAgIQD0ifmj/Yi5NP/2gdUySbfzANBgkqhkiG9w0BAQsFADBN\\nMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMScwJQYDVQQDEx5E...SzSHfXp5lnu/3V08I72q1QNzOCgY1XeL4GKVcj4or6cT6tX6oJH7ePPmfrBfqI/O\\nOeH8gMJ+FuwtXYEPa4hBf38M5eU5xWG7\\n-----END CERTIFICATE-----\\n"), CustomKey: cloudflare.F("-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmG\ndtcGbg/1CGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKn\nabIRuGvBKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpid\ntnKX/a+50GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+py\nFx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9z0cuVB6CiL8DbdK5kwY9pGNr8HUCI03iHkW6Zs+0L0YmihfEVe\nPG19PSzK9CaDdhD9KFZSbLyVFmWfxOt50H7YRTTiPMgjyFpfi5j2q348yVT0tEQS\nfhRqaQKBgAcWPokmJ7EbYQGeMbS7HC8eWO/RyamlnSffdCdSc7ue3zdVJxpAkQ8W\nqu80pEIF6raIQfAf8MXiiZ7auFOSnHQTXUbhCpvDLKi0Mwq3G8Pl07l+2s6dQG6T\nlv6XTQaMyf6n1yjzL+fzDrH3qXMxHMO/b13EePXpDMpY7HQpoLDi\n-----END RSA PRIVATE KEY-----\n"), Method: cloudflare.F(custom_hostnames.DCVMethodHTTP), diff --git a/origin_ca_certificates/origincacertificate.go b/origin_ca_certificates/origincacertificate.go index e8e22547b26..4ac8f75f116 100644 --- a/origin_ca_certificates/origincacertificate.go +++ b/origin_ca_certificates/origincacertificate.go @@ -118,9 +118,9 @@ type OriginCACertificate struct { Hostnames []interface{} `json:"hostnames,required"` // Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), // or "keyless-certificate" (for Keyless SSL servers). - RequestType ssl.CertificatePackRequestType `json:"request_type,required"` + RequestType ssl.RequestType `json:"request_type,required"` // The number of days for which the certificate should be valid. - RequestedValidity ssl.CertificatePackRequestValidity `json:"requested_validity,required"` + RequestedValidity ssl.RequestValidity `json:"requested_validity,required"` // Identifier ID string `json:"id"` // The Origin CA certificate. Will be newline-encoded. @@ -218,9 +218,9 @@ type OriginCACertificateNewParams struct { Hostnames param.Field[[]interface{}] `json:"hostnames"` // Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), // or "keyless-certificate" (for Keyless SSL servers). - RequestType param.Field[ssl.CertificatePackRequestType] `json:"request_type"` + RequestType param.Field[ssl.RequestType] `json:"request_type"` // The number of days for which the certificate should be valid. - RequestedValidity param.Field[ssl.CertificatePackRequestValidity] `json:"requested_validity"` + RequestedValidity param.Field[ssl.RequestValidity] `json:"requested_validity"` } func (r OriginCACertificateNewParams) MarshalJSON() (data []byte, err error) { diff --git a/origin_ca_certificates/origincacertificate_test.go b/origin_ca_certificates/origincacertificate_test.go index da3b1bede75..32dba76844e 100644 --- a/origin_ca_certificates/origincacertificate_test.go +++ b/origin_ca_certificates/origincacertificate_test.go @@ -31,8 +31,8 @@ func TestOriginCACertificateNewWithOptionalParams(t *testing.T) { _, err := client.OriginCACertificates.New(context.TODO(), origin_ca_certificates.OriginCACertificateNewParams{ Csr: cloudflare.F("-----BEGIN CERTIFICATE REQUEST-----\nMIICxzCCAa8CAQAwSDELMAkGA1UEBhMCVVMxFjAUBgNVBAgTDVNhbiBGcmFuY2lz\nY28xCzAJBgNVBAcTAkNBMRQwEgYDVQQDEwtleGFtcGxlLm5ldDCCASIwDQYJKoZI\nhvcNAQEBBQADggEPADCCAQoCggEBALxejtu4b+jPdFeFi6OUsye8TYJQBm3WfCvL\nHu5EvijMO/4Z2TImwASbwUF7Ir8OLgH+mGlQZeqyNvGoSOMEaZVXcYfpR1hlVak8\n4GGVr+04IGfOCqaBokaBFIwzclGZbzKmLGwIQioNxGfqFm6RGYGA3be2Je2iseBc\nN8GV1wYmvYE0RR+yWweJCTJ157exyRzu7sVxaEW9F87zBQLyOnwXc64rflXslRqi\ng7F7w5IaQYOl8yvmk/jEPCAha7fkiUfEpj4N12+oPRiMvleJF98chxjD4MH39c5I\nuOslULhrWunfh7GB1jwWNA9y44H0snrf+xvoy2TcHmxvma9Eln8CAwEAAaA6MDgG\nCSqGSIb3DQEJDjErMCkwJwYDVR0RBCAwHoILZXhhbXBsZS5uZXSCD3d3dy5leGFt\ncGxlLm5ldDANBgkqhkiG9w0BAQsFAAOCAQEAcBaX6dOnI8ncARrI9ZSF2AJX+8mx\npTHY2+Y2C0VvrVDGMtbBRH8R9yMbqWtlxeeNGf//LeMkSKSFa4kbpdx226lfui8/\nauRDBTJGx2R1ccUxmLZXx4my0W5iIMxunu+kez+BDlu7bTT2io0uXMRHue4i6quH\nyc5ibxvbJMjR7dqbcanVE10/34oprzXQsJ/VmSuZNXtjbtSKDlmcpw6To/eeAJ+J\nhXykcUihvHyG4A1m2R6qpANBjnA0pHexfwM/SgfzvpbvUg0T1ubmer8BgTwCKIWs\ndcWYTthM51JIqRBfNqy4QcBnX+GY05yltEEswQI55wdiS3CjTTA67sdbcQ==\n-----END CERTIFICATE REQUEST-----"), Hostnames: cloudflare.F([]interface{}{"example.com", "*.example.com"}), - RequestType: cloudflare.F(ssl.CertificatePackRequestTypeOriginRsa), - RequestedValidity: cloudflare.F(ssl.CertificatePackRequestValidity5475), + RequestType: cloudflare.F(ssl.RequestTypeOriginRsa), + RequestedValidity: cloudflare.F(ssl.RequestValidity5475), }) if err != nil { var apierr *cloudflare.Error diff --git a/ssl/certificatepack.go b/ssl/certificatepack.go index c59935d18e4..c5c873aa60a 100644 --- a/ssl/certificatepack.go +++ b/ssl/certificatepack.go @@ -106,117 +106,117 @@ func (r *CertificatePackService) Get(ctx context.Context, certificatePackID stri } // The Certificate Authority that will issue the certificate -type CertificatePackCA string +type CertificateAuthority string const ( - CertificatePackCADigicert CertificatePackCA = "digicert" - CertificatePackCAGoogle CertificatePackCA = "google" - CertificatePackCALetsEncrypt CertificatePackCA = "lets_encrypt" + CertificateAuthorityDigicert CertificateAuthority = "digicert" + CertificateAuthorityGoogle CertificateAuthority = "google" + CertificateAuthorityLetsEncrypt CertificateAuthority = "lets_encrypt" ) -func (r CertificatePackCA) IsKnown() bool { +func (r CertificateAuthority) IsKnown() bool { switch r { - case CertificatePackCADigicert, CertificatePackCAGoogle, CertificatePackCALetsEncrypt: + case CertificateAuthorityDigicert, CertificateAuthorityGoogle, CertificateAuthorityLetsEncrypt: return true } return false } +type Host = string + +type HostParam = string + // Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), // or "keyless-certificate" (for Keyless SSL servers). -type CertificatePackRequestType string +type RequestType string const ( - CertificatePackRequestTypeOriginRsa CertificatePackRequestType = "origin-rsa" - CertificatePackRequestTypeOriginEcc CertificatePackRequestType = "origin-ecc" - CertificatePackRequestTypeKeylessCertificate CertificatePackRequestType = "keyless-certificate" + RequestTypeOriginRsa RequestType = "origin-rsa" + RequestTypeOriginEcc RequestType = "origin-ecc" + RequestTypeKeylessCertificate RequestType = "keyless-certificate" ) -func (r CertificatePackRequestType) IsKnown() bool { +func (r RequestType) IsKnown() bool { switch r { - case CertificatePackRequestTypeOriginRsa, CertificatePackRequestTypeOriginEcc, CertificatePackRequestTypeKeylessCertificate: + case RequestTypeOriginRsa, RequestTypeOriginEcc, RequestTypeKeylessCertificate: return true } return false } // The number of days for which the certificate should be valid. -type CertificatePackRequestValidity float64 +type RequestValidity float64 const ( - CertificatePackRequestValidity7 CertificatePackRequestValidity = 7 - CertificatePackRequestValidity30 CertificatePackRequestValidity = 30 - CertificatePackRequestValidity90 CertificatePackRequestValidity = 90 - CertificatePackRequestValidity365 CertificatePackRequestValidity = 365 - CertificatePackRequestValidity730 CertificatePackRequestValidity = 730 - CertificatePackRequestValidity1095 CertificatePackRequestValidity = 1095 - CertificatePackRequestValidity5475 CertificatePackRequestValidity = 5475 + RequestValidity7 RequestValidity = 7 + RequestValidity30 RequestValidity = 30 + RequestValidity90 RequestValidity = 90 + RequestValidity365 RequestValidity = 365 + RequestValidity730 RequestValidity = 730 + RequestValidity1095 RequestValidity = 1095 + RequestValidity5475 RequestValidity = 5475 ) -func (r CertificatePackRequestValidity) IsKnown() bool { +func (r RequestValidity) IsKnown() bool { switch r { - case CertificatePackRequestValidity7, CertificatePackRequestValidity30, CertificatePackRequestValidity90, CertificatePackRequestValidity365, CertificatePackRequestValidity730, CertificatePackRequestValidity1095, CertificatePackRequestValidity5475: + case RequestValidity7, RequestValidity30, RequestValidity90, RequestValidity365, RequestValidity730, RequestValidity1095, RequestValidity5475: return true } return false } // Status of certificate pack. -type CertificatePackStatus string +type Status string const ( - CertificatePackStatusInitializing CertificatePackStatus = "initializing" - CertificatePackStatusPendingValidation CertificatePackStatus = "pending_validation" - CertificatePackStatusDeleted CertificatePackStatus = "deleted" - CertificatePackStatusPendingIssuance CertificatePackStatus = "pending_issuance" - CertificatePackStatusPendingDeployment CertificatePackStatus = "pending_deployment" - CertificatePackStatusPendingDeletion CertificatePackStatus = "pending_deletion" - CertificatePackStatusPendingExpiration CertificatePackStatus = "pending_expiration" - CertificatePackStatusExpired CertificatePackStatus = "expired" - CertificatePackStatusActive CertificatePackStatus = "active" - CertificatePackStatusInitializingTimedOut CertificatePackStatus = "initializing_timed_out" - CertificatePackStatusValidationTimedOut CertificatePackStatus = "validation_timed_out" - CertificatePackStatusIssuanceTimedOut CertificatePackStatus = "issuance_timed_out" - CertificatePackStatusDeploymentTimedOut CertificatePackStatus = "deployment_timed_out" - CertificatePackStatusDeletionTimedOut CertificatePackStatus = "deletion_timed_out" - CertificatePackStatusPendingCleanup CertificatePackStatus = "pending_cleanup" - CertificatePackStatusStagingDeployment CertificatePackStatus = "staging_deployment" - CertificatePackStatusStagingActive CertificatePackStatus = "staging_active" - CertificatePackStatusDeactivating CertificatePackStatus = "deactivating" - CertificatePackStatusInactive CertificatePackStatus = "inactive" - CertificatePackStatusBackupIssued CertificatePackStatus = "backup_issued" - CertificatePackStatusHoldingDeployment CertificatePackStatus = "holding_deployment" + StatusInitializing Status = "initializing" + StatusPendingValidation Status = "pending_validation" + StatusDeleted Status = "deleted" + StatusPendingIssuance Status = "pending_issuance" + StatusPendingDeployment Status = "pending_deployment" + StatusPendingDeletion Status = "pending_deletion" + StatusPendingExpiration Status = "pending_expiration" + StatusExpired Status = "expired" + StatusActive Status = "active" + StatusInitializingTimedOut Status = "initializing_timed_out" + StatusValidationTimedOut Status = "validation_timed_out" + StatusIssuanceTimedOut Status = "issuance_timed_out" + StatusDeploymentTimedOut Status = "deployment_timed_out" + StatusDeletionTimedOut Status = "deletion_timed_out" + StatusPendingCleanup Status = "pending_cleanup" + StatusStagingDeployment Status = "staging_deployment" + StatusStagingActive Status = "staging_active" + StatusDeactivating Status = "deactivating" + StatusInactive Status = "inactive" + StatusBackupIssued Status = "backup_issued" + StatusHoldingDeployment Status = "holding_deployment" ) -func (r CertificatePackStatus) IsKnown() bool { +func (r Status) IsKnown() bool { switch r { - case CertificatePackStatusInitializing, CertificatePackStatusPendingValidation, CertificatePackStatusDeleted, CertificatePackStatusPendingIssuance, CertificatePackStatusPendingDeployment, CertificatePackStatusPendingDeletion, CertificatePackStatusPendingExpiration, CertificatePackStatusExpired, CertificatePackStatusActive, CertificatePackStatusInitializingTimedOut, CertificatePackStatusValidationTimedOut, CertificatePackStatusIssuanceTimedOut, CertificatePackStatusDeploymentTimedOut, CertificatePackStatusDeletionTimedOut, CertificatePackStatusPendingCleanup, CertificatePackStatusStagingDeployment, CertificatePackStatusStagingActive, CertificatePackStatusDeactivating, CertificatePackStatusInactive, CertificatePackStatusBackupIssued, CertificatePackStatusHoldingDeployment: + case StatusInitializing, StatusPendingValidation, StatusDeleted, StatusPendingIssuance, StatusPendingDeployment, StatusPendingDeletion, StatusPendingExpiration, StatusExpired, StatusActive, StatusInitializingTimedOut, StatusValidationTimedOut, StatusIssuanceTimedOut, StatusDeploymentTimedOut, StatusDeletionTimedOut, StatusPendingCleanup, StatusStagingDeployment, StatusStagingActive, StatusDeactivating, StatusInactive, StatusBackupIssued, StatusHoldingDeployment: return true } return false } // Validation method in use for a certificate pack order. -type CertificatePackValidationMethod string +type ValidationMethod string const ( - CertificatePackValidationMethodHTTP CertificatePackValidationMethod = "http" - CertificatePackValidationMethodCNAME CertificatePackValidationMethod = "cname" - CertificatePackValidationMethodTXT CertificatePackValidationMethod = "txt" + ValidationMethodHTTP ValidationMethod = "http" + ValidationMethodCNAME ValidationMethod = "cname" + ValidationMethodTXT ValidationMethod = "txt" ) -func (r CertificatePackValidationMethod) IsKnown() bool { +func (r ValidationMethod) IsKnown() bool { switch r { - case CertificatePackValidationMethodHTTP, CertificatePackValidationMethodCNAME, CertificatePackValidationMethodTXT: + case ValidationMethodHTTP, ValidationMethodCNAME, ValidationMethodTXT: return true } return false } -type Host = string - -type HostParam = string - type CertificatePackListResponse = interface{} type CertificatePackDeleteResponse struct { @@ -255,7 +255,7 @@ type CertificatePackEditResponse struct { // the zone apex, may not contain more than 50 hosts, and may not be empty. Hosts []Host `json:"hosts"` // Status of certificate pack. - Status CertificatePackStatus `json:"status"` + Status Status `json:"status"` // Type of certificate pack. Type CertificatePackEditResponseType `json:"type"` // Validation Method selected for the order. diff --git a/ssl/certificatepackorder.go b/ssl/certificatepackorder.go index eb87ac0ce48..2c892dc23ea 100644 --- a/ssl/certificatepackorder.go +++ b/ssl/certificatepackorder.go @@ -59,7 +59,7 @@ type CertificatePackOrderNewResponse struct { // the zone apex, may not contain more than 50 hosts, and may not be empty. Hosts []Host `json:"hosts"` // Status of certificate pack. - Status CertificatePackStatus `json:"status"` + Status Status `json:"status"` // Type of certificate pack. Type CertificatePackOrderNewResponseType `json:"type"` // Validation Method selected for the order. diff --git a/ssl/verification.go b/ssl/verification.go index a7b87d57f5c..5571fa2989d 100644 --- a/ssl/verification.go +++ b/ssl/verification.go @@ -73,7 +73,7 @@ type Verification struct { // Certificate's signature algorithm. Signature VerificationSignature `json:"signature"` // Validation method in use for a certificate pack order. - ValidationMethod CertificatePackValidationMethod `json:"validation_method"` + ValidationMethod ValidationMethod `json:"validation_method"` // Certificate's required verification information. VerificationInfo VerificationVerificationInfo `json:"verification_info"` // Status of the required verification information, omitted if verification status diff --git a/user/organization.go b/user/organization.go index 31deefc16ea..fa9a95c5c72 100644 --- a/user/organization.go +++ b/user/organization.go @@ -92,8 +92,8 @@ type Organization struct { // List of roles that a user has within an organization. Roles []string `json:"roles"` // Whether the user is a member of the organization or has an inivitation pending. - Status accounts.MemberStatus `json:"status"` - JSON organizationJSON `json:"-"` + Status accounts.Status `json:"status"` + JSON organizationJSON `json:"-"` } // organizationJSON contains the JSON metadata for the struct [Organization]