diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..2d995061 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +hcloud/zz_*_iface.go linguist-generated=true diff --git a/go.mod b/go.mod index 65850f77..256f6dfb 100644 --- a/go.mod +++ b/go.mod @@ -10,6 +10,7 @@ require ( github.com/google/go-cmp v0.6.0 github.com/prometheus/client_golang v1.17.0 github.com/stretchr/testify v1.8.4 + github.com/vburenin/ifacemaker v1.2.1 golang.org/x/net v0.17.0 ) @@ -18,6 +19,7 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/golang/protobuf v1.5.3 // indirect + github.com/jessevdk/go-flags v1.4.1-0.20181029123624-5de817a9aa20 // indirect github.com/kr/text v0.2.0 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect @@ -25,8 +27,10 @@ require ( github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.11.1 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect + golang.org/x/mod v0.9.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect + golang.org/x/tools v0.6.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index f4a44623..872e1191 100644 --- a/go.sum +++ b/go.sum @@ -6,15 +6,14 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/jessevdk/go-flags v1.4.1-0.20181029123624-5de817a9aa20 h1:dAOsPLhnBzIyxu0VvmnKjlNcIlgMK+erD6VRHDtweMI= +github.com/jessevdk/go-flags v1.4.1-0.20181029123624-5de817a9aa20/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= @@ -22,50 +21,34 @@ github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zk github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= -github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= -github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 h1:v7DLqVdK4VrYkVD5diGdl4sxJurKJEMnODWRJlxV9oM= github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= -github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= -github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= -github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= -github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= -golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos= -golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +github.com/vburenin/ifacemaker v1.2.1 h1:3Vq8B/bfBgjWTkv+jDg4dVL1KHt3k1K4lO7XRxYA2sk= +github.com/vburenin/ifacemaker v1.2.1/go.mod h1:5WqrzX2aD7/hi+okBjcaEQJMg4lDGrpuEX3B8L4Wgrs= +golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs= +golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/hcloud/interface_gen.go b/hcloud/interface_gen.go new file mode 100644 index 00000000..d367899d --- /dev/null +++ b/hcloud/interface_gen.go @@ -0,0 +1,22 @@ +package hcloud + +//go:generate go run github.com/vburenin/ifacemaker -f action.go -s ActionClient -i IActionClient -p hcloud -o zz_action_client_iface.go +//go:generate go run github.com/vburenin/ifacemaker -f action.go -s ResourceActionClient -i IResourceActionClient -p hcloud -o zz_resource_action_client_iface.go +//go:generate go run github.com/vburenin/ifacemaker -f datacenter.go -s DatacenterClient -i IDatacenterClient -p hcloud -o zz_datacenter_client_iface.go +//go:generate go run github.com/vburenin/ifacemaker -f floating_ip.go -s FloatingIPClient -i IFloatingIPClient -p hcloud -o zz_floating_ip_client_iface.go +//go:generate go run github.com/vburenin/ifacemaker -f image.go -s ImageClient -i IImageClient -p hcloud -o zz_image_client_iface.go +//go:generate go run github.com/vburenin/ifacemaker -f iso.go -s ISOClient -i IISOClient -p hcloud -o zz_iso_client_iface.go +//go:generate go run github.com/vburenin/ifacemaker -f location.go -s LocationClient -i ILocationClient -p hcloud -o zz_location_client_iface.go +//go:generate go run github.com/vburenin/ifacemaker -f network.go -s NetworkClient -i INetworkClient -p hcloud -o zz_network_client_iface.go +//go:generate go run github.com/vburenin/ifacemaker -f pricing.go -s PricingClient -i IPricingClient -p hcloud -o zz_pricing_client_iface.go +//go:generate go run github.com/vburenin/ifacemaker -f server.go -s ServerClient -i IServerClient -p hcloud -o zz_server_client_iface.go +//go:generate go run github.com/vburenin/ifacemaker -f server_type.go -s ServerTypeClient -i IServerTypeClient -p hcloud -o zz_server_type_client_iface.go +//go:generate go run github.com/vburenin/ifacemaker -f ssh_key.go -s SSHKeyClient -i ISSHKeyClient -p hcloud -o zz_ssh_key_client_iface.go +//go:generate go run github.com/vburenin/ifacemaker -f volume.go -s VolumeClient -i IVolumeClient -p hcloud -o zz_volume_client_iface.go +//go:generate go run github.com/vburenin/ifacemaker -f load_balancer.go -s LoadBalancerClient -i ILoadBalancerClient -p hcloud -o zz_load_balancer_client_iface.go +//go:generate go run github.com/vburenin/ifacemaker -f load_balancer_type.go -s LoadBalancerTypeClient -i ILoadBalancerTypeClient -p hcloud -o zz_load_balancer_type_client_iface.go +//go:generate go run github.com/vburenin/ifacemaker -f certificate.go -s CertificateClient -i ICertificateClient -p hcloud -o zz_certificate_client_iface.go +//go:generate go run github.com/vburenin/ifacemaker -f firewall.go -s FirewallClient -i IFirewallClient -p hcloud -o zz_firewall_client_iface.go +//go:generate go run github.com/vburenin/ifacemaker -f placement_group.go -s PlacementGroupClient -i IPlacementGroupClient -p hcloud -o zz_placement_group_client_iface.go +//go:generate go run github.com/vburenin/ifacemaker -f rdns.go -s RDNSClient -i IRDNSClient -p hcloud -o zz_rdns_client_iface.go +//go:generate go run github.com/vburenin/ifacemaker -f primary_ip.go -s PrimaryIPClient -i IPrimaryIPClient -p hcloud -o zz_primary_ip_client_iface.go diff --git a/hcloud/zz_action_client_iface.go b/hcloud/zz_action_client_iface.go new file mode 100644 index 00000000..1917574a --- /dev/null +++ b/hcloud/zz_action_client_iface.go @@ -0,0 +1,60 @@ +// Code generated by ifacemaker; DO NOT EDIT. + +package hcloud + +import ( + "context" +) + +// IActionClient ... +type IActionClient interface { + // GetByID retrieves an action by its ID. If the action does not exist, nil is returned. + GetByID(ctx context.Context, id int64) (*Action, *Response, error) + // List returns a list of actions for a specific page. + // + // Please note that filters specified in opts are not taken into account + // when their value corresponds to their zero value or when they are empty. + List(ctx context.Context, opts ActionListOpts) ([]*Action, *Response, error) + // All returns all actions. + All(ctx context.Context) ([]*Action, error) + // AllWithOpts returns all actions for the given options. + AllWithOpts(ctx context.Context, opts ActionListOpts) ([]*Action, error) + // WatchOverallProgress watches several actions' progress until they complete + // with success or error. This watching happens in a goroutine and updates are + // provided through the two returned channels: + // + // - The first channel receives percentage updates of the progress, based on + // the number of completed versus total watched actions. The return value + // is an int between 0 and 100. + // - The second channel returned receives errors for actions that did not + // complete successfully, as well as any errors that happened while + // querying the API. + // + // By default, the method keeps watching until all actions have finished + // processing. If you want to be able to cancel the method or configure a + // timeout, use the [context.Context]. Once the method has stopped watching, + // both returned channels are closed. + // + // WatchOverallProgress uses the [WithPollBackoffFunc] of the [Client] to wait + // until sending the next request. + WatchOverallProgress(ctx context.Context, actions []*Action) (<-chan int, <-chan error) + // WatchProgress watches one action's progress until it completes with success + // or error. This watching happens in a goroutine and updates are provided + // through the two returned channels: + // + // - The first channel receives percentage updates of the progress, based on + // the progress percentage indicated by the API. The return value is an int + // between 0 and 100. + // - The second channel receives any errors that happened while querying the + // API, as well as the error of the action if it did not complete + // successfully, or nil if it did. + // + // By default, the method keeps watching until the action has finished + // processing. If you want to be able to cancel the method or configure a + // timeout, use the [context.Context]. Once the method has stopped watching, + // both returned channels are closed. + // + // WatchProgress uses the [WithPollBackoffFunc] of the [Client] to wait until + // sending the next request. + WatchProgress(ctx context.Context, action *Action) (<-chan int, <-chan error) +} diff --git a/hcloud/zz_certificate_client_iface.go b/hcloud/zz_certificate_client_iface.go new file mode 100644 index 00000000..94583925 --- /dev/null +++ b/hcloud/zz_certificate_client_iface.go @@ -0,0 +1,40 @@ +// Code generated by ifacemaker; DO NOT EDIT. + +package hcloud + +import ( + "context" +) + +// ICertificateClient ... +type ICertificateClient interface { + // GetByID retrieves a Certificate by its ID. If the Certificate does not exist, nil is returned. + GetByID(ctx context.Context, id int64) (*Certificate, *Response, error) + // GetByName retrieves a Certificate by its name. If the Certificate does not exist, nil is returned. + GetByName(ctx context.Context, name string) (*Certificate, *Response, error) + // Get retrieves a Certificate by its ID if the input can be parsed as an integer, otherwise it + // retrieves a Certificate by its name. If the Certificate does not exist, nil is returned. + Get(ctx context.Context, idOrName string) (*Certificate, *Response, error) + // List returns a list of Certificates for a specific page. + // + // Please note that filters specified in opts are not taken into account + // when their value corresponds to their zero value or when they are empty. + List(ctx context.Context, opts CertificateListOpts) ([]*Certificate, *Response, error) + // All returns all Certificates. + All(ctx context.Context) ([]*Certificate, error) + // AllWithOpts returns all Certificates for the given options. + AllWithOpts(ctx context.Context, opts CertificateListOpts) ([]*Certificate, error) + // Create creates a new uploaded certificate. + // + // Create returns an error for certificates of any other type. Use + // CreateCertificate to create such certificates. + Create(ctx context.Context, opts CertificateCreateOpts) (*Certificate, *Response, error) + // CreateCertificate creates a new certificate of any type. + CreateCertificate(ctx context.Context, opts CertificateCreateOpts) (CertificateCreateResult, *Response, error) + // Update updates a Certificate. + Update(ctx context.Context, certificate *Certificate, opts CertificateUpdateOpts) (*Certificate, *Response, error) + // Delete deletes a certificate. + Delete(ctx context.Context, certificate *Certificate) (*Response, error) + // RetryIssuance retries the issuance of a failed managed certificate. + RetryIssuance(ctx context.Context, certificate *Certificate) (*Action, *Response, error) +} diff --git a/hcloud/zz_datacenter_client_iface.go b/hcloud/zz_datacenter_client_iface.go new file mode 100644 index 00000000..f9376756 --- /dev/null +++ b/hcloud/zz_datacenter_client_iface.go @@ -0,0 +1,27 @@ +// Code generated by ifacemaker; DO NOT EDIT. + +package hcloud + +import ( + "context" +) + +// IDatacenterClient ... +type IDatacenterClient interface { + // GetByID retrieves a datacenter by its ID. If the datacenter does not exist, nil is returned. + GetByID(ctx context.Context, id int64) (*Datacenter, *Response, error) + // GetByName retrieves a datacenter by its name. If the datacenter does not exist, nil is returned. + GetByName(ctx context.Context, name string) (*Datacenter, *Response, error) + // Get retrieves a datacenter by its ID if the input can be parsed as an integer, otherwise it + // retrieves a datacenter by its name. If the datacenter does not exist, nil is returned. + Get(ctx context.Context, idOrName string) (*Datacenter, *Response, error) + // List returns a list of datacenters for a specific page. + // + // Please note that filters specified in opts are not taken into account + // when their value corresponds to their zero value or when they are empty. + List(ctx context.Context, opts DatacenterListOpts) ([]*Datacenter, *Response, error) + // All returns all datacenters. + All(ctx context.Context) ([]*Datacenter, error) + // AllWithOpts returns all datacenters for the given options. + AllWithOpts(ctx context.Context, opts DatacenterListOpts) ([]*Datacenter, error) +} diff --git a/hcloud/zz_firewall_client_iface.go b/hcloud/zz_firewall_client_iface.go new file mode 100644 index 00000000..ce648115 --- /dev/null +++ b/hcloud/zz_firewall_client_iface.go @@ -0,0 +1,37 @@ +// Code generated by ifacemaker; DO NOT EDIT. + +package hcloud + +import ( + "context" +) + +// IFirewallClient ... +type IFirewallClient interface { + // GetByID retrieves a Firewall by its ID. If the Firewall does not exist, nil is returned. + GetByID(ctx context.Context, id int64) (*Firewall, *Response, error) + // GetByName retrieves a Firewall by its name. If the Firewall does not exist, nil is returned. + GetByName(ctx context.Context, name string) (*Firewall, *Response, error) + // Get retrieves a Firewall by its ID if the input can be parsed as an integer, otherwise it + // retrieves a Firewall by its name. If the Firewall does not exist, nil is returned. + Get(ctx context.Context, idOrName string) (*Firewall, *Response, error) + // List returns a list of Firewalls for a specific page. + // + // Please note that filters specified in opts are not taken into account + // when their value corresponds to their zero value or when they are empty. + List(ctx context.Context, opts FirewallListOpts) ([]*Firewall, *Response, error) + // All returns all Firewalls. + All(ctx context.Context) ([]*Firewall, error) + // AllWithOpts returns all Firewalls for the given options. + AllWithOpts(ctx context.Context, opts FirewallListOpts) ([]*Firewall, error) + // Create creates a new Firewall. + Create(ctx context.Context, opts FirewallCreateOpts) (FirewallCreateResult, *Response, error) + // Update updates a Firewall. + Update(ctx context.Context, firewall *Firewall, opts FirewallUpdateOpts) (*Firewall, *Response, error) + // Delete deletes a Firewall. + Delete(ctx context.Context, firewall *Firewall) (*Response, error) + // SetRules sets the rules of a Firewall. + SetRules(ctx context.Context, firewall *Firewall, opts FirewallSetRulesOpts) ([]*Action, *Response, error) + ApplyResources(ctx context.Context, firewall *Firewall, resources []FirewallResource) ([]*Action, *Response, error) + RemoveResources(ctx context.Context, firewall *Firewall, resources []FirewallResource) ([]*Action, *Response, error) +} diff --git a/hcloud/zz_floating_ip_client_iface.go b/hcloud/zz_floating_ip_client_iface.go new file mode 100644 index 00000000..4d71be26 --- /dev/null +++ b/hcloud/zz_floating_ip_client_iface.go @@ -0,0 +1,43 @@ +// Code generated by ifacemaker; DO NOT EDIT. + +package hcloud + +import ( + "context" +) + +// IFloatingIPClient ... +type IFloatingIPClient interface { + // GetByID retrieves a Floating IP by its ID. If the Floating IP does not exist, + // nil is returned. + GetByID(ctx context.Context, id int64) (*FloatingIP, *Response, error) + // GetByName retrieves a Floating IP by its name. If the Floating IP does not exist, nil is returned. + GetByName(ctx context.Context, name string) (*FloatingIP, *Response, error) + // Get retrieves a Floating IP by its ID if the input can be parsed as an integer, otherwise it + // retrieves a Floating IP by its name. If the Floating IP does not exist, nil is returned. + Get(ctx context.Context, idOrName string) (*FloatingIP, *Response, error) + // List returns a list of Floating IPs for a specific page. + // + // Please note that filters specified in opts are not taken into account + // when their value corresponds to their zero value or when they are empty. + List(ctx context.Context, opts FloatingIPListOpts) ([]*FloatingIP, *Response, error) + // All returns all Floating IPs. + All(ctx context.Context) ([]*FloatingIP, error) + // AllWithOpts returns all Floating IPs for the given options. + AllWithOpts(ctx context.Context, opts FloatingIPListOpts) ([]*FloatingIP, error) + // Create creates a Floating IP. + Create(ctx context.Context, opts FloatingIPCreateOpts) (FloatingIPCreateResult, *Response, error) + // Delete deletes a Floating IP. + Delete(ctx context.Context, floatingIP *FloatingIP) (*Response, error) + // Update updates a Floating IP. + Update(ctx context.Context, floatingIP *FloatingIP, opts FloatingIPUpdateOpts) (*FloatingIP, *Response, error) + // Assign assigns a Floating IP to a server. + Assign(ctx context.Context, floatingIP *FloatingIP, server *Server) (*Action, *Response, error) + // Unassign unassigns a Floating IP from the currently assigned server. + Unassign(ctx context.Context, floatingIP *FloatingIP) (*Action, *Response, error) + // ChangeDNSPtr changes or resets the reverse DNS pointer for a Floating IP address. + // Pass a nil ptr to reset the reverse DNS pointer to its default value. + ChangeDNSPtr(ctx context.Context, floatingIP *FloatingIP, ip string, ptr *string) (*Action, *Response, error) + // ChangeProtection changes the resource protection level of a Floating IP. + ChangeProtection(ctx context.Context, floatingIP *FloatingIP, opts FloatingIPChangeProtectionOpts) (*Action, *Response, error) +} diff --git a/hcloud/zz_image_client_iface.go b/hcloud/zz_image_client_iface.go new file mode 100644 index 00000000..17fbcd92 --- /dev/null +++ b/hcloud/zz_image_client_iface.go @@ -0,0 +1,48 @@ +// Code generated by ifacemaker; DO NOT EDIT. + +package hcloud + +import ( + "context" +) + +// IImageClient ... +type IImageClient interface { + // GetByID retrieves an image by its ID. If the image does not exist, nil is returned. + GetByID(ctx context.Context, id int64) (*Image, *Response, error) + // GetByName retrieves an image by its name. If the image does not exist, nil is returned. + // + // Deprecated: Use [ImageClient.GetByNameAndArchitecture] instead. + GetByName(ctx context.Context, name string) (*Image, *Response, error) + // GetByNameAndArchitecture retrieves an image by its name and architecture. If the image does not exist, + // nil is returned. + // In contrast to [ImageClient.Get], this method also returns deprecated images. Depending on your needs you should + // check for this in your calling method. + GetByNameAndArchitecture(ctx context.Context, name string, architecture Architecture) (*Image, *Response, error) + // Get retrieves an image by its ID if the input can be parsed as an integer, otherwise it + // retrieves an image by its name. If the image does not exist, nil is returned. + // + // Deprecated: Use [ImageClient.GetForArchitecture] instead. + Get(ctx context.Context, idOrName string) (*Image, *Response, error) + // GetForArchitecture retrieves an image by its ID if the input can be parsed as an integer, otherwise it + // retrieves an image by its name and architecture. If the image does not exist, nil is returned. + // + // In contrast to [ImageClient.Get], this method also returns deprecated images. Depending on your needs you should + // check for this in your calling method. + GetForArchitecture(ctx context.Context, idOrName string, architecture Architecture) (*Image, *Response, error) + // List returns a list of images for a specific page. + // + // Please note that filters specified in opts are not taken into account + // when their value corresponds to their zero value or when they are empty. + List(ctx context.Context, opts ImageListOpts) ([]*Image, *Response, error) + // All returns all images. + All(ctx context.Context) ([]*Image, error) + // AllWithOpts returns all images for the given options. + AllWithOpts(ctx context.Context, opts ImageListOpts) ([]*Image, error) + // Delete deletes an image. + Delete(ctx context.Context, image *Image) (*Response, error) + // Update updates an image. + Update(ctx context.Context, image *Image, opts ImageUpdateOpts) (*Image, *Response, error) + // ChangeProtection changes the resource protection level of an image. + ChangeProtection(ctx context.Context, image *Image, opts ImageChangeProtectionOpts) (*Action, *Response, error) +} diff --git a/hcloud/zz_iso_client_iface.go b/hcloud/zz_iso_client_iface.go new file mode 100644 index 00000000..aff450ed --- /dev/null +++ b/hcloud/zz_iso_client_iface.go @@ -0,0 +1,26 @@ +// Code generated by ifacemaker; DO NOT EDIT. + +package hcloud + +import ( + "context" +) + +// IISOClient ... +type IISOClient interface { + // GetByID retrieves an ISO by its ID. + GetByID(ctx context.Context, id int64) (*ISO, *Response, error) + // GetByName retrieves an ISO by its name. + GetByName(ctx context.Context, name string) (*ISO, *Response, error) + // Get retrieves an ISO by its ID if the input can be parsed as an integer, otherwise it retrieves an ISO by its name. + Get(ctx context.Context, idOrName string) (*ISO, *Response, error) + // List returns a list of ISOs for a specific page. + // + // Please note that filters specified in opts are not taken into account + // when their value corresponds to their zero value or when they are empty. + List(ctx context.Context, opts ISOListOpts) ([]*ISO, *Response, error) + // All returns all ISOs. + All(ctx context.Context) ([]*ISO, error) + // AllWithOpts returns all ISOs for the given options. + AllWithOpts(ctx context.Context, opts ISOListOpts) ([]*ISO, error) +} diff --git a/hcloud/zz_load_balancer_client_iface.go b/hcloud/zz_load_balancer_client_iface.go new file mode 100644 index 00000000..2665f22b --- /dev/null +++ b/hcloud/zz_load_balancer_client_iface.go @@ -0,0 +1,71 @@ +// Code generated by ifacemaker; DO NOT EDIT. + +package hcloud + +import ( + "context" + "net" +) + +// ILoadBalancerClient ... +type ILoadBalancerClient interface { + // GetByID retrieves a Load Balancer by its ID. If the Load Balancer does not exist, nil is returned. + GetByID(ctx context.Context, id int64) (*LoadBalancer, *Response, error) + // GetByName retrieves a Load Balancer by its name. If the Load Balancer does not exist, nil is returned. + GetByName(ctx context.Context, name string) (*LoadBalancer, *Response, error) + // Get retrieves a Load Balancer by its ID if the input can be parsed as an integer, otherwise it + // retrieves a Load Balancer by its name. If the Load Balancer does not exist, nil is returned. + Get(ctx context.Context, idOrName string) (*LoadBalancer, *Response, error) + // List returns a list of Load Balancers for a specific page. + // + // Please note that filters specified in opts are not taken into account + // when their value corresponds to their zero value or when they are empty. + List(ctx context.Context, opts LoadBalancerListOpts) ([]*LoadBalancer, *Response, error) + // All returns all Load Balancers. + All(ctx context.Context) ([]*LoadBalancer, error) + // AllWithOpts returns all Load Balancers for the given options. + AllWithOpts(ctx context.Context, opts LoadBalancerListOpts) ([]*LoadBalancer, error) + // Update updates a Load Balancer. + Update(ctx context.Context, loadBalancer *LoadBalancer, opts LoadBalancerUpdateOpts) (*LoadBalancer, *Response, error) + // Create creates a new Load Balancer. + Create(ctx context.Context, opts LoadBalancerCreateOpts) (LoadBalancerCreateResult, *Response, error) + // Delete deletes a Load Balancer. + Delete(ctx context.Context, loadBalancer *LoadBalancer) (*Response, error) + // AddServerTarget adds a server target to a Load Balancer. + AddServerTarget(ctx context.Context, loadBalancer *LoadBalancer, opts LoadBalancerAddServerTargetOpts) (*Action, *Response, error) + // RemoveServerTarget removes a server target from a Load Balancer. + RemoveServerTarget(ctx context.Context, loadBalancer *LoadBalancer, server *Server) (*Action, *Response, error) + // AddLabelSelectorTarget adds a label selector target to a Load Balancer. + AddLabelSelectorTarget(ctx context.Context, loadBalancer *LoadBalancer, opts LoadBalancerAddLabelSelectorTargetOpts) (*Action, *Response, error) + // RemoveLabelSelectorTarget removes a label selector target from a Load Balancer. + RemoveLabelSelectorTarget(ctx context.Context, loadBalancer *LoadBalancer, labelSelector string) (*Action, *Response, error) + // AddIPTarget adds an IP target to a Load Balancer. + AddIPTarget(ctx context.Context, loadBalancer *LoadBalancer, opts LoadBalancerAddIPTargetOpts) (*Action, *Response, error) + // RemoveIPTarget removes an IP target from a Load Balancer. + RemoveIPTarget(ctx context.Context, loadBalancer *LoadBalancer, ip net.IP) (*Action, *Response, error) + // AddService adds a service to a Load Balancer. + AddService(ctx context.Context, loadBalancer *LoadBalancer, opts LoadBalancerAddServiceOpts) (*Action, *Response, error) + // UpdateService updates a Load Balancer service. + UpdateService(ctx context.Context, loadBalancer *LoadBalancer, listenPort int, opts LoadBalancerUpdateServiceOpts) (*Action, *Response, error) + // DeleteService deletes a Load Balancer service. + DeleteService(ctx context.Context, loadBalancer *LoadBalancer, listenPort int) (*Action, *Response, error) + // ChangeProtection changes the resource protection level of a Load Balancer. + ChangeProtection(ctx context.Context, loadBalancer *LoadBalancer, opts LoadBalancerChangeProtectionOpts) (*Action, *Response, error) + // ChangeAlgorithm changes the algorithm of a Load Balancer. + ChangeAlgorithm(ctx context.Context, loadBalancer *LoadBalancer, opts LoadBalancerChangeAlgorithmOpts) (*Action, *Response, error) + // AttachToNetwork attaches a Load Balancer to a network. + AttachToNetwork(ctx context.Context, loadBalancer *LoadBalancer, opts LoadBalancerAttachToNetworkOpts) (*Action, *Response, error) + // DetachFromNetwork detaches a Load Balancer from a network. + DetachFromNetwork(ctx context.Context, loadBalancer *LoadBalancer, opts LoadBalancerDetachFromNetworkOpts) (*Action, *Response, error) + // EnablePublicInterface enables the Load Balancer's public network interface. + EnablePublicInterface(ctx context.Context, loadBalancer *LoadBalancer) (*Action, *Response, error) + // DisablePublicInterface disables the Load Balancer's public network interface. + DisablePublicInterface(ctx context.Context, loadBalancer *LoadBalancer) (*Action, *Response, error) + // ChangeType changes a Load Balancer's type. + ChangeType(ctx context.Context, loadBalancer *LoadBalancer, opts LoadBalancerChangeTypeOpts) (*Action, *Response, error) + // GetMetrics obtains metrics for a Load Balancer. + GetMetrics(ctx context.Context, lb *LoadBalancer, opts LoadBalancerGetMetricsOpts) (*LoadBalancerMetrics, *Response, error) + // ChangeDNSPtr changes or resets the reverse DNS pointer for a Load Balancer. + // Pass a nil ptr to reset the reverse DNS pointer to its default value. + ChangeDNSPtr(ctx context.Context, lb *LoadBalancer, ip string, ptr *string) (*Action, *Response, error) +} diff --git a/hcloud/zz_load_balancer_type_client_iface.go b/hcloud/zz_load_balancer_type_client_iface.go new file mode 100644 index 00000000..fd3289d4 --- /dev/null +++ b/hcloud/zz_load_balancer_type_client_iface.go @@ -0,0 +1,27 @@ +// Code generated by ifacemaker; DO NOT EDIT. + +package hcloud + +import ( + "context" +) + +// ILoadBalancerTypeClient ... +type ILoadBalancerTypeClient interface { + // GetByID retrieves a Load Balancer type by its ID. If the Load Balancer type does not exist, nil is returned. + GetByID(ctx context.Context, id int64) (*LoadBalancerType, *Response, error) + // GetByName retrieves a Load Balancer type by its name. If the Load Balancer type does not exist, nil is returned. + GetByName(ctx context.Context, name string) (*LoadBalancerType, *Response, error) + // Get retrieves a Load Balancer type by its ID if the input can be parsed as an integer, otherwise it + // retrieves a Load Balancer type by its name. If the Load Balancer type does not exist, nil is returned. + Get(ctx context.Context, idOrName string) (*LoadBalancerType, *Response, error) + // List returns a list of Load Balancer types for a specific page. + // + // Please note that filters specified in opts are not taken into account + // when their value corresponds to their zero value or when they are empty. + List(ctx context.Context, opts LoadBalancerTypeListOpts) ([]*LoadBalancerType, *Response, error) + // All returns all Load Balancer types. + All(ctx context.Context) ([]*LoadBalancerType, error) + // AllWithOpts returns all Load Balancer types for the given options. + AllWithOpts(ctx context.Context, opts LoadBalancerTypeListOpts) ([]*LoadBalancerType, error) +} diff --git a/hcloud/zz_location_client_iface.go b/hcloud/zz_location_client_iface.go new file mode 100644 index 00000000..9da4d5f6 --- /dev/null +++ b/hcloud/zz_location_client_iface.go @@ -0,0 +1,27 @@ +// Code generated by ifacemaker; DO NOT EDIT. + +package hcloud + +import ( + "context" +) + +// ILocationClient ... +type ILocationClient interface { + // GetByID retrieves a location by its ID. If the location does not exist, nil is returned. + GetByID(ctx context.Context, id int64) (*Location, *Response, error) + // GetByName retrieves an location by its name. If the location does not exist, nil is returned. + GetByName(ctx context.Context, name string) (*Location, *Response, error) + // Get retrieves a location by its ID if the input can be parsed as an integer, otherwise it + // retrieves a location by its name. If the location does not exist, nil is returned. + Get(ctx context.Context, idOrName string) (*Location, *Response, error) + // List returns a list of locations for a specific page. + // + // Please note that filters specified in opts are not taken into account + // when their value corresponds to their zero value or when they are empty. + List(ctx context.Context, opts LocationListOpts) ([]*Location, *Response, error) + // All returns all locations. + All(ctx context.Context) ([]*Location, error) + // AllWithOpts returns all locations for the given options. + AllWithOpts(ctx context.Context, opts LocationListOpts) ([]*Location, error) +} diff --git a/hcloud/zz_network_client_iface.go b/hcloud/zz_network_client_iface.go new file mode 100644 index 00000000..f8b752e3 --- /dev/null +++ b/hcloud/zz_network_client_iface.go @@ -0,0 +1,45 @@ +// Code generated by ifacemaker; DO NOT EDIT. + +package hcloud + +import ( + "context" +) + +// INetworkClient ... +type INetworkClient interface { + // GetByID retrieves a network by its ID. If the network does not exist, nil is returned. + GetByID(ctx context.Context, id int64) (*Network, *Response, error) + // GetByName retrieves a network by its name. If the network does not exist, nil is returned. + GetByName(ctx context.Context, name string) (*Network, *Response, error) + // Get retrieves a network by its ID if the input can be parsed as an integer, otherwise it + // retrieves a network by its name. If the network does not exist, nil is returned. + Get(ctx context.Context, idOrName string) (*Network, *Response, error) + // List returns a list of networks for a specific page. + // + // Please note that filters specified in opts are not taken into account + // when their value corresponds to their zero value or when they are empty. + List(ctx context.Context, opts NetworkListOpts) ([]*Network, *Response, error) + // All returns all networks. + All(ctx context.Context) ([]*Network, error) + // AllWithOpts returns all networks for the given options. + AllWithOpts(ctx context.Context, opts NetworkListOpts) ([]*Network, error) + // Delete deletes a network. + Delete(ctx context.Context, network *Network) (*Response, error) + // Update updates a network. + Update(ctx context.Context, network *Network, opts NetworkUpdateOpts) (*Network, *Response, error) + // Create creates a new network. + Create(ctx context.Context, opts NetworkCreateOpts) (*Network, *Response, error) + // ChangeIPRange changes the IP range of a network. + ChangeIPRange(ctx context.Context, network *Network, opts NetworkChangeIPRangeOpts) (*Action, *Response, error) + // AddSubnet adds a subnet to a network. + AddSubnet(ctx context.Context, network *Network, opts NetworkAddSubnetOpts) (*Action, *Response, error) + // DeleteSubnet deletes a subnet from a network. + DeleteSubnet(ctx context.Context, network *Network, opts NetworkDeleteSubnetOpts) (*Action, *Response, error) + // AddRoute adds a route to a network. + AddRoute(ctx context.Context, network *Network, opts NetworkAddRouteOpts) (*Action, *Response, error) + // DeleteRoute deletes a route from a network. + DeleteRoute(ctx context.Context, network *Network, opts NetworkDeleteRouteOpts) (*Action, *Response, error) + // ChangeProtection changes the resource protection level of a network. + ChangeProtection(ctx context.Context, network *Network, opts NetworkChangeProtectionOpts) (*Action, *Response, error) +} diff --git a/hcloud/zz_placement_group_client_iface.go b/hcloud/zz_placement_group_client_iface.go new file mode 100644 index 00000000..9fadd4f2 --- /dev/null +++ b/hcloud/zz_placement_group_client_iface.go @@ -0,0 +1,33 @@ +// Code generated by ifacemaker; DO NOT EDIT. + +package hcloud + +import ( + "context" +) + +// IPlacementGroupClient ... +type IPlacementGroupClient interface { + // GetByID retrieves a PlacementGroup by its ID. If the PlacementGroup does not exist, nil is returned. + GetByID(ctx context.Context, id int64) (*PlacementGroup, *Response, error) + // GetByName retrieves a PlacementGroup by its name. If the PlacementGroup does not exist, nil is returned. + GetByName(ctx context.Context, name string) (*PlacementGroup, *Response, error) + // Get retrieves a PlacementGroup by its ID if the input can be parsed as an integer, otherwise it + // retrieves a PlacementGroup by its name. If the PlacementGroup does not exist, nil is returned. + Get(ctx context.Context, idOrName string) (*PlacementGroup, *Response, error) + // List returns a list of PlacementGroups for a specific page. + // + // Please note that filters specified in opts are not taken into account + // when their value corresponds to their zero value or when they are empty. + List(ctx context.Context, opts PlacementGroupListOpts) ([]*PlacementGroup, *Response, error) + // All returns all PlacementGroups. + All(ctx context.Context) ([]*PlacementGroup, error) + // AllWithOpts returns all PlacementGroups for the given options. + AllWithOpts(ctx context.Context, opts PlacementGroupListOpts) ([]*PlacementGroup, error) + // Create creates a new PlacementGroup. + Create(ctx context.Context, opts PlacementGroupCreateOpts) (PlacementGroupCreateResult, *Response, error) + // Update updates a PlacementGroup. + Update(ctx context.Context, placementGroup *PlacementGroup, opts PlacementGroupUpdateOpts) (*PlacementGroup, *Response, error) + // Delete deletes a PlacementGroup. + Delete(ctx context.Context, placementGroup *PlacementGroup) (*Response, error) +} diff --git a/hcloud/zz_pricing_client_iface.go b/hcloud/zz_pricing_client_iface.go new file mode 100644 index 00000000..cd4068c6 --- /dev/null +++ b/hcloud/zz_pricing_client_iface.go @@ -0,0 +1,13 @@ +// Code generated by ifacemaker; DO NOT EDIT. + +package hcloud + +import ( + "context" +) + +// IPricingClient ... +type IPricingClient interface { + // Get retrieves pricing information. + Get(ctx context.Context) (Pricing, *Response, error) +} diff --git a/hcloud/zz_primary_ip_client_iface.go b/hcloud/zz_primary_ip_client_iface.go new file mode 100644 index 00000000..6b8e617e --- /dev/null +++ b/hcloud/zz_primary_ip_client_iface.go @@ -0,0 +1,43 @@ +// Code generated by ifacemaker; DO NOT EDIT. + +package hcloud + +import ( + "context" +) + +// IPrimaryIPClient ... +type IPrimaryIPClient interface { + // GetByID retrieves a Primary IP by its ID. If the Primary IP does not exist, nil is returned. + GetByID(ctx context.Context, id int64) (*PrimaryIP, *Response, error) + // GetByIP retrieves a Primary IP by its IP Address. If the Primary IP does not exist, nil is returned. + GetByIP(ctx context.Context, ip string) (*PrimaryIP, *Response, error) + // GetByName retrieves a Primary IP by its name. If the Primary IP does not exist, nil is returned. + GetByName(ctx context.Context, name string) (*PrimaryIP, *Response, error) + // Get retrieves a Primary IP by its ID if the input can be parsed as an integer, otherwise it + // retrieves a Primary IP by its name. If the Primary IP does not exist, nil is returned. + Get(ctx context.Context, idOrName string) (*PrimaryIP, *Response, error) + // List returns a list of Primary IPs for a specific page. + // + // Please note that filters specified in opts are not taken into account + // when their value corresponds to their zero value or when they are empty. + List(ctx context.Context, opts PrimaryIPListOpts) ([]*PrimaryIP, *Response, error) + // All returns all Primary IPs. + All(ctx context.Context) ([]*PrimaryIP, error) + // AllWithOpts returns all Primary IPs for the given options. + AllWithOpts(ctx context.Context, opts PrimaryIPListOpts) ([]*PrimaryIP, error) + // Create creates a Primary IP. + Create(ctx context.Context, reqBody PrimaryIPCreateOpts) (*PrimaryIPCreateResult, *Response, error) + // Delete deletes a Primary IP. + Delete(ctx context.Context, primaryIP *PrimaryIP) (*Response, error) + // Update updates a Primary IP. + Update(ctx context.Context, primaryIP *PrimaryIP, reqBody PrimaryIPUpdateOpts) (*PrimaryIP, *Response, error) + // Assign a Primary IP to a resource. + Assign(ctx context.Context, opts PrimaryIPAssignOpts) (*Action, *Response, error) + // Unassign a Primary IP from a resource. + Unassign(ctx context.Context, id int64) (*Action, *Response, error) + // ChangeDNSPtr Change the reverse DNS from a Primary IP. + ChangeDNSPtr(ctx context.Context, opts PrimaryIPChangeDNSPtrOpts) (*Action, *Response, error) + // ChangeProtection Changes the protection configuration of a Primary IP. + ChangeProtection(ctx context.Context, opts PrimaryIPChangeProtectionOpts) (*Action, *Response, error) +} diff --git a/hcloud/zz_rdns_client_iface.go b/hcloud/zz_rdns_client_iface.go new file mode 100644 index 00000000..f92f1867 --- /dev/null +++ b/hcloud/zz_rdns_client_iface.go @@ -0,0 +1,15 @@ +// Code generated by ifacemaker; DO NOT EDIT. + +package hcloud + +import ( + "context" + "net" +) + +// IRDNSClient ... +type IRDNSClient interface { + // ChangeDNSPtr changes or resets the reverse DNS pointer for a IP address. + // Pass a nil ptr to reset the reverse DNS pointer to its default value. + ChangeDNSPtr(ctx context.Context, rdns RDNSSupporter, ip net.IP, ptr *string) (*Action, *Response, error) +} diff --git a/hcloud/zz_resource_action_client_iface.go b/hcloud/zz_resource_action_client_iface.go new file mode 100644 index 00000000..67910ab2 --- /dev/null +++ b/hcloud/zz_resource_action_client_iface.go @@ -0,0 +1,20 @@ +// Code generated by ifacemaker; DO NOT EDIT. + +package hcloud + +import ( + "context" +) + +// IResourceActionClient ... +type IResourceActionClient interface { + // GetByID retrieves an action by its ID. If the action does not exist, nil is returned. + GetByID(ctx context.Context, id int64) (*Action, *Response, error) + // List returns a list of actions for a specific page. + // + // Please note that filters specified in opts are not taken into account + // when their value corresponds to their zero value or when they are empty. + List(ctx context.Context, opts ActionListOpts) ([]*Action, *Response, error) + // All returns all actions for the given options. + All(ctx context.Context, opts ActionListOpts) ([]*Action, error) +} diff --git a/hcloud/zz_server_client_iface.go b/hcloud/zz_server_client_iface.go new file mode 100644 index 00000000..82038a30 --- /dev/null +++ b/hcloud/zz_server_client_iface.go @@ -0,0 +1,90 @@ +// Code generated by ifacemaker; DO NOT EDIT. + +package hcloud + +import ( + "context" +) + +// IServerClient ... +type IServerClient interface { + // GetByID retrieves a server by its ID. If the server does not exist, nil is returned. + GetByID(ctx context.Context, id int64) (*Server, *Response, error) + // GetByName retrieves a server by its name. If the server does not exist, nil is returned. + GetByName(ctx context.Context, name string) (*Server, *Response, error) + // Get retrieves a server by its ID if the input can be parsed as an integer, otherwise it + // retrieves a server by its name. If the server does not exist, nil is returned. + Get(ctx context.Context, idOrName string) (*Server, *Response, error) + // List returns a list of servers for a specific page. + // + // Please note that filters specified in opts are not taken into account + // when their value corresponds to their zero value or when they are empty. + List(ctx context.Context, opts ServerListOpts) ([]*Server, *Response, error) + // All returns all servers. + All(ctx context.Context) ([]*Server, error) + // AllWithOpts returns all servers for the given options. + AllWithOpts(ctx context.Context, opts ServerListOpts) ([]*Server, error) + // Create creates a new server. + Create(ctx context.Context, opts ServerCreateOpts) (ServerCreateResult, *Response, error) + // Delete deletes a server. + // + // Deprecated: Use [ServerClient.DeleteWithResult] instead. + Delete(ctx context.Context, server *Server) (*Response, error) + // DeleteWithResult deletes a server and returns the parsed response containing the action. + DeleteWithResult(ctx context.Context, server *Server) (*ServerDeleteResult, *Response, error) + // Update updates a server. + Update(ctx context.Context, server *Server, opts ServerUpdateOpts) (*Server, *Response, error) + // Poweron starts a server. + Poweron(ctx context.Context, server *Server) (*Action, *Response, error) + // Reboot reboots a server. + Reboot(ctx context.Context, server *Server) (*Action, *Response, error) + // Reset resets a server. + Reset(ctx context.Context, server *Server) (*Action, *Response, error) + // Shutdown shuts down a server. + Shutdown(ctx context.Context, server *Server) (*Action, *Response, error) + // Poweroff stops a server. + Poweroff(ctx context.Context, server *Server) (*Action, *Response, error) + // ResetPassword resets a server's password. + ResetPassword(ctx context.Context, server *Server) (ServerResetPasswordResult, *Response, error) + // CreateImage creates an image from a server. + CreateImage(ctx context.Context, server *Server, opts *ServerCreateImageOpts) (ServerCreateImageResult, *Response, error) + // EnableRescue enables rescue mode for a server. + EnableRescue(ctx context.Context, server *Server, opts ServerEnableRescueOpts) (ServerEnableRescueResult, *Response, error) + // DisableRescue disables rescue mode for a server. + DisableRescue(ctx context.Context, server *Server) (*Action, *Response, error) + // Rebuild rebuilds a server. + // + // Deprecated: Use [ServerClient.RebuildWithResult] instead. + Rebuild(ctx context.Context, server *Server, opts ServerRebuildOpts) (*Action, *Response, error) + // RebuildWithResult rebuilds a server. + RebuildWithResult(ctx context.Context, server *Server, opts ServerRebuildOpts) (ServerRebuildResult, *Response, error) + // AttachISO attaches an ISO to a server. + AttachISO(ctx context.Context, server *Server, iso *ISO) (*Action, *Response, error) + // DetachISO detaches the currently attached ISO from a server. + DetachISO(ctx context.Context, server *Server) (*Action, *Response, error) + // EnableBackup enables backup for a server. Pass in an empty backup window to let the + // API pick a window for you. See the API documentation at docs.hetzner.cloud for a list + // of valid backup windows. + EnableBackup(ctx context.Context, server *Server, window string) (*Action, *Response, error) + // DisableBackup disables backup for a server. + DisableBackup(ctx context.Context, server *Server) (*Action, *Response, error) + // ChangeType changes a server's type. + ChangeType(ctx context.Context, server *Server, opts ServerChangeTypeOpts) (*Action, *Response, error) + // ChangeDNSPtr changes or resets the reverse DNS pointer for a server IP address. + // Pass a nil ptr to reset the reverse DNS pointer to its default value. + ChangeDNSPtr(ctx context.Context, server *Server, ip string, ptr *string) (*Action, *Response, error) + // ChangeProtection changes the resource protection level of a server. + ChangeProtection(ctx context.Context, server *Server, opts ServerChangeProtectionOpts) (*Action, *Response, error) + // RequestConsole requests a WebSocket VNC console. + RequestConsole(ctx context.Context, server *Server) (ServerRequestConsoleResult, *Response, error) + // AttachToNetwork attaches a server to a network. + AttachToNetwork(ctx context.Context, server *Server, opts ServerAttachToNetworkOpts) (*Action, *Response, error) + // DetachFromNetwork detaches a server from a network. + DetachFromNetwork(ctx context.Context, server *Server, opts ServerDetachFromNetworkOpts) (*Action, *Response, error) + // ChangeAliasIPs changes a server's alias IPs in a network. + ChangeAliasIPs(ctx context.Context, server *Server, opts ServerChangeAliasIPsOpts) (*Action, *Response, error) + // GetMetrics obtains metrics for Server. + GetMetrics(ctx context.Context, server *Server, opts ServerGetMetricsOpts) (*ServerMetrics, *Response, error) + AddToPlacementGroup(ctx context.Context, server *Server, placementGroup *PlacementGroup) (*Action, *Response, error) + RemoveFromPlacementGroup(ctx context.Context, server *Server) (*Action, *Response, error) +} diff --git a/hcloud/zz_server_type_client_iface.go b/hcloud/zz_server_type_client_iface.go new file mode 100644 index 00000000..57c57afa --- /dev/null +++ b/hcloud/zz_server_type_client_iface.go @@ -0,0 +1,27 @@ +// Code generated by ifacemaker; DO NOT EDIT. + +package hcloud + +import ( + "context" +) + +// IServerTypeClient ... +type IServerTypeClient interface { + // GetByID retrieves a server type by its ID. If the server type does not exist, nil is returned. + GetByID(ctx context.Context, id int64) (*ServerType, *Response, error) + // GetByName retrieves a server type by its name. If the server type does not exist, nil is returned. + GetByName(ctx context.Context, name string) (*ServerType, *Response, error) + // Get retrieves a server type by its ID if the input can be parsed as an integer, otherwise it + // retrieves a server type by its name. If the server type does not exist, nil is returned. + Get(ctx context.Context, idOrName string) (*ServerType, *Response, error) + // List returns a list of server types for a specific page. + // + // Please note that filters specified in opts are not taken into account + // when their value corresponds to their zero value or when they are empty. + List(ctx context.Context, opts ServerTypeListOpts) ([]*ServerType, *Response, error) + // All returns all server types. + All(ctx context.Context) ([]*ServerType, error) + // AllWithOpts returns all server types for the given options. + AllWithOpts(ctx context.Context, opts ServerTypeListOpts) ([]*ServerType, error) +} diff --git a/hcloud/zz_ssh_key_client_iface.go b/hcloud/zz_ssh_key_client_iface.go new file mode 100644 index 00000000..d2c6988d --- /dev/null +++ b/hcloud/zz_ssh_key_client_iface.go @@ -0,0 +1,35 @@ +// Code generated by ifacemaker; DO NOT EDIT. + +package hcloud + +import ( + "context" +) + +// ISSHKeyClient ... +type ISSHKeyClient interface { + // GetByID retrieves a SSH key by its ID. If the SSH key does not exist, nil is returned. + GetByID(ctx context.Context, id int64) (*SSHKey, *Response, error) + // GetByName retrieves a SSH key by its name. If the SSH key does not exist, nil is returned. + GetByName(ctx context.Context, name string) (*SSHKey, *Response, error) + // GetByFingerprint retreives a SSH key by its fingerprint. If the SSH key does not exist, nil is returned. + GetByFingerprint(ctx context.Context, fingerprint string) (*SSHKey, *Response, error) + // Get retrieves a SSH key by its ID if the input can be parsed as an integer, otherwise it + // retrieves a SSH key by its name. If the SSH key does not exist, nil is returned. + Get(ctx context.Context, idOrName string) (*SSHKey, *Response, error) + // List returns a list of SSH keys for a specific page. + // + // Please note that filters specified in opts are not taken into account + // when their value corresponds to their zero value or when they are empty. + List(ctx context.Context, opts SSHKeyListOpts) ([]*SSHKey, *Response, error) + // All returns all SSH keys. + All(ctx context.Context) ([]*SSHKey, error) + // AllWithOpts returns all SSH keys with the given options. + AllWithOpts(ctx context.Context, opts SSHKeyListOpts) ([]*SSHKey, error) + // Create creates a new SSH key with the given options. + Create(ctx context.Context, opts SSHKeyCreateOpts) (*SSHKey, *Response, error) + // Delete deletes a SSH key. + Delete(ctx context.Context, sshKey *SSHKey) (*Response, error) + // Update updates a SSH key. + Update(ctx context.Context, sshKey *SSHKey, opts SSHKeyUpdateOpts) (*SSHKey, *Response, error) +} diff --git a/hcloud/zz_volume_client_iface.go b/hcloud/zz_volume_client_iface.go new file mode 100644 index 00000000..28edb7a2 --- /dev/null +++ b/hcloud/zz_volume_client_iface.go @@ -0,0 +1,43 @@ +// Code generated by ifacemaker; DO NOT EDIT. + +package hcloud + +import ( + "context" +) + +// IVolumeClient ... +type IVolumeClient interface { + // GetByID retrieves a volume by its ID. If the volume does not exist, nil is returned. + GetByID(ctx context.Context, id int64) (*Volume, *Response, error) + // GetByName retrieves a volume by its name. If the volume does not exist, nil is returned. + GetByName(ctx context.Context, name string) (*Volume, *Response, error) + // Get retrieves a volume by its ID if the input can be parsed as an integer, otherwise it + // retrieves a volume by its name. If the volume does not exist, nil is returned. + Get(ctx context.Context, idOrName string) (*Volume, *Response, error) + // List returns a list of volumes for a specific page. + // + // Please note that filters specified in opts are not taken into account + // when their value corresponds to their zero value or when they are empty. + List(ctx context.Context, opts VolumeListOpts) ([]*Volume, *Response, error) + // All returns all volumes. + All(ctx context.Context) ([]*Volume, error) + // AllWithOpts returns all volumes with the given options. + AllWithOpts(ctx context.Context, opts VolumeListOpts) ([]*Volume, error) + // Create creates a new volume with the given options. + Create(ctx context.Context, opts VolumeCreateOpts) (VolumeCreateResult, *Response, error) + // Delete deletes a volume. + Delete(ctx context.Context, volume *Volume) (*Response, error) + // Update updates a volume. + Update(ctx context.Context, volume *Volume, opts VolumeUpdateOpts) (*Volume, *Response, error) + // AttachWithOpts attaches a volume to a server. + AttachWithOpts(ctx context.Context, volume *Volume, opts VolumeAttachOpts) (*Action, *Response, error) + // Attach attaches a volume to a server. + Attach(ctx context.Context, volume *Volume, server *Server) (*Action, *Response, error) + // Detach detaches a volume from a server. + Detach(ctx context.Context, volume *Volume) (*Action, *Response, error) + // ChangeProtection changes the resource protection level of a volume. + ChangeProtection(ctx context.Context, volume *Volume, opts VolumeChangeProtectionOpts) (*Action, *Response, error) + // Resize changes the size of a volume. + Resize(ctx context.Context, volume *Volume, size int) (*Action, *Response, error) +} diff --git a/tools.go b/tools.go new file mode 100644 index 00000000..9d765d5a --- /dev/null +++ b/tools.go @@ -0,0 +1,8 @@ +//go:build tools +// +build tools + +package tools + +import ( + _ "github.com/vburenin/ifacemaker" +)