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

Restore methods with optional params for 4.19 compatability #80

Merged
merged 3 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cloudstack/AddressService.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type AddressServiceIface interface {
AssociateIpAddress(p *AssociateIpAddressParams) (*AssociateIpAddressResponse, error)
NewAssociateIpAddressParams() *AssociateIpAddressParams
DisassociateIpAddress(p *DisassociateIpAddressParams) (*DisassociateIpAddressResponse, error)
NewDisassociateIpAddressParams() *DisassociateIpAddressParams
NewDisassociateIpAddressParams(id string) *DisassociateIpAddressParams
ListPublicIpAddresses(p *ListPublicIpAddressesParams) (*ListPublicIpAddressesResponse, error)
NewListPublicIpAddressesParams() *ListPublicIpAddressesParams
GetPublicIpAddressByID(id string, opts ...OptionFunc) (*PublicIpAddress, int, error)
Expand Down Expand Up @@ -369,9 +369,10 @@ func (p *DisassociateIpAddressParams) GetIpaddress() (string, bool) {

// You should always use this function to get a new DisassociateIpAddressParams instance,
// as then you are sure you have configured all required params
func (s *AddressService) NewDisassociateIpAddressParams() *DisassociateIpAddressParams {
func (s *AddressService) NewDisassociateIpAddressParams(id string) *DisassociateIpAddressParams {
p := &DisassociateIpAddressParams{}
p.p = make(map[string]interface{})
p.p["id"] = id
return p
}

Expand Down
8 changes: 4 additions & 4 deletions cloudstack/AddressService_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions cloudstack/KubernetesService.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type KubernetesServiceIface interface {
AddKubernetesSupportedVersion(p *AddKubernetesSupportedVersionParams) (*AddKubernetesSupportedVersionResponse, error)
NewAddKubernetesSupportedVersionParams(mincpunumber int, minmemory int, semanticversion string) *AddKubernetesSupportedVersionParams
CreateKubernetesCluster(p *CreateKubernetesClusterParams) (*CreateKubernetesClusterResponse, error)
NewCreateKubernetesClusterParams(name string, zoneid string) *CreateKubernetesClusterParams
NewCreateKubernetesClusterParams(clustertype string, name string, zoneid string) *CreateKubernetesClusterParams
DeleteKubernetesCluster(p *DeleteKubernetesClusterParams) (*DeleteKubernetesClusterResponse, error)
NewDeleteKubernetesClusterParams(id string) *DeleteKubernetesClusterParams
DeleteKubernetesSupportedVersion(p *DeleteKubernetesSupportedVersionParams) (*DeleteKubernetesSupportedVersionResponse, error)
Expand Down Expand Up @@ -633,9 +633,10 @@ func (p *CreateKubernetesClusterParams) GetZoneid() (string, bool) {

// You should always use this function to get a new CreateKubernetesClusterParams instance,
// as then you are sure you have configured all required params
func (s *KubernetesService) NewCreateKubernetesClusterParams(name string, zoneid string) *CreateKubernetesClusterParams {
func (s *KubernetesService) NewCreateKubernetesClusterParams(clustertype string, name string, zoneid string) *CreateKubernetesClusterParams {
p := &CreateKubernetesClusterParams{}
p.p = make(map[string]interface{})
p.p["clustertype"] = clustertype
p.p["name"] = name
p.p["zoneid"] = zoneid
return p
Expand Down
8 changes: 4 additions & 4 deletions cloudstack/KubernetesService_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions cloudstack/NetworkACLService.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type NetworkACLServiceIface interface {
CreateNetworkACL(p *CreateNetworkACLParams) (*CreateNetworkACLResponse, error)
NewCreateNetworkACLParams(protocol string) *CreateNetworkACLParams
CreateNetworkACLList(p *CreateNetworkACLListParams) (*CreateNetworkACLListResponse, error)
NewCreateNetworkACLListParams(name string) *CreateNetworkACLListParams
NewCreateNetworkACLListParams(name string, vpcid string) *CreateNetworkACLListParams
DeleteNetworkACL(p *DeleteNetworkACLParams) (*DeleteNetworkACLResponse, error)
NewDeleteNetworkACLParams(id string) *DeleteNetworkACLParams
DeleteNetworkACLList(p *DeleteNetworkACLListParams) (*DeleteNetworkACLListResponse, error)
Expand Down Expand Up @@ -457,10 +457,11 @@ func (p *CreateNetworkACLListParams) GetVpcid() (string, bool) {

// You should always use this function to get a new CreateNetworkACLListParams instance,
// as then you are sure you have configured all required params
func (s *NetworkACLService) NewCreateNetworkACLListParams(name string) *CreateNetworkACLListParams {
func (s *NetworkACLService) NewCreateNetworkACLListParams(name string, vpcid string) *CreateNetworkACLListParams {
p := &CreateNetworkACLListParams{}
p.p = make(map[string]interface{})
p.p["name"] = name
p.p["vpcid"] = vpcid
return p
}

Expand Down
8 changes: 4 additions & 4 deletions cloudstack/NetworkACLService_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions cloudstack/TemplateService.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type TemplateServiceIface interface {
ExtractTemplate(p *ExtractTemplateParams) (*ExtractTemplateResponse, error)
NewExtractTemplateParams(id string, mode string) *ExtractTemplateParams
GetUploadParamsForTemplate(p *GetUploadParamsForTemplateParams) (*GetUploadParamsForTemplateResponse, error)
NewGetUploadParamsForTemplateParams(format string, hypervisor string, name string, zoneid string) *GetUploadParamsForTemplateParams
NewGetUploadParamsForTemplateParams(displaytext string, format string, hypervisor string, name string, zoneid string) *GetUploadParamsForTemplateParams
ListTemplatePermissions(p *ListTemplatePermissionsParams) (*ListTemplatePermissionsResponse, error)
NewListTemplatePermissionsParams(id string) *ListTemplatePermissionsParams
GetTemplatePermissionByID(id string, opts ...OptionFunc) (*TemplatePermission, int, error)
Expand Down Expand Up @@ -1472,9 +1472,10 @@ func (p *GetUploadParamsForTemplateParams) GetZoneid() (string, bool) {

// You should always use this function to get a new GetUploadParamsForTemplateParams instance,
// as then you are sure you have configured all required params
func (s *TemplateService) NewGetUploadParamsForTemplateParams(format string, hypervisor string, name string, zoneid string) *GetUploadParamsForTemplateParams {
func (s *TemplateService) NewGetUploadParamsForTemplateParams(displaytext string, format string, hypervisor string, name string, zoneid string) *GetUploadParamsForTemplateParams {
p := &GetUploadParamsForTemplateParams{}
p.p = make(map[string]interface{})
p.p["displaytext"] = displaytext
p.p["format"] = format
p.p["hypervisor"] = hypervisor
p.p["name"] = name
Expand Down
8 changes: 4 additions & 4 deletions cloudstack/TemplateService_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 19 additions & 7 deletions generate/requiredParams.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,43 @@ package main
// the CloudStack API.

var requiredParams = map[string][]string{
"createDiskOffering": {
"displaytext",
},
"createKubernetesCluster": {
"clustertype",
},
"createNetworkACLList": {
"vpcid",
},
"createNetworkOffering": {
"displaytext",
},
"createDiskOffering": {
"createProject": {
"displaytext",
},
"createServiceOffering": {
"displaytext",
},
"createVPCOffering": {
"createTemplate": {
"displaytext",
},
"registerIso": {
"createVPC": {
"displaytext",
},
"createProject": {
"createVPCOffering": {
"displaytext",
},
"createTemplate": {
"disassociateIpAddress": {
"id",
},
"getUploadParamsForTemplate": {
"displaytext",
},
"registerTemplate": {
"registerIso": {
"displaytext",
},
"createVPC": {
"registerTemplate": {
"displaytext",
},
}
2 changes: 1 addition & 1 deletion test/AddressService_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestAddressService(t *testing.T) {
if _, ok := response["disassociateIpAddress"]; !ok {
t.Skipf("Skipping as no json response is provided in testdata")
}
p := client.Address.NewDisassociateIpAddressParams()
p := client.Address.NewDisassociateIpAddressParams("id")
_, err := client.Address.DisassociateIpAddress(p)
if err != nil {
t.Errorf(err.Error())
Expand Down
2 changes: 1 addition & 1 deletion test/KubernetesService_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestKubernetesService(t *testing.T) {
if _, ok := response["createKubernetesCluster"]; !ok {
t.Skipf("Skipping as no json response is provided in testdata")
}
p := client.Kubernetes.NewCreateKubernetesClusterParams("name", "zoneid")
p := client.Kubernetes.NewCreateKubernetesClusterParams("clustertype", "name", "zoneid")
r, err := client.Kubernetes.CreateKubernetesCluster(p)
if err != nil {
t.Errorf(err.Error())
Expand Down
2 changes: 1 addition & 1 deletion test/NetworkACLService_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestNetworkACLService(t *testing.T) {
if _, ok := response["createNetworkACLList"]; !ok {
t.Skipf("Skipping as no json response is provided in testdata")
}
p := client.NetworkACL.NewCreateNetworkACLListParams("name")
p := client.NetworkACL.NewCreateNetworkACLListParams("name", "vpcid")
r, err := client.NetworkACL.CreateNetworkACLList(p)
if err != nil {
t.Errorf(err.Error())
Expand Down
2 changes: 1 addition & 1 deletion test/TemplateService_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func TestTemplateService(t *testing.T) {
if _, ok := response["getUploadParamsForTemplate"]; !ok {
t.Skipf("Skipping as no json response is provided in testdata")
}
p := client.Template.NewGetUploadParamsForTemplateParams("format", "hypervisor", "name", "zoneid")
p := client.Template.NewGetUploadParamsForTemplateParams("displaytext", "format", "hypervisor", "name", "zoneid")
_, err := client.Template.GetUploadParamsForTemplate(p)
if err != nil {
t.Errorf(err.Error())
Expand Down
Loading