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 Zone Subscription Creation #196

Conversation

phily245
Copy link
Contributor

@phily245 phily245 commented Oct 4, 2021

Consuming the tenant API requires this as a part of the provisioning.

Closes #190

Consuming the tenant API requires this as a part of the provisioning
$this->adapter = $adapter;
}

public function addZoneSubscription(string $zoneId, string $ratePlanId = ''): stdClass
Copy link
Member

Choose a reason for hiding this comment

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

just a little heads up that the method isn't always POST. see https://github.com/cloudflare/terraform-provider-cloudflare/blob/master/cloudflare/resource_cloudflare_zone.go#L217-L228 for some logic and comments around the behaviour.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I've matched this with my latest commits

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jacobbednarz thanks for all the feedback! I think I've addressed this, but it would probably be worth you double checking as golang (from your terraform sample) isn't a language I use every day

I copy/pasted this from elsewhere
This will handle updating the subscription regardless of if the
subscription exists or not
This isn't supported in  <= 7.2, I was using PHP 7.4 to develop this but
CI handily highlighted this
}

$existingSubscription = $this->listZoneSubscriptions($zoneId);
$method = empty($existingSubscription->result) ? 'post' : 'put';
Copy link
Member

Choose a reason for hiding this comment

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

heh, this is one way of checking it 😛

@jacobbednarz jacobbednarz merged commit 5024c2a into cloudflare:master Oct 13, 2021
@phily245 phily245 deleted the 190-Add-Zone-Subscription-Setup-Support branch October 13, 2021 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Zone Subscription Setup Support
2 participants