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

Requests should return Fog::Compute::Google::Operation #381

Open
2 tasks
Temikus opened this issue Jun 28, 2018 · 1 comment
Open
2 tasks

Requests should return Fog::Compute::Google::Operation #381

Temikus opened this issue Jun 28, 2018 · 1 comment

Comments

@Temikus
Copy link
Member

Temikus commented Jun 28, 2018

Currently requests return an API operation, i.e.: Google::Apis::ComputeV1::Operation:
And then usually get parsed by model like so:

operation = Fog::Compute::Google::Operations.new(:service => service)
                                                      .get(data.name)

That's a lot of duplicate (and sometimes inconsistent) code[1].

I propose to do the following:

  • Write a helper method, e.g. Fog::Google.convert_operation that will contain the API -> Fog tanslation logic.
  • For 2.0 replace all individual model logic with that method and make requests return Fog::Compute::Google::Operation

I would do deprecation in 2.0 and removal in 3.0 but I don't think we can mark it as deprecated somehow if people are using raw requests.

@icco WDYT?

[1]

λ grep -R 'operation = Fog::Compute::Google::Operations.new(:service => service)' .                                                                             (2)
./lib/fog/compute/google/models/image.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/image.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/http_health_check.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/http_health_check.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/http_health_check.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/target_instance.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/target_instance.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/instance_group_manager.rb:          operation = Fog::Compute::Google::Operations.new(:service => service).get(data.name, zone.split("/")[-1])
./lib/fog/compute/google/models/url_map.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/url_map.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/url_map.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/url_map.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/url_map.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/snapshot.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/global_forwarding_rule.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/global_forwarding_rule.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/target_https_proxy.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/target_https_proxy.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/target_https_proxy.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/target_https_proxy.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/network.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/network.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/instance_template.rb:          operation = Fog::Compute::Google::Operations.new(:service => service).get(data.name)
./lib/fog/compute/google/models/instance_template.rb:          operation = Fog::Compute::Google::Operations.new(:service => service).get(data.name)
./lib/fog/compute/google/models/forwarding_rule.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/forwarding_rule.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/subnetwork.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/subnetwork.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/subnetwork.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/subnetwork.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/route.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/route.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/global_address.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/global_address.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/target_http_proxy.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/target_http_proxy.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/target_http_proxy.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/firewall.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/firewall.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/firewall.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/firewall.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/backend_service.rb:          operation = Fog::Compute::Google::Operations.new(:service => service).get(data.name)
./lib/fog/compute/google/models/backend_service.rb:          operation = Fog::Compute::Google::Operations.new(:service => service).get(data.name)
./lib/fog/compute/google/models/ssl_certificate.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/ssl_certificate.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/disk.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/disk.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
./lib/fog/compute/google/models/disk.rb:          operation = Fog::Compute::Google::Operations.new(:service => service)
@github-actions
Copy link

This issue has been marked inactive and will be closed if no further activity occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
2.0 Release
  
Backlog
Development

No branches or pull requests

2 participants