Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add automatic ssl mode setting support #2855

Merged
merged 3 commits into from
Aug 29, 2024

Conversation

yj7o5
Copy link
Contributor

@yj7o5 yj7o5 commented Aug 9, 2024

Description

This PR adds support for reading and modifying the new automatic ssl mode setting.

Has your change been tested?

Yes, there are tests in placed to verify both reading and writing the setting value.

Screenshots (if appropriate):

Types of changes

What sort of change does your code introduce/modify?

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • This change is using publicly documented in cloudflare/api-schemas
    and relies on stable APIs.

Copy link
Contributor

github-actions bot commented Aug 9, 2024

changelog detected ✅

@yj7o5 yj7o5 changed the title add automatic ssl mode setting support Add automatic ssl mode setting support Aug 12, 2024
zone.go Outdated
// UpdateZoneAutomaticSSLSettingMode update information about Automatic SSL mode setting to the specified zone.
//
// API reference: https://api.cloudflare.com/[#-add-url-slug-here]
func (api *API) UpdateZoneAutomaticSSLSettingMode(ctx context.Context, zoneID, mode string) (ZoneSSLSetting, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have a method for fetching/updating zone settings (https://github.com/cloudflare/cloudflare-go/blob/master/zone.go#L958). is there a reason we cannot reuse that here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, however, there is a slight difference in the response we return for this specific setting. As it returns a field called next_scheduled_scan: https://github.com/cloudflare/cloudflare-go/pull/2855/files#diff-ceb3700215079abfa8dfc51b35af780ed6292f4747db0d4710c6c72de18a0a66R178

Also I think the return type here should reference the ZoneAutomaticSSLModeSetting struct vs ZoneSSLSetting. Will fix that typo.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could always put it in a pointer with omitempty which will conditionally set it when it is provided.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the generated version of the libraries, these endpoints are flattened into a single struct so that would make sense to reflect here too if possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated to use the existing Get/UpdateZoneSettings construct and added the field as part of the ZoneSetting struct with omitempty markup

@jacobbednarz jacobbednarz merged commit 1938337 into cloudflare:master Aug 29, 2024
9 of 10 checks passed
@github-actions github-actions bot added this to the v0.104.0 milestone Aug 29, 2024
Saeedazimi69

This comment was marked as spam.

Copy link
Contributor

This functionality has been released in v0.104.0.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants