cloudflare-go icon indicating copy to clipboard operation
cloudflare-go copied to clipboard

Incomplete custom hostname (and custom hostname ssl) status constants

Open rcj4747 opened this issue 3 years ago • 0 comments

Current cloudflare-go version

v0.52.0

Description

custom_hostname.go has definitions for a subset of CustomHostnameStatus values (pending, active, moved, deleted, & blocked) but this is incomplete based on the API's custom hostname object definition. Missing values are: active_redeploying, pending_deletion, pending_blocked, pending_migration, pending_provisioned, test_pending, test_active, test_active_apex, test_blocked, test_failed, provisioned

Additionally, there are no constants for the CustomHostnameSSL.Status which is defined as a string. Valid values per the API doc are initializing, pending_validation, deleted, pending_issuance, pending_deployment, pending_deletion, pending_expiration, expired, active, initializing_timed_out, validation_timed_out, issuance_timed_out, deployment_timed_out, deletion_timed_out, pending_cleanup, staging_deployment, staging_active, deactivating, inactive, backup_issued, holding_deployment

Use cases

A user of cloudflare-go would like to the status value in a custom hostname object (and custom hostname SSL object) using the constants defined in the go library without adding hard-coded strings to their code.

Potential cloudflare-go usage

switch currentRecord.Status {
	case cloudflare.MOVED, cloudflare.DELETED:
		// do things
	// !! ACTIVE_REDEPLOYING is not defined today
	case cloudflare.ACTIVE, cloudflare.ACTIVE_REDEPLOYING, cloudflare.PENDING:
		// do things
	case cloudflare.BLOCKED:
		// do things

References

No response

rcj4747 avatar Oct 17 '22 21:10 rcj4747