diff --git a/Makefile b/Makefile index f69f7c3..9fca777 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ SHELL = /usr/bin/env bash -o pipefail all: code mocks test code: - go run generate/generate.go generate/layout.go --api=generate/listApis.json + go run generate/generate.go generate/layout.go generate/requiredParams.go --api=generate/listApis.json FILES=$(shell for file in `pwd`/cloudstack/*Service.go ;do basename $$file .go ; done) mocks: diff --git a/cloudstack/DiskOfferingService.go b/cloudstack/DiskOfferingService.go index 7be7770..3838f2f 100644 --- a/cloudstack/DiskOfferingService.go +++ b/cloudstack/DiskOfferingService.go @@ -29,7 +29,7 @@ import ( type DiskOfferingServiceIface interface { CreateDiskOffering(p *CreateDiskOfferingParams) (*CreateDiskOfferingResponse, error) - NewCreateDiskOfferingParams(name string) *CreateDiskOfferingParams + NewCreateDiskOfferingParams(displaytext string, name string) *CreateDiskOfferingParams DeleteDiskOffering(p *DeleteDiskOfferingParams) (*DeleteDiskOfferingResponse, error) NewDeleteDiskOfferingParams(id string) *DeleteDiskOfferingParams ListDiskOfferings(p *ListDiskOfferingsParams) (*ListDiskOfferingsResponse, error) @@ -639,9 +639,10 @@ func (p *CreateDiskOfferingParams) GetZoneid() ([]string, bool) { // You should always use this function to get a new CreateDiskOfferingParams instance, // as then you are sure you have configured all required params -func (s *DiskOfferingService) NewCreateDiskOfferingParams(name string) *CreateDiskOfferingParams { +func (s *DiskOfferingService) NewCreateDiskOfferingParams(displaytext string, name string) *CreateDiskOfferingParams { p := &CreateDiskOfferingParams{} p.p = make(map[string]interface{}) + p.p["displaytext"] = displaytext p.p["name"] = name return p } diff --git a/cloudstack/DiskOfferingService_mock.go b/cloudstack/DiskOfferingService_mock.go index 5d74ad2..07706bf 100644 --- a/cloudstack/DiskOfferingService_mock.go +++ b/cloudstack/DiskOfferingService_mock.go @@ -161,17 +161,17 @@ func (mr *MockDiskOfferingServiceIfaceMockRecorder) ListDiskOfferings(p interfac } // NewCreateDiskOfferingParams mocks base method. -func (m *MockDiskOfferingServiceIface) NewCreateDiskOfferingParams(name string) *CreateDiskOfferingParams { +func (m *MockDiskOfferingServiceIface) NewCreateDiskOfferingParams(displaytext, name string) *CreateDiskOfferingParams { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewCreateDiskOfferingParams", name) + ret := m.ctrl.Call(m, "NewCreateDiskOfferingParams", displaytext, name) ret0, _ := ret[0].(*CreateDiskOfferingParams) return ret0 } // NewCreateDiskOfferingParams indicates an expected call of NewCreateDiskOfferingParams. -func (mr *MockDiskOfferingServiceIfaceMockRecorder) NewCreateDiskOfferingParams(name interface{}) *gomock.Call { +func (mr *MockDiskOfferingServiceIfaceMockRecorder) NewCreateDiskOfferingParams(displaytext, name interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewCreateDiskOfferingParams", reflect.TypeOf((*MockDiskOfferingServiceIface)(nil).NewCreateDiskOfferingParams), name) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewCreateDiskOfferingParams", reflect.TypeOf((*MockDiskOfferingServiceIface)(nil).NewCreateDiskOfferingParams), displaytext, name) } // NewDeleteDiskOfferingParams mocks base method. diff --git a/cloudstack/ISOService.go b/cloudstack/ISOService.go index 7f4a08f..3e7e6cf 100644 --- a/cloudstack/ISOService.go +++ b/cloudstack/ISOService.go @@ -47,7 +47,7 @@ type ISOServiceIface interface { GetIsoByName(name string, isofilter string, zoneid string, opts ...OptionFunc) (*Iso, int, error) GetIsoByID(id string, opts ...OptionFunc) (*Iso, int, error) RegisterIso(p *RegisterIsoParams) (*RegisterIsoResponse, error) - NewRegisterIsoParams(name string, url string, zoneid string) *RegisterIsoParams + NewRegisterIsoParams(displaytext string, name string, url string, zoneid string) *RegisterIsoParams UpdateIso(p *UpdateIsoParams) (*UpdateIsoResponse, error) NewUpdateIsoParams(id string) *UpdateIsoParams UpdateIsoPermissions(p *UpdateIsoPermissionsParams) (*UpdateIsoPermissionsResponse, error) @@ -2082,9 +2082,10 @@ func (p *RegisterIsoParams) GetZoneid() (string, bool) { // You should always use this function to get a new RegisterIsoParams instance, // as then you are sure you have configured all required params -func (s *ISOService) NewRegisterIsoParams(name string, url string, zoneid string) *RegisterIsoParams { +func (s *ISOService) NewRegisterIsoParams(displaytext string, name string, url string, zoneid string) *RegisterIsoParams { p := &RegisterIsoParams{} p.p = make(map[string]interface{}) + p.p["displaytext"] = displaytext p.p["name"] = name p.p["url"] = url p.p["zoneid"] = zoneid diff --git a/cloudstack/ISOService_mock.go b/cloudstack/ISOService_mock.go index 7fe7580..1d0b388 100644 --- a/cloudstack/ISOService_mock.go +++ b/cloudstack/ISOService_mock.go @@ -340,17 +340,17 @@ func (mr *MockISOServiceIfaceMockRecorder) NewListIsosParams() *gomock.Call { } // NewRegisterIsoParams mocks base method. -func (m *MockISOServiceIface) NewRegisterIsoParams(name, url, zoneid string) *RegisterIsoParams { +func (m *MockISOServiceIface) NewRegisterIsoParams(displaytext, name, url, zoneid string) *RegisterIsoParams { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewRegisterIsoParams", name, url, zoneid) + ret := m.ctrl.Call(m, "NewRegisterIsoParams", displaytext, name, url, zoneid) ret0, _ := ret[0].(*RegisterIsoParams) return ret0 } // NewRegisterIsoParams indicates an expected call of NewRegisterIsoParams. -func (mr *MockISOServiceIfaceMockRecorder) NewRegisterIsoParams(name, url, zoneid interface{}) *gomock.Call { +func (mr *MockISOServiceIfaceMockRecorder) NewRegisterIsoParams(displaytext, name, url, zoneid interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewRegisterIsoParams", reflect.TypeOf((*MockISOServiceIface)(nil).NewRegisterIsoParams), name, url, zoneid) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewRegisterIsoParams", reflect.TypeOf((*MockISOServiceIface)(nil).NewRegisterIsoParams), displaytext, name, url, zoneid) } // NewUpdateIsoParams mocks base method. diff --git a/cloudstack/NetworkOfferingService.go b/cloudstack/NetworkOfferingService.go index 64ff398..e68754f 100644 --- a/cloudstack/NetworkOfferingService.go +++ b/cloudstack/NetworkOfferingService.go @@ -29,7 +29,7 @@ import ( type NetworkOfferingServiceIface interface { CreateNetworkOffering(p *CreateNetworkOfferingParams) (*CreateNetworkOfferingResponse, error) - NewCreateNetworkOfferingParams(guestiptype string, name string, traffictype string) *CreateNetworkOfferingParams + NewCreateNetworkOfferingParams(displaytext string, guestiptype string, name string, traffictype string) *CreateNetworkOfferingParams DeleteNetworkOffering(p *DeleteNetworkOfferingParams) (*DeleteNetworkOfferingResponse, error) NewDeleteNetworkOfferingParams(id string) *DeleteNetworkOfferingParams ListNetworkOfferings(p *ListNetworkOfferingsParams) (*ListNetworkOfferingsResponse, error) @@ -530,9 +530,10 @@ func (p *CreateNetworkOfferingParams) GetZoneid() ([]string, bool) { // You should always use this function to get a new CreateNetworkOfferingParams instance, // as then you are sure you have configured all required params -func (s *NetworkOfferingService) NewCreateNetworkOfferingParams(guestiptype string, name string, traffictype string) *CreateNetworkOfferingParams { +func (s *NetworkOfferingService) NewCreateNetworkOfferingParams(displaytext string, guestiptype string, name string, traffictype string) *CreateNetworkOfferingParams { p := &CreateNetworkOfferingParams{} p.p = make(map[string]interface{}) + p.p["displaytext"] = displaytext p.p["guestiptype"] = guestiptype p.p["name"] = name p.p["traffictype"] = traffictype diff --git a/cloudstack/NetworkOfferingService_mock.go b/cloudstack/NetworkOfferingService_mock.go index 9b4a769..aeda2fb 100644 --- a/cloudstack/NetworkOfferingService_mock.go +++ b/cloudstack/NetworkOfferingService_mock.go @@ -161,17 +161,17 @@ func (mr *MockNetworkOfferingServiceIfaceMockRecorder) ListNetworkOfferings(p in } // NewCreateNetworkOfferingParams mocks base method. -func (m *MockNetworkOfferingServiceIface) NewCreateNetworkOfferingParams(guestiptype, name, traffictype string) *CreateNetworkOfferingParams { +func (m *MockNetworkOfferingServiceIface) NewCreateNetworkOfferingParams(displaytext, guestiptype, name, traffictype string) *CreateNetworkOfferingParams { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewCreateNetworkOfferingParams", guestiptype, name, traffictype) + ret := m.ctrl.Call(m, "NewCreateNetworkOfferingParams", displaytext, guestiptype, name, traffictype) ret0, _ := ret[0].(*CreateNetworkOfferingParams) return ret0 } // NewCreateNetworkOfferingParams indicates an expected call of NewCreateNetworkOfferingParams. -func (mr *MockNetworkOfferingServiceIfaceMockRecorder) NewCreateNetworkOfferingParams(guestiptype, name, traffictype interface{}) *gomock.Call { +func (mr *MockNetworkOfferingServiceIfaceMockRecorder) NewCreateNetworkOfferingParams(displaytext, guestiptype, name, traffictype interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewCreateNetworkOfferingParams", reflect.TypeOf((*MockNetworkOfferingServiceIface)(nil).NewCreateNetworkOfferingParams), guestiptype, name, traffictype) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewCreateNetworkOfferingParams", reflect.TypeOf((*MockNetworkOfferingServiceIface)(nil).NewCreateNetworkOfferingParams), displaytext, guestiptype, name, traffictype) } // NewDeleteNetworkOfferingParams mocks base method. diff --git a/cloudstack/ProjectService.go b/cloudstack/ProjectService.go index e5e67d6..18bb429 100644 --- a/cloudstack/ProjectService.go +++ b/cloudstack/ProjectService.go @@ -35,7 +35,7 @@ type ProjectServiceIface interface { AddUserToProject(p *AddUserToProjectParams) (*AddUserToProjectResponse, error) NewAddUserToProjectParams(projectid string, username string) *AddUserToProjectParams CreateProject(p *CreateProjectParams) (*CreateProjectResponse, error) - NewCreateProjectParams(name string) *CreateProjectParams + NewCreateProjectParams(displaytext string, name string) *CreateProjectParams DeleteAccountFromProject(p *DeleteAccountFromProjectParams) (*DeleteAccountFromProjectResponse, error) NewDeleteAccountFromProjectParams(account string, projectid string) *DeleteAccountFromProjectParams DeleteUserFromProject(p *DeleteUserFromProjectParams) (*DeleteUserFromProjectResponse, error) @@ -612,9 +612,10 @@ func (p *CreateProjectParams) GetUserid() (string, bool) { // You should always use this function to get a new CreateProjectParams instance, // as then you are sure you have configured all required params -func (s *ProjectService) NewCreateProjectParams(name string) *CreateProjectParams { +func (s *ProjectService) NewCreateProjectParams(displaytext string, name string) *CreateProjectParams { p := &CreateProjectParams{} p.p = make(map[string]interface{}) + p.p["displaytext"] = displaytext p.p["name"] = name return p } diff --git a/cloudstack/ProjectService_mock.go b/cloudstack/ProjectService_mock.go index 1061375..a2481e0 100644 --- a/cloudstack/ProjectService_mock.go +++ b/cloudstack/ProjectService_mock.go @@ -374,17 +374,17 @@ func (mr *MockProjectServiceIfaceMockRecorder) NewAddUserToProjectParams(project } // NewCreateProjectParams mocks base method. -func (m *MockProjectServiceIface) NewCreateProjectParams(name string) *CreateProjectParams { +func (m *MockProjectServiceIface) NewCreateProjectParams(displaytext, name string) *CreateProjectParams { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewCreateProjectParams", name) + ret := m.ctrl.Call(m, "NewCreateProjectParams", displaytext, name) ret0, _ := ret[0].(*CreateProjectParams) return ret0 } // NewCreateProjectParams indicates an expected call of NewCreateProjectParams. -func (mr *MockProjectServiceIfaceMockRecorder) NewCreateProjectParams(name interface{}) *gomock.Call { +func (mr *MockProjectServiceIfaceMockRecorder) NewCreateProjectParams(displaytext, name interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewCreateProjectParams", reflect.TypeOf((*MockProjectServiceIface)(nil).NewCreateProjectParams), name) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewCreateProjectParams", reflect.TypeOf((*MockProjectServiceIface)(nil).NewCreateProjectParams), displaytext, name) } // NewCreateProjectRolePermissionParams mocks base method. diff --git a/cloudstack/ServiceOfferingService.go b/cloudstack/ServiceOfferingService.go index 8b9acd8..b65bfb7 100644 --- a/cloudstack/ServiceOfferingService.go +++ b/cloudstack/ServiceOfferingService.go @@ -29,7 +29,7 @@ import ( type ServiceOfferingServiceIface interface { CreateServiceOffering(p *CreateServiceOfferingParams) (*CreateServiceOfferingResponse, error) - NewCreateServiceOfferingParams(name string) *CreateServiceOfferingParams + NewCreateServiceOfferingParams(displaytext string, name string) *CreateServiceOfferingParams DeleteServiceOffering(p *DeleteServiceOfferingParams) (*DeleteServiceOfferingResponse, error) NewDeleteServiceOfferingParams(id string) *DeleteServiceOfferingParams ListServiceOfferings(p *ListServiceOfferingsParams) (*ListServiceOfferingsResponse, error) @@ -940,9 +940,10 @@ func (p *CreateServiceOfferingParams) GetZoneid() ([]string, bool) { // You should always use this function to get a new CreateServiceOfferingParams instance, // as then you are sure you have configured all required params -func (s *ServiceOfferingService) NewCreateServiceOfferingParams(name string) *CreateServiceOfferingParams { +func (s *ServiceOfferingService) NewCreateServiceOfferingParams(displaytext string, name string) *CreateServiceOfferingParams { p := &CreateServiceOfferingParams{} p.p = make(map[string]interface{}) + p.p["displaytext"] = displaytext p.p["name"] = name return p } diff --git a/cloudstack/ServiceOfferingService_mock.go b/cloudstack/ServiceOfferingService_mock.go index aa0464e..b728d99 100644 --- a/cloudstack/ServiceOfferingService_mock.go +++ b/cloudstack/ServiceOfferingService_mock.go @@ -161,17 +161,17 @@ func (mr *MockServiceOfferingServiceIfaceMockRecorder) ListServiceOfferings(p in } // NewCreateServiceOfferingParams mocks base method. -func (m *MockServiceOfferingServiceIface) NewCreateServiceOfferingParams(name string) *CreateServiceOfferingParams { +func (m *MockServiceOfferingServiceIface) NewCreateServiceOfferingParams(displaytext, name string) *CreateServiceOfferingParams { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewCreateServiceOfferingParams", name) + ret := m.ctrl.Call(m, "NewCreateServiceOfferingParams", displaytext, name) ret0, _ := ret[0].(*CreateServiceOfferingParams) return ret0 } // NewCreateServiceOfferingParams indicates an expected call of NewCreateServiceOfferingParams. -func (mr *MockServiceOfferingServiceIfaceMockRecorder) NewCreateServiceOfferingParams(name interface{}) *gomock.Call { +func (mr *MockServiceOfferingServiceIfaceMockRecorder) NewCreateServiceOfferingParams(displaytext, name interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewCreateServiceOfferingParams", reflect.TypeOf((*MockServiceOfferingServiceIface)(nil).NewCreateServiceOfferingParams), name) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewCreateServiceOfferingParams", reflect.TypeOf((*MockServiceOfferingServiceIface)(nil).NewCreateServiceOfferingParams), displaytext, name) } // NewDeleteServiceOfferingParams mocks base method. diff --git a/cloudstack/TemplateService.go b/cloudstack/TemplateService.go index 71200e2..52ff694 100644 --- a/cloudstack/TemplateService.go +++ b/cloudstack/TemplateService.go @@ -31,7 +31,7 @@ type TemplateServiceIface interface { CopyTemplate(p *CopyTemplateParams) (*CopyTemplateResponse, error) NewCopyTemplateParams(id string) *CopyTemplateParams CreateTemplate(p *CreateTemplateParams) (*CreateTemplateResponse, error) - NewCreateTemplateParams(name string, ostypeid string) *CreateTemplateParams + NewCreateTemplateParams(displaytext string, name string, ostypeid string) *CreateTemplateParams DeleteTemplate(p *DeleteTemplateParams) (*DeleteTemplateResponse, error) NewDeleteTemplateParams(id string) *DeleteTemplateParams ExtractTemplate(p *ExtractTemplateParams) (*ExtractTemplateResponse, error) @@ -49,7 +49,7 @@ type TemplateServiceIface interface { PrepareTemplate(p *PrepareTemplateParams) (*PrepareTemplateResponse, error) NewPrepareTemplateParams(templateid string, zoneid string) *PrepareTemplateParams RegisterTemplate(p *RegisterTemplateParams) (*RegisterTemplateResponse, error) - NewRegisterTemplateParams(format string, hypervisor string, name string, url string) *RegisterTemplateParams + NewRegisterTemplateParams(displaytext string, format string, hypervisor string, name string, url string) *RegisterTemplateParams UpdateTemplate(p *UpdateTemplateParams) (*UpdateTemplateResponse, error) NewUpdateTemplateParams(id string) *UpdateTemplateParams UpdateTemplatePermissions(p *UpdateTemplatePermissionsParams) (*UpdateTemplatePermissionsResponse, error) @@ -660,9 +660,10 @@ func (p *CreateTemplateParams) GetZoneid() (string, bool) { // You should always use this function to get a new CreateTemplateParams instance, // as then you are sure you have configured all required params -func (s *TemplateService) NewCreateTemplateParams(name string, ostypeid string) *CreateTemplateParams { +func (s *TemplateService) NewCreateTemplateParams(displaytext string, name string, ostypeid string) *CreateTemplateParams { p := &CreateTemplateParams{} p.p = make(map[string]interface{}) + p.p["displaytext"] = displaytext p.p["name"] = name p.p["ostypeid"] = ostypeid return p @@ -2940,9 +2941,10 @@ func (p *RegisterTemplateParams) GetZoneids() ([]string, bool) { // You should always use this function to get a new RegisterTemplateParams instance, // as then you are sure you have configured all required params -func (s *TemplateService) NewRegisterTemplateParams(format string, hypervisor string, name string, url string) *RegisterTemplateParams { +func (s *TemplateService) NewRegisterTemplateParams(displaytext string, format string, hypervisor string, name string, url string) *RegisterTemplateParams { p := &RegisterTemplateParams{} p.p = make(map[string]interface{}) + p.p["displaytext"] = displaytext p.p["format"] = format p.p["hypervisor"] = hypervisor p.p["name"] = name diff --git a/cloudstack/TemplateService_mock.go b/cloudstack/TemplateService_mock.go index 8921b95..119c60a 100644 --- a/cloudstack/TemplateService_mock.go +++ b/cloudstack/TemplateService_mock.go @@ -292,17 +292,17 @@ func (mr *MockTemplateServiceIfaceMockRecorder) NewCopyTemplateParams(id interfa } // NewCreateTemplateParams mocks base method. -func (m *MockTemplateServiceIface) NewCreateTemplateParams(name, ostypeid string) *CreateTemplateParams { +func (m *MockTemplateServiceIface) NewCreateTemplateParams(displaytext, name, ostypeid string) *CreateTemplateParams { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewCreateTemplateParams", name, ostypeid) + ret := m.ctrl.Call(m, "NewCreateTemplateParams", displaytext, name, ostypeid) ret0, _ := ret[0].(*CreateTemplateParams) return ret0 } // NewCreateTemplateParams indicates an expected call of NewCreateTemplateParams. -func (mr *MockTemplateServiceIfaceMockRecorder) NewCreateTemplateParams(name, ostypeid interface{}) *gomock.Call { +func (mr *MockTemplateServiceIfaceMockRecorder) NewCreateTemplateParams(displaytext, name, ostypeid interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewCreateTemplateParams", reflect.TypeOf((*MockTemplateServiceIface)(nil).NewCreateTemplateParams), name, ostypeid) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewCreateTemplateParams", reflect.TypeOf((*MockTemplateServiceIface)(nil).NewCreateTemplateParams), displaytext, name, ostypeid) } // NewDeleteTemplateParams mocks base method. @@ -418,17 +418,17 @@ func (mr *MockTemplateServiceIfaceMockRecorder) NewProvisionTemplateDirectDownlo } // NewRegisterTemplateParams mocks base method. -func (m *MockTemplateServiceIface) NewRegisterTemplateParams(format, hypervisor, name, url string) *RegisterTemplateParams { +func (m *MockTemplateServiceIface) NewRegisterTemplateParams(displaytext, format, hypervisor, name, url string) *RegisterTemplateParams { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewRegisterTemplateParams", format, hypervisor, name, url) + ret := m.ctrl.Call(m, "NewRegisterTemplateParams", displaytext, format, hypervisor, name, url) ret0, _ := ret[0].(*RegisterTemplateParams) return ret0 } // NewRegisterTemplateParams indicates an expected call of NewRegisterTemplateParams. -func (mr *MockTemplateServiceIfaceMockRecorder) NewRegisterTemplateParams(format, hypervisor, name, url interface{}) *gomock.Call { +func (mr *MockTemplateServiceIfaceMockRecorder) NewRegisterTemplateParams(displaytext, format, hypervisor, name, url interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewRegisterTemplateParams", reflect.TypeOf((*MockTemplateServiceIface)(nil).NewRegisterTemplateParams), format, hypervisor, name, url) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewRegisterTemplateParams", reflect.TypeOf((*MockTemplateServiceIface)(nil).NewRegisterTemplateParams), displaytext, format, hypervisor, name, url) } // NewUpdateTemplateParams mocks base method. diff --git a/cloudstack/VPCService.go b/cloudstack/VPCService.go index c88647d..12c6809 100644 --- a/cloudstack/VPCService.go +++ b/cloudstack/VPCService.go @@ -33,9 +33,9 @@ type VPCServiceIface interface { CreateStaticRoute(p *CreateStaticRouteParams) (*CreateStaticRouteResponse, error) NewCreateStaticRouteParams(cidr string, gatewayid string) *CreateStaticRouteParams CreateVPC(p *CreateVPCParams) (*CreateVPCResponse, error) - NewCreateVPCParams(cidr string, name string, vpcofferingid string, zoneid string) *CreateVPCParams + NewCreateVPCParams(cidr string, displaytext string, name string, vpcofferingid string, zoneid string) *CreateVPCParams CreateVPCOffering(p *CreateVPCOfferingParams) (*CreateVPCOfferingResponse, error) - NewCreateVPCOfferingParams(name string, supportedservices []string) *CreateVPCOfferingParams + NewCreateVPCOfferingParams(displaytext string, name string, supportedservices []string) *CreateVPCOfferingParams DeletePrivateGateway(p *DeletePrivateGatewayParams) (*DeletePrivateGatewayResponse, error) NewDeletePrivateGatewayParams(id string) *DeletePrivateGatewayParams DeleteStaticRoute(p *DeleteStaticRouteParams) (*DeleteStaticRouteResponse, error) @@ -786,10 +786,11 @@ func (p *CreateVPCParams) GetZoneid() (string, bool) { // You should always use this function to get a new CreateVPCParams instance, // as then you are sure you have configured all required params -func (s *VPCService) NewCreateVPCParams(cidr string, name string, vpcofferingid string, zoneid string) *CreateVPCParams { +func (s *VPCService) NewCreateVPCParams(cidr string, displaytext string, name string, vpcofferingid string, zoneid string) *CreateVPCParams { p := &CreateVPCParams{} p.p = make(map[string]interface{}) p.p["cidr"] = cidr + p.p["displaytext"] = displaytext p.p["name"] = name p.p["vpcofferingid"] = vpcofferingid p.p["zoneid"] = zoneid @@ -1096,9 +1097,10 @@ func (p *CreateVPCOfferingParams) GetZoneid() ([]string, bool) { // You should always use this function to get a new CreateVPCOfferingParams instance, // as then you are sure you have configured all required params -func (s *VPCService) NewCreateVPCOfferingParams(name string, supportedservices []string) *CreateVPCOfferingParams { +func (s *VPCService) NewCreateVPCOfferingParams(displaytext string, name string, supportedservices []string) *CreateVPCOfferingParams { p := &CreateVPCOfferingParams{} p.p = make(map[string]interface{}) + p.p["displaytext"] = displaytext p.p["name"] = name p.p["supportedservices"] = supportedservices return p diff --git a/cloudstack/VPCService_mock.go b/cloudstack/VPCService_mock.go index d80ad5d..33dde55 100644 --- a/cloudstack/VPCService_mock.go +++ b/cloudstack/VPCService_mock.go @@ -429,31 +429,31 @@ func (mr *MockVPCServiceIfaceMockRecorder) NewCreateStaticRouteParams(cidr, gate } // NewCreateVPCOfferingParams mocks base method. -func (m *MockVPCServiceIface) NewCreateVPCOfferingParams(name string, supportedservices []string) *CreateVPCOfferingParams { +func (m *MockVPCServiceIface) NewCreateVPCOfferingParams(displaytext, name string, supportedservices []string) *CreateVPCOfferingParams { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewCreateVPCOfferingParams", name, supportedservices) + ret := m.ctrl.Call(m, "NewCreateVPCOfferingParams", displaytext, name, supportedservices) ret0, _ := ret[0].(*CreateVPCOfferingParams) return ret0 } // NewCreateVPCOfferingParams indicates an expected call of NewCreateVPCOfferingParams. -func (mr *MockVPCServiceIfaceMockRecorder) NewCreateVPCOfferingParams(name, supportedservices interface{}) *gomock.Call { +func (mr *MockVPCServiceIfaceMockRecorder) NewCreateVPCOfferingParams(displaytext, name, supportedservices interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewCreateVPCOfferingParams", reflect.TypeOf((*MockVPCServiceIface)(nil).NewCreateVPCOfferingParams), name, supportedservices) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewCreateVPCOfferingParams", reflect.TypeOf((*MockVPCServiceIface)(nil).NewCreateVPCOfferingParams), displaytext, name, supportedservices) } // NewCreateVPCParams mocks base method. -func (m *MockVPCServiceIface) NewCreateVPCParams(cidr, name, vpcofferingid, zoneid string) *CreateVPCParams { +func (m *MockVPCServiceIface) NewCreateVPCParams(cidr, displaytext, name, vpcofferingid, zoneid string) *CreateVPCParams { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewCreateVPCParams", cidr, name, vpcofferingid, zoneid) + ret := m.ctrl.Call(m, "NewCreateVPCParams", cidr, displaytext, name, vpcofferingid, zoneid) ret0, _ := ret[0].(*CreateVPCParams) return ret0 } // NewCreateVPCParams indicates an expected call of NewCreateVPCParams. -func (mr *MockVPCServiceIfaceMockRecorder) NewCreateVPCParams(cidr, name, vpcofferingid, zoneid interface{}) *gomock.Call { +func (mr *MockVPCServiceIfaceMockRecorder) NewCreateVPCParams(cidr, displaytext, name, vpcofferingid, zoneid interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewCreateVPCParams", reflect.TypeOf((*MockVPCServiceIface)(nil).NewCreateVPCParams), cidr, name, vpcofferingid, zoneid) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewCreateVPCParams", reflect.TypeOf((*MockVPCServiceIface)(nil).NewCreateVPCParams), cidr, displaytext, name, vpcofferingid, zoneid) } // NewDeletePrivateGatewayParams mocks base method. diff --git a/generate/generate.go b/generate/generate.go index 0a5b09a..71f3f35 100644 --- a/generate/generate.go +++ b/generate/generate.go @@ -1128,7 +1128,7 @@ func (s *service) generateAPITest(a *API) { pn(" }") p(" p := client.%s.New%s(", strings.TrimSuffix(s.name, "Service"), tn) for _, ap := range a.Params { - if ap.Required { + if ap.Required || isRequiredParam(a, ap) { rp = append(rp, ap) p("%s, ", getDefaultValueForType(a.Name, ap.Name, ap.Type)) } @@ -1196,8 +1196,7 @@ func (s *service) generateInterfaceType() { // NewParam funcs p("New%s(", tn) for _, ap := range api.Params { - if ap.Required { - // rp = append(rp, ap) + if ap.Required || isRequiredParam(api, ap) { p("%s %s, ", s.parseParamName(ap.Name), mapType(api.Name, ap.Name, ap.Type)) } } @@ -1219,7 +1218,7 @@ func (s *service) generateInterfaceType() { // Generate the function signature p("Get%sID(%s string, ", parseSingular(ln), v) for _, ap := range api.Params { - if ap.Required { + if ap.Required || isRequiredParam(api, ap) { p("%s %s, ", s.parseParamName(ap.Name), mapType(api.Name, ap.Name, ap.Type)) } } @@ -1234,7 +1233,7 @@ func (s *service) generateInterfaceType() { if hasIDParamField(api.Name, api.Params) { p("Get%sByName(name string, ", parseSingular(ln)) for _, ap := range api.Params { - if ap.Required { + if ap.Required || isRequiredParam(api, ap) { p("%s %s, ", s.parseParamName(ap.Name), mapType(api.Name, ap.Name, ap.Type)) } } @@ -1420,7 +1419,7 @@ func (s *service) generateNewParamTypeFunc(a *API) { pn("// as then you are sure you have configured all required params") p("func (s *%s) New%s(", s.name, tn) for _, ap := range a.Params { - if ap.Required { + if ap.Required || isRequiredParam(a, ap) { rp = append(rp, ap) p("%s %s, ", s.parseParamName(ap.Name), mapType(a.Name, ap.Name, ap.Type)) } @@ -1458,7 +1457,7 @@ func (s *service) generateHelperFuncs(a *API) { pn("// This is a courtesy helper function, which in some cases may not work as expected!") p("func (s *%s) Get%sID(%s string, ", s.name, parseSingular(ln), v) for _, ap := range a.Params { - if ap.Required { + if ap.Required || isRequiredParam(a, ap) { p("%s %s, ", s.parseParamName(ap.Name), mapType(a.Name, ap.Name, ap.Type)) } } @@ -1476,7 +1475,7 @@ func (s *service) generateHelperFuncs(a *API) { pn("") pn(" p.p[\"%s\"] = %s", v, v) for _, ap := range a.Params { - if ap.Required { + if ap.Required || isRequiredParam(a, ap) { pn(" p.p[\"%s\"] = %s", ap.Name, s.parseParamName(ap.Name)) } } @@ -1528,7 +1527,7 @@ func (s *service) generateHelperFuncs(a *API) { pn("// This is a courtesy helper function, which in some cases may not work as expected!") p("func (s *%s) Get%sByName(name string, ", s.name, parseSingular(ln)) for _, ap := range a.Params { - if ap.Required { + if ap.Required || isRequiredParam(a, ap) { p("%s %s, ", s.parseParamName(ap.Name), mapType(a.Name, ap.Name, ap.Type)) } } @@ -1543,7 +1542,7 @@ func (s *service) generateHelperFuncs(a *API) { // Generate the function body p(" id, count, err := s.Get%sID(name, ", parseSingular(ln)) for _, ap := range a.Params { - if ap.Required { + if ap.Required || isRequiredParam(a, ap) { p("%s, ", s.parseParamName(ap.Name)) } } @@ -1560,7 +1559,7 @@ func (s *service) generateHelperFuncs(a *API) { pn("") p(" r, count, err := s.Get%sByID(id, ", parseSingular(ln)) for _, ap := range a.Params { - if ap.Required { + if ap.Required || isRequiredParam(a, ap) { p("%s, ", s.parseParamName(ap.Name)) } } @@ -2116,6 +2115,17 @@ func testDir() (string, error) { } +func isRequiredParam(api *API, apiParam *APIParam) bool { + if params, ok := requiredParams[api.Name]; ok { + for _, param := range params { + if param == apiParam.Name { + return true + } + } + } + return false +} + func mapType(aName string, pName string, pType string) string { if _, ok := longToStringConvertedParams[pName]; ok { pType = "UUID" diff --git a/generate/requiredParams.go b/generate/requiredParams.go new file mode 100644 index 0000000..33d1e74 --- /dev/null +++ b/generate/requiredParams.go @@ -0,0 +1,54 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +package main + +// This map contains the API commands and the parameters which needs to be made +// made required to ensure backward compatibility with the older versions of +// the CloudStack API. + +var requiredParams = map[string][]string{ + "createNetworkOffering": { + "displaytext", + }, + "createDiskOffering": { + "displaytext", + }, + "createServiceOffering": { + "displaytext", + }, + "createVPCOffering": { + "displaytext", + }, + "registerIso": { + "displaytext", + }, + "createProject": { + "displaytext", + }, + "createTemplate": { + "displaytext", + }, + "registerTemplate": { + "displaytext", + }, + "createVPC": { + "displaytext", + }, +} diff --git a/test/DiskOfferingService_test.go b/test/DiskOfferingService_test.go index 49f47c3..efe301b 100644 --- a/test/DiskOfferingService_test.go +++ b/test/DiskOfferingService_test.go @@ -39,7 +39,7 @@ func TestDiskOfferingService(t *testing.T) { if _, ok := response["createDiskOffering"]; !ok { t.Skipf("Skipping as no json response is provided in testdata") } - p := client.DiskOffering.NewCreateDiskOfferingParams("name") + p := client.DiskOffering.NewCreateDiskOfferingParams("displaytext", "name") r, err := client.DiskOffering.CreateDiskOffering(p) if err != nil { t.Errorf(err.Error()) diff --git a/test/ISOService_test.go b/test/ISOService_test.go index a2a541a..b9e6d89 100644 --- a/test/ISOService_test.go +++ b/test/ISOService_test.go @@ -135,7 +135,7 @@ func TestISOService(t *testing.T) { if _, ok := response["registerIso"]; !ok { t.Skipf("Skipping as no json response is provided in testdata") } - p := client.ISO.NewRegisterIsoParams("name", "url", "zoneid") + p := client.ISO.NewRegisterIsoParams("displaytext", "name", "url", "zoneid") r, err := client.ISO.RegisterIso(p) if err != nil { t.Errorf(err.Error()) diff --git a/test/NetworkOfferingService_test.go b/test/NetworkOfferingService_test.go index 164e1c0..50bcb34 100644 --- a/test/NetworkOfferingService_test.go +++ b/test/NetworkOfferingService_test.go @@ -39,7 +39,7 @@ func TestNetworkOfferingService(t *testing.T) { if _, ok := response["createNetworkOffering"]; !ok { t.Skipf("Skipping as no json response is provided in testdata") } - p := client.NetworkOffering.NewCreateNetworkOfferingParams("guestiptype", "name", "traffictype") + p := client.NetworkOffering.NewCreateNetworkOfferingParams("displaytext", "guestiptype", "name", "traffictype") r, err := client.NetworkOffering.CreateNetworkOffering(p) if err != nil { t.Errorf(err.Error()) diff --git a/test/ProjectService_test.go b/test/ProjectService_test.go index 467f02b..be48b6b 100644 --- a/test/ProjectService_test.go +++ b/test/ProjectService_test.go @@ -78,7 +78,7 @@ func TestProjectService(t *testing.T) { if _, ok := response["createProject"]; !ok { t.Skipf("Skipping as no json response is provided in testdata") } - p := client.Project.NewCreateProjectParams("name") + p := client.Project.NewCreateProjectParams("displaytext", "name") r, err := client.Project.CreateProject(p) if err != nil { t.Errorf(err.Error()) diff --git a/test/ServiceOfferingService_test.go b/test/ServiceOfferingService_test.go index a587610..b66c608 100644 --- a/test/ServiceOfferingService_test.go +++ b/test/ServiceOfferingService_test.go @@ -39,7 +39,7 @@ func TestServiceOfferingService(t *testing.T) { if _, ok := response["createServiceOffering"]; !ok { t.Skipf("Skipping as no json response is provided in testdata") } - p := client.ServiceOffering.NewCreateServiceOfferingParams("name") + p := client.ServiceOffering.NewCreateServiceOfferingParams("displaytext", "name") r, err := client.ServiceOffering.CreateServiceOffering(p) if err != nil { t.Errorf(err.Error()) diff --git a/test/TemplateService_test.go b/test/TemplateService_test.go index 555482f..138eae4 100644 --- a/test/TemplateService_test.go +++ b/test/TemplateService_test.go @@ -54,7 +54,7 @@ func TestTemplateService(t *testing.T) { if _, ok := response["createTemplate"]; !ok { t.Skipf("Skipping as no json response is provided in testdata") } - p := client.Template.NewCreateTemplateParams("name", "ostypeid") + p := client.Template.NewCreateTemplateParams("displaytext", "name", "ostypeid") r, err := client.Template.CreateTemplate(p) if err != nil { t.Errorf(err.Error()) @@ -147,7 +147,7 @@ func TestTemplateService(t *testing.T) { if _, ok := response["registerTemplate"]; !ok { t.Skipf("Skipping as no json response is provided in testdata") } - p := client.Template.NewRegisterTemplateParams("format", "hypervisor", "name", "url") + p := client.Template.NewRegisterTemplateParams("displaytext", "format", "hypervisor", "name", "url") _, err := client.Template.RegisterTemplate(p) if err != nil { t.Errorf(err.Error()) diff --git a/test/VPCService_test.go b/test/VPCService_test.go index a1ca156..d045a89 100644 --- a/test/VPCService_test.go +++ b/test/VPCService_test.go @@ -69,7 +69,7 @@ func TestVPCService(t *testing.T) { if _, ok := response["createVPC"]; !ok { t.Skipf("Skipping as no json response is provided in testdata") } - p := client.VPC.NewCreateVPCParams("cidr", "name", "vpcofferingid", "zoneid") + p := client.VPC.NewCreateVPCParams("cidr", "displaytext", "name", "vpcofferingid", "zoneid") r, err := client.VPC.CreateVPC(p) if err != nil { t.Errorf(err.Error()) @@ -84,7 +84,7 @@ func TestVPCService(t *testing.T) { if _, ok := response["createVPCOffering"]; !ok { t.Skipf("Skipping as no json response is provided in testdata") } - p := client.VPC.NewCreateVPCOfferingParams("name", []string{}) + p := client.VPC.NewCreateVPCOfferingParams("displaytext", "name", []string{}) r, err := client.VPC.CreateVPCOffering(p) if err != nil { t.Errorf(err.Error())