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

Not all server plans are in PriceZone #20

Open
derkgort opened this issue Jul 2, 2019 · 3 comments
Open

Not all server plans are in PriceZone #20

derkgort opened this issue Jul 2, 2019 · 3 comments

Comments

@derkgort
Copy link
Contributor

derkgort commented Jul 2, 2019

Hi,

Not all server plans are defined in PriceZone.

Only these 2:

    'server_plan_1x_cpu_1_gb' => '\Upcloud\ApiClient\Model\Price',
    'server_plan_2x_cpu_2_gb' => '\Upcloud\ApiClient\Model\Price'

https://github.com/UpCloudLtd/upcloud-php-api/blob/master/lib/Model/PriceZone.php#L63

This is the full list:

server_plan_1xCPU-1GB
server_plan_1xCPU-2GB
server_plan_20xCPU-128GB
server_plan_20xCPU-96GB
server_plan_2xCPU-4GB
server_plan_4xCPU-8GB
server_plan_6xCPU-16GB
server_plan_8xCPU-32GB

Is there a reason they are not defined?

@derkgort
Copy link
Contributor Author

derkgort commented Jul 2, 2019

I just added pull request: #21
Not sure that's the way it's done, because it looks like generated code.

I also added a function to get the plan based on the value returned in ServerApi.

@Darep
Copy link
Member

Darep commented Aug 20, 2019

Yeah, I think the plans were generated with swagger from some incomplete yaml file by the original author of this library... IMO the best solution would be to remove all hard-coded plans/string, and use the plans API: GET /1.2/plan https://developers.upcloud.com/7-plans/ - and pass server create etc. the "name" of the plan you want. Just an idea though...

@alienhaxor
Copy link
Contributor

Thank you for creating the issue and providing the PR. #21

For now all server plans are in PriceZone.

I agree with Darep's solution and since we will face this issue again in the future, I'll leave this issue open for now.

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

No branches or pull requests

3 participants