diff --git a/modules/api/cmd/kubermatic-api/swagger.json b/modules/api/cmd/kubermatic-api/swagger.json index ef5296af6e..2928e7e0c9 100644 --- a/modules/api/cmd/kubermatic-api/swagger.json +++ b/modules/api/cmd/kubermatic-api/swagger.json @@ -14184,13 +14184,6 @@ ], "operationId": "listAWSSizesNoCredentialsV2", "parameters": [ - { - "type": "string", - "x-go-name": "Architecture", - "description": "architecture query parameter. Supports: arm64 and x64 types.", - "name": "architecture", - "in": "query" - }, { "type": "string", "x-go-name": "ProjectID", @@ -14204,6 +14197,13 @@ "name": "cluster_id", "in": "path", "required": true + }, + { + "type": "string", + "x-go-name": "Architecture", + "description": "architecture query parameter. Supports: arm64 and x64 types.", + "name": "architecture", + "in": "query" } ], "responses": { @@ -14718,11 +14718,6 @@ ], "operationId": "listKubeVirtInstancetypesNoCredentials", "parameters": [ - { - "type": "string", - "name": "DatacenterName", - "in": "header" - }, { "type": "string", "x-go-name": "ProjectID", @@ -14736,6 +14731,11 @@ "name": "cluster_id", "in": "path", "required": true + }, + { + "type": "string", + "name": "DatacenterName", + "in": "header" } ], "responses": { @@ -21824,57 +21824,95 @@ } } }, - "/api/v2/projects/{project_id}/providers/{provider_name}/presets": { + "/api/v2/projects/{project_id}/providers/openstack/availabilityzones": { "get": { - "description": "Lists presets for the provider in a specific project", + "description": "Lists availability zones from openstack", "produces": [ "application/json" ], "tags": [ - "preset" + "openstack" ], - "operationId": "listProjectProviderPresets", + "operationId": "listProjectOpenstackAvailabilityZones", "parameters": [ { "type": "string", - "x-go-name": "ProjectID", - "name": "project_id", - "in": "path", - "required": true + "name": "Username", + "in": "header" + }, + { + "type": "string", + "name": "Password", + "in": "header" + }, + { + "type": "string", + "name": "Domain", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackTenant", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackTenantID", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackProject", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackProjectID", + "in": "header" + }, + { + "type": "string", + "name": "DatacenterName", + "in": "header" + }, + { + "type": "string", + "name": "ApplicationCredentialID", + "in": "header" + }, + { + "type": "string", + "name": "ApplicationCredentialSecret", + "in": "header" }, { "type": "boolean", - "x-go-name": "Disabled", - "name": "disabled", - "in": "query" + "name": "OIDCAuthentication", + "in": "header" }, { "type": "string", - "x-go-name": "ProviderName", - "name": "provider_name", - "in": "path", - "required": true + "name": "Credential", + "in": "header" }, { "type": "string", - "x-go-name": "Datacenter", - "name": "datacenter", - "in": "query" + "x-go-name": "ProjectID", + "name": "project_id", + "in": "path", + "required": true } ], "responses": { "200": { - "description": "PresetList", + "description": "OpenstackAvailabilityZone", "schema": { - "$ref": "#/definitions/PresetList" + "type": "array", + "items": { + "$ref": "#/definitions/OpenstackAvailabilityZone" + } } }, - "401": { - "$ref": "#/responses/empty" - }, - "403": { - "$ref": "#/responses/empty" - }, "default": { "description": "errorResponse", "schema": { @@ -21884,17 +21922,77 @@ } } }, - "/api/v2/projects/{project_id}/quota": { + "/api/v2/projects/{project_id}/providers/openstack/networks": { "get": { + "description": "Lists networks from openstack", "produces": [ "application/json" ], "tags": [ - "project" + "openstack" ], - "summary": "Returns Resource Quota for a given project.", - "operationId": "getProjectQuota", + "operationId": "listProjectOpenstackNetworks", "parameters": [ + { + "type": "string", + "name": "Username", + "in": "header" + }, + { + "type": "string", + "name": "Password", + "in": "header" + }, + { + "type": "string", + "name": "Domain", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackTenant", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackTenantID", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackProject", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackProjectID", + "in": "header" + }, + { + "type": "string", + "name": "DatacenterName", + "in": "header" + }, + { + "type": "string", + "name": "ApplicationCredentialID", + "in": "header" + }, + { + "type": "string", + "name": "ApplicationCredentialSecret", + "in": "header" + }, + { + "type": "boolean", + "name": "OIDCAuthentication", + "in": "header" + }, + { + "type": "string", + "name": "Credential", + "in": "header" + }, { "type": "string", "x-go-name": "ProjectID", @@ -21905,17 +22003,14 @@ ], "responses": { "200": { - "description": "ResourceQuota", + "description": "OpenstackNetwork", "schema": { - "$ref": "#/definitions/ResourceQuota" + "type": "array", + "items": { + "$ref": "#/definitions/OpenstackNetwork" + } } }, - "401": { - "$ref": "#/responses/empty" - }, - "403": { - "$ref": "#/responses/empty" - }, "default": { "description": "errorResponse", "schema": { @@ -21925,32 +22020,714 @@ } } }, - "/api/v2/projects/{project_id}/quotacalculation": { - "post": { - "consumes": [ - "application/json" - ], + "/api/v2/projects/{project_id}/providers/openstack/securitygroups": { + "get": { + "description": "Lists security groups from openstack", "produces": [ "application/json" ], "tags": [ - "project" + "openstack" ], - "summary": "Calculates the projects resource quota updated by the given resources.", - "operationId": "calculateProjectResourceQuotaUpdate", + "operationId": "listProjectOpenstackSecurityGroups", "parameters": [ + { + "type": "string", + "name": "Username", + "in": "header" + }, + { + "type": "string", + "name": "Password", + "in": "header" + }, + { + "type": "string", + "name": "Domain", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackTenant", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackTenantID", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackProject", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackProjectID", + "in": "header" + }, + { + "type": "string", + "name": "DatacenterName", + "in": "header" + }, + { + "type": "string", + "name": "ApplicationCredentialID", + "in": "header" + }, + { + "type": "string", + "name": "ApplicationCredentialSecret", + "in": "header" + }, + { + "type": "boolean", + "name": "OIDCAuthentication", + "in": "header" + }, + { + "type": "string", + "name": "Credential", + "in": "header" + }, { "type": "string", "x-go-name": "ProjectID", "name": "project_id", "in": "path", "required": true - }, - { - "name": "Body", - "in": "body", - "schema": { - "type": "object", + } + ], + "responses": { + "200": { + "description": "OpenstackSecurityGroup", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/OpenstackSecurityGroup" + } + } + }, + "default": { + "description": "errorResponse", + "schema": { + "$ref": "#/definitions/errorResponse" + } + } + } + } + }, + "/api/v2/projects/{project_id}/providers/openstack/servergroups": { + "get": { + "description": "Lists server groups from openstack", + "produces": [ + "application/json" + ], + "tags": [ + "openstack" + ], + "operationId": "listProjectOpenstackServerGroups", + "parameters": [ + { + "type": "string", + "name": "Username", + "in": "header" + }, + { + "type": "string", + "name": "Password", + "in": "header" + }, + { + "type": "string", + "name": "Domain", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackTenant", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackTenantID", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackProject", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackProjectID", + "in": "header" + }, + { + "type": "string", + "name": "DatacenterName", + "in": "header" + }, + { + "type": "string", + "name": "ApplicationCredentialID", + "in": "header" + }, + { + "type": "string", + "name": "ApplicationCredentialSecret", + "in": "header" + }, + { + "type": "boolean", + "name": "OIDCAuthentication", + "in": "header" + }, + { + "type": "string", + "name": "Credential", + "in": "header" + }, + { + "type": "string", + "x-go-name": "ProjectID", + "name": "project_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OpenstackServerGroup", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/OpenstackServerGroup" + } + } + }, + "default": { + "description": "errorResponse", + "schema": { + "$ref": "#/definitions/errorResponse" + } + } + } + } + }, + "/api/v2/projects/{project_id}/providers/openstack/sizes": { + "get": { + "description": "Lists sizes from openstack", + "produces": [ + "application/json" + ], + "tags": [ + "openstack" + ], + "operationId": "listProjectOpenstackSizes", + "parameters": [ + { + "type": "string", + "name": "Username", + "in": "header" + }, + { + "type": "string", + "name": "Password", + "in": "header" + }, + { + "type": "string", + "name": "Domain", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackTenant", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackTenantID", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackProject", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackProjectID", + "in": "header" + }, + { + "type": "string", + "name": "DatacenterName", + "in": "header" + }, + { + "type": "string", + "name": "ApplicationCredentialID", + "in": "header" + }, + { + "type": "string", + "name": "ApplicationCredentialSecret", + "in": "header" + }, + { + "type": "boolean", + "name": "OIDCAuthentication", + "in": "header" + }, + { + "type": "string", + "name": "Credential", + "in": "header" + }, + { + "type": "string", + "x-go-name": "ProjectID", + "name": "project_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OpenstackSize", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/OpenstackSize" + } + } + }, + "default": { + "description": "errorResponse", + "schema": { + "$ref": "#/definitions/errorResponse" + } + } + } + } + }, + "/api/v2/projects/{project_id}/providers/openstack/subnetpools": { + "get": { + "description": "Lists subnet pools from openstack", + "produces": [ + "application/json" + ], + "tags": [ + "openstack" + ], + "operationId": "listProjectOpenstackSubnetPools", + "parameters": [ + { + "type": "string", + "name": "Username", + "in": "header" + }, + { + "type": "string", + "name": "Password", + "in": "header" + }, + { + "type": "string", + "name": "Domain", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackTenant", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackTenantID", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackProject", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackProjectID", + "in": "header" + }, + { + "type": "string", + "name": "DatacenterName", + "in": "header" + }, + { + "type": "string", + "name": "ApplicationCredentialID", + "in": "header" + }, + { + "type": "string", + "name": "ApplicationCredentialSecret", + "in": "header" + }, + { + "type": "boolean", + "name": "OIDCAuthentication", + "in": "header" + }, + { + "type": "string", + "name": "Credential", + "in": "header" + }, + { + "type": "integer", + "format": "int64", + "x-go-name": "IPVersion", + "name": "ip_version", + "in": "query" + }, + { + "type": "string", + "x-go-name": "ProjectID", + "name": "project_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OpenstackSubnetPool", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/OpenstackSubnetPool" + } + } + }, + "default": { + "description": "errorResponse", + "schema": { + "$ref": "#/definitions/errorResponse" + } + } + } + } + }, + "/api/v2/projects/{project_id}/providers/openstack/subnets": { + "get": { + "description": "Lists subnets from openstack", + "produces": [ + "application/json" + ], + "tags": [ + "openstack" + ], + "operationId": "listProjectOpenstackSubnets", + "parameters": [ + { + "type": "string", + "name": "Username", + "in": "header" + }, + { + "type": "string", + "name": "Password", + "in": "header" + }, + { + "type": "string", + "name": "Domain", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackTenant", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackTenantID", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackProject", + "in": "header" + }, + { + "type": "string", + "name": "OpenstackProjectID", + "in": "header" + }, + { + "type": "string", + "name": "DatacenterName", + "in": "header" + }, + { + "type": "string", + "name": "ApplicationCredentialID", + "in": "header" + }, + { + "type": "string", + "name": "ApplicationCredentialSecret", + "in": "header" + }, + { + "type": "boolean", + "name": "OIDCAuthentication", + "in": "header" + }, + { + "type": "string", + "name": "Credential", + "in": "header" + }, + { + "type": "string", + "x-go-name": "NetworkID", + "name": "network_id", + "in": "query" + }, + { + "type": "string", + "x-go-name": "ProjectID", + "name": "project_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OpenstackSubnet", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/OpenstackSubnet" + } + } + }, + "default": { + "description": "errorResponse", + "schema": { + "$ref": "#/definitions/errorResponse" + } + } + } + } + }, + "/api/v2/projects/{project_id}/providers/openstack/tenants": { + "get": { + "description": "Lists tenants from openstack", + "produces": [ + "application/json" + ], + "tags": [ + "openstack" + ], + "operationId": "listProjectOpenstackTenants", + "parameters": [ + { + "type": "string", + "name": "Username", + "in": "header" + }, + { + "type": "string", + "name": "Password", + "in": "header" + }, + { + "type": "string", + "name": "Domain", + "in": "header" + }, + { + "type": "string", + "name": "DatacenterName", + "in": "header" + }, + { + "type": "string", + "name": "ApplicationCredentialID", + "in": "header" + }, + { + "type": "string", + "name": "ApplicationCredentialSecret", + "in": "header" + }, + { + "type": "boolean", + "name": "OIDCAuthentication", + "in": "header" + }, + { + "type": "string", + "name": "Credential", + "in": "header" + }, + { + "type": "string", + "x-go-name": "ProjectID", + "name": "project_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OpenstackTenant", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/OpenstackTenant" + } + } + }, + "default": { + "description": "errorResponse", + "schema": { + "$ref": "#/definitions/errorResponse" + } + } + } + } + }, + "/api/v2/projects/{project_id}/providers/{provider_name}/presets": { + "get": { + "description": "Lists presets for the provider in a specific project", + "produces": [ + "application/json" + ], + "tags": [ + "preset" + ], + "operationId": "listProjectProviderPresets", + "parameters": [ + { + "type": "string", + "x-go-name": "ProjectID", + "name": "project_id", + "in": "path", + "required": true + }, + { + "type": "boolean", + "x-go-name": "Disabled", + "name": "disabled", + "in": "query" + }, + { + "type": "string", + "x-go-name": "ProviderName", + "name": "provider_name", + "in": "path", + "required": true + }, + { + "type": "string", + "x-go-name": "Datacenter", + "name": "datacenter", + "in": "query" + } + ], + "responses": { + "200": { + "description": "PresetList", + "schema": { + "$ref": "#/definitions/PresetList" + } + }, + "401": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/empty" + }, + "default": { + "description": "errorResponse", + "schema": { + "$ref": "#/definitions/errorResponse" + } + } + } + } + }, + "/api/v2/projects/{project_id}/quota": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "project" + ], + "summary": "Returns Resource Quota for a given project.", + "operationId": "getProjectQuota", + "parameters": [ + { + "type": "string", + "x-go-name": "ProjectID", + "name": "project_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ResourceQuota", + "schema": { + "$ref": "#/definitions/ResourceQuota" + } + }, + "401": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/empty" + }, + "default": { + "description": "errorResponse", + "schema": { + "$ref": "#/definitions/errorResponse" + } + } + } + } + }, + "/api/v2/projects/{project_id}/quotacalculation": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "project" + ], + "summary": "Calculates the projects resource quota updated by the given resources.", + "operationId": "calculateProjectResourceQuotaUpdate", + "parameters": [ + { + "type": "string", + "x-go-name": "ProjectID", + "name": "project_id", + "in": "path", + "required": true + }, + { + "name": "Body", + "in": "body", + "schema": { + "type": "object", "properties": { "alibabaInstanceType": { "$ref": "#/definitions/AlibabaInstanceType" @@ -23718,22 +24495,22 @@ }, { "type": "string", - "name": "Tenant", + "name": "OpenstackTenant", "in": "header" }, { "type": "string", - "name": "TenantID", + "name": "OpenstackTenantID", "in": "header" }, { "type": "string", - "name": "Project", + "name": "OpenstackProject", "in": "header" }, { "type": "string", - "name": "ProjectID", + "name": "OpenstackProjectID", "in": "header" }, { @@ -23809,22 +24586,22 @@ }, { "type": "string", - "name": "Tenant", + "name": "OpenstackTenant", "in": "header" }, { "type": "string", - "name": "TenantID", + "name": "OpenstackTenantID", "in": "header" }, { "type": "string", - "name": "Project", + "name": "OpenstackProject", "in": "header" }, { "type": "string", - "name": "ProjectID", + "name": "OpenstackProjectID", "in": "header" }, { diff --git a/modules/api/pkg/handler/v2/provider/openstack.go b/modules/api/pkg/handler/v2/provider/openstack.go index ec7f01d4fa..df3c5e9aa0 100644 --- a/modules/api/pkg/handler/v2/provider/openstack.go +++ b/modules/api/pkg/handler/v2/provider/openstack.go @@ -27,14 +27,219 @@ import ( "github.com/go-kit/kit/endpoint" apiv1 "k8c.io/dashboard/v2/pkg/api/v1" + handlercommon "k8c.io/dashboard/v2/pkg/handler/common" providercommon "k8c.io/dashboard/v2/pkg/handler/common/provider" + "k8c.io/dashboard/v2/pkg/handler/middleware" "k8c.io/dashboard/v2/pkg/handler/v1/common" - providerv1 "k8c.io/dashboard/v2/pkg/handler/v1/provider" "k8c.io/dashboard/v2/pkg/handler/v2/cluster" "k8c.io/dashboard/v2/pkg/provider" + "k8c.io/kubermatic/v2/pkg/resources" utilerrors "k8c.io/kubermatic/v2/pkg/util/errors" + + "k8s.io/utils/pointer" ) +func GetOpenstackAuthInfo(ctx context.Context, req OpenstackReq, projectID string, userInfoGetter provider.UserInfoGetter, presetProvider provider.PresetProvider) (*provider.UserInfo, *resources.OpenstackCredentials, error) { + var cred resources.OpenstackCredentials + userInfo, err := userInfoGetter(ctx, projectID) + if err != nil { + return nil, nil, common.KubernetesErrorToHTTPError(err) + } + + t := ctx.Value(middleware.RawTokenContextKey) + token, ok := t.(string) + if !ok || token == "" { + return nil, nil, utilerrors.NewNotAuthorized() + } + + // No preset is used + presetName := req.Credential + if presetName == "" { + cred = resources.OpenstackCredentials{ + Username: req.Username, + Password: req.Password, + Project: req.GetProjectOrDefaultToTenant(), + ProjectID: req.GetProjectIdOrDefaultToTenantId(), + Domain: req.Domain, + ApplicationCredentialID: req.ApplicationCredentialID, + ApplicationCredentialSecret: req.ApplicationCredentialSecret, + } + if req.OIDCAuthentication { + cred.Token = token + } + } else { + // Preset is used + cred, err = getPresetCredentials(ctx, userInfo, presetName, projectID, presetProvider, token) + if err != nil { + return nil, nil, fmt.Errorf("error getting preset credentials for OpenStack: %w", err) + } + } + + return userInfo, &cred, nil +} + +func getPresetCredentials(ctx context.Context, userInfo *provider.UserInfo, presetName string, projectID string, presetProvider provider.PresetProvider, token string) (resources.OpenstackCredentials, error) { + p, err := presetProvider.GetPreset(ctx, userInfo, pointer.String(projectID), presetName) + if err != nil { + return resources.OpenstackCredentials{}, fmt.Errorf("can not get preset %s for user %s", presetName, userInfo.Email) + } + + if p.Spec.Openstack == nil { + return resources.OpenstackCredentials{}, fmt.Errorf("credentials for OpenStack provider not present in preset %s for the user %s", presetName, userInfo.Email) + } + + credentials := resources.OpenstackCredentials{ + Username: p.Spec.Openstack.Username, + Password: p.Spec.Openstack.Password, + Project: p.Spec.Openstack.Project, + ProjectID: p.Spec.Openstack.ProjectID, + Domain: p.Spec.Openstack.Domain, + ApplicationCredentialID: p.Spec.Openstack.ApplicationCredentialID, + ApplicationCredentialSecret: p.Spec.Openstack.ApplicationCredentialSecret, + } + + if p.Spec.Openstack.UseToken { + credentials.Token = token + } + + return credentials, nil +} + +func OpenstackSizeEndpoint(seedsGetter provider.SeedsGetter, presetProvider provider.PresetProvider, + userInfoGetter provider.UserInfoGetter, settingsProvider provider.SettingsProvider, caBundle *x509.CertPool) endpoint.Endpoint { + return func(ctx context.Context, request interface{}) (interface{}, error) { + req, ok := request.(OpenstackProjectReq) + if !ok { + return nil, utilerrors.NewBadRequest("invalid request") + } + + userInfo, cred, err := GetOpenstackAuthInfo(ctx, req.OpenstackReq, req.GetProjectID(), userInfoGetter, presetProvider) + if err != nil { + return nil, err + } + + datacenterName := req.DatacenterName + _, datacenter, err := provider.DatacenterFromSeedMap(userInfo, seedsGetter, datacenterName) + if err != nil { + return nil, fmt.Errorf("error getting dc: %w", err) + } + + settings, err := settingsProvider.GetGlobalSettings(ctx) + if err != nil { + return nil, common.KubernetesErrorToHTTPError(err) + } + + filter := handlercommon.DetermineMachineFlavorFilter(datacenter.Spec.MachineFlavorFilter, settings.Spec.MachineDeploymentVMResourceQuota) + + return providercommon.GetOpenstackSizes(cred, datacenter, filter, caBundle) + } +} + +func OpenstackAvailabilityZoneEndpoint(seedsGetter provider.SeedsGetter, presetProvider provider.PresetProvider, + userInfoGetter provider.UserInfoGetter, caBundle *x509.CertPool) endpoint.Endpoint { + return func(ctx context.Context, request interface{}) (interface{}, error) { + req, ok := request.(OpenstackProjectReq) + if !ok { + return nil, utilerrors.NewBadRequest("invalid request") + } + + userInfo, cred, err := GetOpenstackAuthInfo(ctx, req.OpenstackReq, req.GetProjectID(), userInfoGetter, presetProvider) + if err != nil { + return nil, err + } + + datacenterName := req.DatacenterName + _, datacenter, err := provider.DatacenterFromSeedMap(userInfo, seedsGetter, datacenterName) + if err != nil { + return nil, fmt.Errorf("error getting dc: %w", err) + } + + return providercommon.GetOpenstackAvailabilityZones(ctx, datacenter, cred, caBundle) + } +} + +func OpenstackNetworkEndpoint(seedsGetter provider.SeedsGetter, presetProvider provider.PresetProvider, + userInfoGetter provider.UserInfoGetter, caBundle *x509.CertPool) endpoint.Endpoint { + return func(ctx context.Context, request interface{}) (interface{}, error) { + req, ok := request.(OpenstackProjectReq) + if !ok { + return nil, utilerrors.NewBadRequest("invalid request") + } + + userInfo, cred, err := GetOpenstackAuthInfo(ctx, req.OpenstackReq, req.GetProjectID(), userInfoGetter, presetProvider) + if err != nil { + return nil, err + } + + return providercommon.GetOpenstackNetworks(ctx, userInfo, seedsGetter, cred, req.DatacenterName, caBundle) + } +} + +func OpenstackSubnetsEndpoint(seedsGetter provider.SeedsGetter, presetProvider provider.PresetProvider, + userInfoGetter provider.UserInfoGetter, caBundle *x509.CertPool) endpoint.Endpoint { + return func(ctx context.Context, request interface{}) (interface{}, error) { + req, ok := request.(OpenstackProjectSubnetReq) + if !ok { + return nil, utilerrors.NewBadRequest("invalid request") + } + + userInfo, cred, err := GetOpenstackAuthInfo(ctx, req.OpenstackReq, req.GetProjectID(), userInfoGetter, presetProvider) + if err != nil { + return nil, err + } + + return providercommon.GetOpenstackSubnets(ctx, userInfo, seedsGetter, cred, req.NetworkID, req.DatacenterName, caBundle) + } +} + +func OpenstackSecurityGroupEndpoint(seedsGetter provider.SeedsGetter, presetProvider provider.PresetProvider, + userInfoGetter provider.UserInfoGetter, caBundle *x509.CertPool) endpoint.Endpoint { + return func(ctx context.Context, request interface{}) (interface{}, error) { + req, ok := request.(OpenstackProjectReq) + if !ok { + return nil, utilerrors.NewBadRequest("invalid request") + } + + userInfo, cred, err := GetOpenstackAuthInfo(ctx, req.OpenstackReq, req.GetProjectID(), userInfoGetter, presetProvider) + if err != nil { + return nil, err + } + + return providercommon.GetOpenstackSecurityGroups(ctx, userInfo, seedsGetter, cred, req.DatacenterName, caBundle) + } +} + +func OpenstackTenantEndpoint(seedsGetter provider.SeedsGetter, presetProvider provider.PresetProvider, + userInfoGetter provider.UserInfoGetter, caBundle *x509.CertPool) endpoint.Endpoint { + return func(ctx context.Context, request interface{}) (interface{}, error) { + reqTenant, ok := request.(OpenstackProjectTenantReq) + if !ok { + return nil, utilerrors.NewBadRequest("invalid request") + } + + // construct a pseudo req to get auth info + req := OpenstackReq{ + Username: reqTenant.Username, + Password: reqTenant.Password, + Domain: reqTenant.Domain, + OpenstackTenant: "", + OpenstackTenantID: "", + DatacenterName: reqTenant.DatacenterName, + ApplicationCredentialID: reqTenant.ApplicationCredentialID, + ApplicationCredentialSecret: reqTenant.ApplicationCredentialSecret, + Credential: reqTenant.Credential, + OIDCAuthentication: reqTenant.OIDCAuthentication, + } + + userInfo, cred, err := GetOpenstackAuthInfo(ctx, req, reqTenant.GetProjectID(), userInfoGetter, presetProvider) + if err != nil { + return nil, err + } + + return providercommon.GetOpenstackProjects(userInfo, seedsGetter, cred, reqTenant.DatacenterName, caBundle) + } +} + func OpenstackSizeWithClusterCredentialsEndpoint(projectProvider provider.ProjectProvider, privilegedProjectProvider provider.PrivilegedProjectProvider, seedsGetter provider.SeedsGetter, userInfoGetter provider.UserInfoGetter, settingsProvider provider.SettingsProvider, caBundle *x509.CertPool) endpoint.Endpoint { @@ -86,14 +291,31 @@ func OpenstackServerGroupWithClusterCredentialsEndpoint(projectProvider provider } func OpenstackServerGroupEndpoint(seedsGetter provider.SeedsGetter, presetProvider provider.PresetProvider, - userInfoGetter provider.UserInfoGetter, caBundle *x509.CertPool) endpoint.Endpoint { + userInfoGetter provider.UserInfoGetter, caBundle *x509.CertPool, withProject bool) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (interface{}, error) { - req, ok := request.(OpenstackReq) - if !ok { - return nil, fmt.Errorf("incorrect type of request, expected = OpenstackReq, got %T", request) + var ( + req OpenstackReq + projectID string + ) + + if !withProject { + openstackReq, ok := request.(OpenstackReq) + if !ok { + return nil, utilerrors.NewBadRequest("invalid request") + } + + req = openstackReq + } else { + openstackProjectReq, ok := request.(OpenstackProjectReq) + if !ok { + return nil, utilerrors.NewBadRequest("invalid request") + } + + req = openstackProjectReq.OpenstackReq + projectID = openstackProjectReq.GetProjectID() } - userInfo, cred, err := providerv1.GetOpenstackAuthInfo(ctx, providerv1.OpenstackReq(req), userInfoGetter, presetProvider) + userInfo, cred, err := GetOpenstackAuthInfo(ctx, req, projectID, userInfoGetter, presetProvider) if err != nil { return nil, err } @@ -122,13 +344,31 @@ func OpenstackAvailabilityZoneWithClusterCredentialsEndpoint(projectProvider pro } func OpenstackSubnetPoolEndpoint(seedsGetter provider.SeedsGetter, presetProvider provider.PresetProvider, - userInfoGetter provider.UserInfoGetter, caBundle *x509.CertPool) endpoint.Endpoint { + userInfoGetter provider.UserInfoGetter, caBundle *x509.CertPool, withProject bool) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (interface{}, error) { - req, ok := request.(OpenstackSubnetPoolReq) - if !ok { - return nil, fmt.Errorf("incorrect type of request, expected = OpenstackReq, got %T", request) + var ( + req OpenstackSubnetPoolReq + projectID string + ) + + if !withProject { + subnetReq, ok := request.(OpenstackSubnetPoolReq) + if !ok { + return nil, utilerrors.NewBadRequest("invalid request") + } + + req = subnetReq + } else { + subnetProjectReq, ok := request.(OpenstackProjectSubnetPoolReq) + if !ok { + return nil, utilerrors.NewBadRequest("invalid request") + } + + req = subnetProjectReq.OpenstackSubnetPoolReq + projectID = subnetProjectReq.GetProjectID() } - userInfo, cred, err := providerv1.GetOpenstackAuthInfo(ctx, req.OpenstackReq, userInfoGetter, presetProvider) + + userInfo, cred, err := GetOpenstackAuthInfo(ctx, req.OpenstackReq, projectID, userInfoGetter, presetProvider) if err != nil { return nil, err } @@ -200,7 +440,7 @@ func DecodeOpenstackSubnetNoCredentialsReq(c context.Context, r *http.Request) ( // OpenstackSubnetPoolReq represent a request for openstack subnet pools // swagger:parameters listOpenstackSubnetPools type OpenstackSubnetPoolReq struct { - providerv1.OpenstackReq + OpenstackReq // in: query IPVersion int `json:"ip_version,omitempty"` } @@ -208,11 +448,11 @@ type OpenstackSubnetPoolReq struct { func DecodeOpenstackSubnetPoolReq(_ context.Context, r *http.Request) (interface{}, error) { var req OpenstackSubnetPoolReq - openstackReq, err := providerv1.DecodeOpenstackReq(context.Background(), r) + openstackReq, err := DecodeOpenstackReq(context.Background(), r) if err != nil { return nil, err } - req.OpenstackReq = openstackReq.(providerv1.OpenstackReq) + req.OpenstackReq = openstackReq.(OpenstackReq) ipVersion := r.URL.Query().Get("ip_version") if ipVersion != "" { @@ -238,17 +478,17 @@ type OpenstackReq struct { // Domain OpenStack domain name Domain string // in: header - // Tenant OpenStack tenant name (depreciated in favor of Project instead) - Tenant string + // OpenstackTenant OpenStack tenant name (depreciated in favor of Project instead) + OpenstackTenant string // in: header - // TenantID OpenStack tenant ID (depreciated in favor of ProjectID instead) - TenantID string + // OpenstackTenantID OpenStack tenant ID (depreciated in favor of ProjectID instead) + OpenstackTenantID string // in: header - // Project OpenStack project name - Project string + // OpenstackProject OpenStack project name + OpenstackProject string // in: header - // ProjectID OpenStack project ID - ProjectID string + // OpenstackProjectID OpenStack project ID + OpenstackProjectID string // in: header // DatacenterName Openstack datacenter name DatacenterName string @@ -267,15 +507,143 @@ type OpenstackReq struct { Credential string } +// GetProjectOrDefaultToTenant returns the the project if defined otherwise fallback to tenant. +func (r OpenstackReq) GetProjectOrDefaultToTenant() string { + if len(r.OpenstackProject) > 0 { + return r.OpenstackProject + } else { + return r.OpenstackTenant + } +} + +// GetProjectIdOrDefaultToTenantId returns the the projectID if defined otherwise fallback to tenantID. +func (r OpenstackReq) GetProjectIdOrDefaultToTenantId() string { + if len(r.OpenstackProjectID) > 0 { + return r.OpenstackProjectID + } else { + return r.OpenstackTenantID + } +} + +// OpenstackProjectReq represent a request for Openstack data within the context of a KKP project. +// swagger:parameters listProjectOpenstackSizes listProjectOpenstackAvailabilityZones listProjectOpenstackNetworks listProjectOpenstackSecurityGroups listProjectOpenstackServerGroups +type OpenstackProjectReq struct { + OpenstackReq + common.ProjectReq +} + +// OpenstackProjectSubnetPoolReq represent a request for openstack subnet pools within the context of a KKP project. +// swagger:parameters listProjectOpenstackSubnetPools +type OpenstackProjectSubnetPoolReq struct { + OpenstackSubnetPoolReq + common.ProjectReq +} + +// OpenstackTenantReq represent a request for openstack tenants. +type OpenstackTenantReq struct { + // in: header + // Username OpenStack user name + Username string + // in: header + // Password OpenStack user password + Password string + // in: header + // Domain OpenStack domain name + Domain string + // in: header + // DatacenterName Openstack datacenter name + DatacenterName string + // in: header + // ApplicationCredentialID application credential ID + ApplicationCredentialID string + // in: header + // ApplicationCredentialSecret application credential Secret + ApplicationCredentialSecret string + // in: header + // OIDCAuthentication when true use OIDC token + OIDCAuthentication bool + // in: header + // Credential predefined Kubermatic credential name from the presets + Credential string +} + +// OpenstackProjectTenantReq represent a request for openstack tenants within the context of a KKP project. +// swagger:parameters listProjectOpenstackTenants +type OpenstackProjectTenantReq struct { + OpenstackTenantReq + common.ProjectReq +} + +// OpenstackSubnetReq represent a request for openstack subnets. +type OpenstackSubnetReq struct { + OpenstackReq + // in: query + NetworkID string `json:"network_id,omitempty"` +} + +// OpenstackProjectSubnetReq represent a request for openstack subnets within the context of a KKP project. +// swagger:parameters listProjectOpenstackSubnets +type OpenstackProjectSubnetReq struct { + OpenstackSubnetReq + common.ProjectReq +} + func DecodeOpenstackReq(_ context.Context, r *http.Request) (interface{}, error) { var req OpenstackReq req.Username = r.Header.Get("Username") req.Password = r.Header.Get("Password") - req.Tenant = r.Header.Get("Tenant") - req.TenantID = r.Header.Get("TenantID") - req.Tenant = r.Header.Get("Project") - req.TenantID = r.Header.Get("ProjectID") + req.OpenstackTenant = r.Header.Get("Tenant") + req.OpenstackTenantID = r.Header.Get("TenantID") + req.OpenstackTenant = r.Header.Get("Project") + req.OpenstackTenantID = r.Header.Get("ProjectID") + req.Domain = r.Header.Get("Domain") + req.DatacenterName = r.Header.Get("DatacenterName") + req.ApplicationCredentialID = r.Header.Get("ApplicationCredentialID") + req.ApplicationCredentialSecret = r.Header.Get("ApplicationCredentialSecret") + req.OIDCAuthentication = strings.EqualFold(r.Header.Get("OIDCAuthentication"), "true") + req.Credential = r.Header.Get("Credential") + return req, nil +} + +func DecodeOpenstackProjectReq(c context.Context, r *http.Request) (interface{}, error) { + projectReq, err := common.DecodeProjectRequest(c, r) + if err != nil { + return nil, err + } + + openstackReq, err := DecodeOpenstackReq(c, r) + if err != nil { + return nil, err + } + + return OpenstackProjectReq{ + ProjectReq: projectReq.(common.ProjectReq), + OpenstackReq: openstackReq.(OpenstackReq), + }, nil +} + +func DecodeOpenstackProjectSubnetPoolReq(c context.Context, r *http.Request) (interface{}, error) { + projectReq, err := common.DecodeProjectRequest(c, r) + if err != nil { + return nil, err + } + + openstackReq, err := DecodeOpenstackSubnetPoolReq(c, r) + if err != nil { + return nil, err + } + + return OpenstackProjectSubnetPoolReq{ + ProjectReq: projectReq.(common.ProjectReq), + OpenstackSubnetPoolReq: openstackReq.(OpenstackSubnetPoolReq), + }, nil +} + +func DecodeOpenstackTenantReq(_ context.Context, r *http.Request) (interface{}, error) { + var req OpenstackTenantReq + req.Username = r.Header.Get("Username") + req.Password = r.Header.Get("Password") req.Domain = r.Header.Get("Domain") req.DatacenterName = r.Header.Get("DatacenterName") req.ApplicationCredentialID = r.Header.Get("ApplicationCredentialID") @@ -284,3 +652,54 @@ func DecodeOpenstackReq(_ context.Context, r *http.Request) (interface{}, error) req.Credential = r.Header.Get("Credential") return req, nil } + +func DecodeOpenstackProjectTenantReq(c context.Context, r *http.Request) (interface{}, error) { + projectReq, err := common.DecodeProjectRequest(c, r) + if err != nil { + return nil, err + } + + openstackReq, err := DecodeOpenstackTenantReq(c, r) + if err != nil { + return nil, err + } + + return OpenstackProjectTenantReq{ + ProjectReq: projectReq.(common.ProjectReq), + OpenstackTenantReq: openstackReq.(OpenstackTenantReq), + }, nil +} + +func DecodeOpenstackSubnetReq(c context.Context, r *http.Request) (interface{}, error) { + openstackReq, err := DecodeOpenstackReq(c, r) + if err != nil { + return nil, err + } + + networkID := r.URL.Query().Get("network_id") + if networkID == "" { + return nil, fmt.Errorf("'network_id' is a required parameter and may not be empty") + } + + return OpenstackSubnetReq{ + OpenstackReq: openstackReq.(OpenstackReq), + NetworkID: networkID, + }, nil +} + +func DecodeOpenstackProjectSubnetReq(c context.Context, r *http.Request) (interface{}, error) { + projectReq, err := common.DecodeProjectRequest(c, r) + if err != nil { + return nil, err + } + + openstackReq, err := DecodeOpenstackSubnetReq(c, r) + if err != nil { + return nil, err + } + + return OpenstackProjectSubnetReq{ + ProjectReq: projectReq.(common.ProjectReq), + OpenstackSubnetReq: openstackReq.(OpenstackSubnetReq), + }, nil +} diff --git a/modules/api/pkg/handler/v2/routes_v2.go b/modules/api/pkg/handler/v2/routes_v2.go index ec7e91c156..ed84517da6 100644 --- a/modules/api/pkg/handler/v2/routes_v2.go +++ b/modules/api/pkg/handler/v2/routes_v2.go @@ -836,32 +836,40 @@ func (r Routing) RegisterV2(mux *mux.Router, oidcKubeConfEndpoint bool, oidcCfg Path("/projects/{project_id}/providers/digitalocean/sizes"). Handler(r.listProjectDigitaloceanSizes()) - // Openstack endpoints - mux.Methods(http.MethodGet). - Path("/projects/{project_id}/providers/openstack/sizes"). - Handler(r.listProjectOpenstackSizes()) + */ - mux.Methods(http.MethodGet). - Path("/projects/{project_id}/providers/openstack/tenants"). - Handler(r.listProjectOpenstackTenants()) + // Openstack endpoints + mux.Methods(http.MethodGet). + Path("/projects/{project_id}/providers/openstack/sizes"). + Handler(r.listProjectOpenstackSizes()) - mux.Methods(http.MethodGet). - Path("/projects/{project_id}/providers/openstack/networks"). - Handler(r.listProjectOpenstackNetworks()) + mux.Methods(http.MethodGet). + Path("/projects/{project_id}/providers/openstack/tenants"). + Handler(r.listProjectOpenstackTenants()) - mux.Methods(http.MethodGet). - Path("/projects/{project_id}/providers/openstack/securitygroups"). - Handler(r.listProjectOpenstackSecurityGroups()) + mux.Methods(http.MethodGet). + Path("/projects/{project_id}/providers/openstack/networks"). + Handler(r.listProjectOpenstackNetworks()) - mux.Methods(http.MethodGet). - Path("/projects/{project_id}/providers/openstack/subnets"). - Handler(r.listProjectOpenstackSubnets()) + mux.Methods(http.MethodGet). + Path("/projects/{project_id}/providers/openstack/securitygroups"). + Handler(r.listProjectOpenstackSecurityGroups()) - mux.Methods(http.MethodGet). - Path("/projects/{project_id}/providers/openstack/availabilityzones"). - Handler(r.listProjectOpenstackAvailabilityZones()) + mux.Methods(http.MethodGet). + Path("/projects/{project_id}/providers/openstack/subnets"). + Handler(r.listProjectOpenstackSubnets()) - */ + mux.Methods(http.MethodGet). + Path("/projects/{project_id}/providers/openstack/availabilityzones"). + Handler(r.listProjectOpenstackAvailabilityZones()) + + mux.Methods(http.MethodGet). + Path("/projects/{project_id}/providers/openstack/subnetpools"). + Handler(r.listProjectOpenstackSubnetPools()) + + mux.Methods(http.MethodGet). + Path("/projects/{project_id}/providers/openstack/servergroups"). + Handler(r.listProjectOpenstackServerGroups()) // Equinix Metal (Packet) endpoints mux.Methods(http.MethodGet). @@ -4135,7 +4143,7 @@ func (r Routing) listOpenstackServerGroups() http.Handler { endpoint.Chain( middleware.TokenVerifier(r.tokenVerifiers, r.userProvider), middleware.UserSaver(r.userProvider), - )(provider.OpenstackServerGroupEndpoint(r.seedsGetter, r.presetProvider, r.userInfoGetter, r.caBundle)), + )(provider.OpenstackServerGroupEndpoint(r.seedsGetter, r.presetProvider, r.userInfoGetter, r.caBundle, false)), provider.DecodeOpenstackReq, handler.EncodeJSON, r.defaultServerOptions()..., @@ -4207,7 +4215,7 @@ func (r Routing) listOpenstackSubnetPools() http.Handler { endpoint.Chain( middleware.TokenVerifier(r.tokenVerifiers, r.userProvider), middleware.UserSaver(r.userProvider), - )(provider.OpenstackSubnetPoolEndpoint(r.seedsGetter, r.presetProvider, r.userInfoGetter, r.caBundle)), + )(provider.OpenstackSubnetPoolEndpoint(r.seedsGetter, r.presetProvider, r.userInfoGetter, r.caBundle, false)), provider.DecodeOpenstackSubnetPoolReq, handler.EncodeJSON, r.defaultServerOptions()..., @@ -6240,6 +6248,182 @@ func (r Routing) listProjectAnexiaTemplates() http.Handler { ) } +// swagger:route GET /api/v2/projects/{project_id}/providers/openstack/sizes openstack listProjectOpenstackSizes +// +// Lists sizes from openstack +// +// Produces: +// - application/json +// +// Responses: +// default: errorResponse +// 200: []OpenstackSize +func (r Routing) listProjectOpenstackSizes() http.Handler { + return httptransport.NewServer( + endpoint.Chain( + middleware.TokenVerifier(r.tokenVerifiers, r.userProvider), + middleware.UserSaver(r.userProvider), + )(provider.OpenstackSizeEndpoint(r.seedsGetter, r.presetProvider, r.userInfoGetter, r.settingsProvider, r.caBundle)), + provider.DecodeOpenstackProjectReq, + handler.EncodeJSON, + r.defaultServerOptions()..., + ) +} + +// swagger:route GET /api/v2/projects/{project_id}/providers/openstack/availabilityzones openstack listProjectOpenstackAvailabilityZones +// +// Lists availability zones from openstack +// +// Produces: +// - application/json +// +// Responses: +// default: errorResponse +// 200: []OpenstackAvailabilityZone +func (r Routing) listProjectOpenstackAvailabilityZones() http.Handler { + return httptransport.NewServer( + endpoint.Chain( + middleware.TokenVerifier(r.tokenVerifiers, r.userProvider), + middleware.UserSaver(r.userProvider), + )(provider.OpenstackAvailabilityZoneEndpoint(r.seedsGetter, r.presetProvider, r.userInfoGetter, r.caBundle)), + provider.DecodeOpenstackProjectReq, + handler.EncodeJSON, + r.defaultServerOptions()..., + ) +} + +// swagger:route GET /api/v2/projects/{project_id}/providers/openstack/networks openstack listProjectOpenstackNetworks +// +// Lists networks from openstack +// +// Produces: +// - application/json +// +// Responses: +// default: errorResponse +// 200: []OpenstackNetwork +func (r Routing) listProjectOpenstackNetworks() http.Handler { + return httptransport.NewServer( + endpoint.Chain( + middleware.TokenVerifier(r.tokenVerifiers, r.userProvider), + middleware.UserSaver(r.userProvider), + )(provider.OpenstackNetworkEndpoint(r.seedsGetter, r.presetProvider, r.userInfoGetter, r.caBundle)), + provider.DecodeOpenstackProjectReq, + handler.EncodeJSON, + r.defaultServerOptions()..., + ) +} + +// swagger:route GET /api/v2/projects/{project_id}/providers/openstack/subnets openstack listProjectOpenstackSubnets +// +// Lists subnets from openstack +// +// Produces: +// - application/json +// +// Responses: +// default: errorResponse +// 200: []OpenstackSubnet +func (r Routing) listProjectOpenstackSubnets() http.Handler { + return httptransport.NewServer( + endpoint.Chain( + middleware.TokenVerifier(r.tokenVerifiers, r.userProvider), + middleware.UserSaver(r.userProvider), + )(provider.OpenstackSubnetsEndpoint(r.seedsGetter, r.presetProvider, r.userInfoGetter, r.caBundle)), + provider.DecodeOpenstackProjectSubnetReq, + handler.EncodeJSON, + r.defaultServerOptions()..., + ) +} + +// swagger:route GET /api/v2/projects/{project_id}/providers/openstack/securitygroups openstack listProjectOpenstackSecurityGroups +// +// Lists security groups from openstack +// +// Produces: +// - application/json +// +// Responses: +// default: errorResponse +// 200: []OpenstackSecurityGroup +func (r Routing) listProjectOpenstackSecurityGroups() http.Handler { + return httptransport.NewServer( + endpoint.Chain( + middleware.TokenVerifier(r.tokenVerifiers, r.userProvider), + middleware.UserSaver(r.userProvider), + )(provider.OpenstackSecurityGroupEndpoint(r.seedsGetter, r.presetProvider, r.userInfoGetter, r.caBundle)), + provider.DecodeOpenstackProjectReq, + handler.EncodeJSON, + r.defaultServerOptions()..., + ) +} + +// swagger:route GET /api/v2/projects/{project_id}/providers/openstack/tenants openstack listProjectOpenstackTenants +// +// Lists tenants from openstack +// +// Produces: +// - application/json +// +// Responses: +// default: errorResponse +// 200: []OpenstackTenant +func (r Routing) listProjectOpenstackTenants() http.Handler { + return httptransport.NewServer( + endpoint.Chain( + middleware.TokenVerifier(r.tokenVerifiers, r.userProvider), + middleware.UserSaver(r.userProvider), + )(provider.OpenstackTenantEndpoint(r.seedsGetter, r.presetProvider, r.userInfoGetter, r.caBundle)), + provider.DecodeOpenstackProjectTenantReq, + handler.EncodeJSON, + r.defaultServerOptions()..., + ) +} + +// swagger:route GET /api/v2/projects/{project_id}/providers/openstack/subnetpools openstack listProjectOpenstackSubnetPools +// +// Lists subnet pools from openstack +// +// Produces: +// - application/json +// +// Responses: +// default: errorResponse +// 200: []OpenstackSubnetPool +func (r Routing) listProjectOpenstackSubnetPools() http.Handler { + return httptransport.NewServer( + endpoint.Chain( + middleware.TokenVerifier(r.tokenVerifiers, r.userProvider), + middleware.UserSaver(r.userProvider), + )(provider.OpenstackSubnetPoolEndpoint(r.seedsGetter, r.presetProvider, r.userInfoGetter, r.caBundle, true)), + provider.DecodeOpenstackProjectSubnetPoolReq, + handler.EncodeJSON, + r.defaultServerOptions()..., + ) +} + +// swagger:route GET /api/v2/projects/{project_id}/providers/openstack/servergroups openstack listProjectOpenstackServerGroups +// +// Lists server groups from openstack +// +// Produces: +// - application/json +// +// Responses: +// default: errorResponse +// 200: []OpenstackServerGroup +func (r Routing) listProjectOpenstackServerGroups() http.Handler { + return httptransport.NewServer( + endpoint.Chain( + middleware.TokenVerifier(r.tokenVerifiers, r.userProvider), + middleware.UserSaver(r.userProvider), + )(provider.OpenstackServerGroupEndpoint(r.seedsGetter, r.presetProvider, r.userInfoGetter, r.caBundle, true)), + provider.DecodeOpenstackProjectReq, + handler.EncodeJSON, + r.defaultServerOptions()..., + ) +} + // swagger:route GET /api/v2/seeds/{seed_name}/settings seed getSeedSettings // // Gets the seed settings. diff --git a/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_openstack_server_groups_parameters.go b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_openstack_server_groups_parameters.go index 6f61967418..87df51106e 100644 --- a/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_openstack_server_groups_parameters.go +++ b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_openstack_server_groups_parameters.go @@ -80,20 +80,20 @@ type ListOpenstackServerGroupsParams struct { // OIDCAuthentication. OIDCAuthentication *bool - // Password. - Password *string + // OpenstackProject. + OpenstackProject *string - // Project. - Project *string + // OpenstackProjectID. + OpenstackProjectID *string - // ProjectID. - ProjectID *string + // OpenstackTenant. + OpenstackTenant *string - // Tenant. - Tenant *string + // OpenstackTenantID. + OpenstackTenantID *string - // TenantID. - TenantID *string + // Password. + Password *string // Username. Username *string @@ -217,59 +217,59 @@ func (o *ListOpenstackServerGroupsParams) SetOIDCAuthentication(oIDCAuthenticati o.OIDCAuthentication = oIDCAuthentication } -// WithPassword adds the password to the list openstack server groups params -func (o *ListOpenstackServerGroupsParams) WithPassword(password *string) *ListOpenstackServerGroupsParams { - o.SetPassword(password) +// WithOpenstackProject adds the openstackProject to the list openstack server groups params +func (o *ListOpenstackServerGroupsParams) WithOpenstackProject(openstackProject *string) *ListOpenstackServerGroupsParams { + o.SetOpenstackProject(openstackProject) return o } -// SetPassword adds the password to the list openstack server groups params -func (o *ListOpenstackServerGroupsParams) SetPassword(password *string) { - o.Password = password +// SetOpenstackProject adds the openstackProject to the list openstack server groups params +func (o *ListOpenstackServerGroupsParams) SetOpenstackProject(openstackProject *string) { + o.OpenstackProject = openstackProject } -// WithProject adds the project to the list openstack server groups params -func (o *ListOpenstackServerGroupsParams) WithProject(project *string) *ListOpenstackServerGroupsParams { - o.SetProject(project) +// WithOpenstackProjectID adds the openstackProjectID to the list openstack server groups params +func (o *ListOpenstackServerGroupsParams) WithOpenstackProjectID(openstackProjectID *string) *ListOpenstackServerGroupsParams { + o.SetOpenstackProjectID(openstackProjectID) return o } -// SetProject adds the project to the list openstack server groups params -func (o *ListOpenstackServerGroupsParams) SetProject(project *string) { - o.Project = project +// SetOpenstackProjectID adds the openstackProjectId to the list openstack server groups params +func (o *ListOpenstackServerGroupsParams) SetOpenstackProjectID(openstackProjectID *string) { + o.OpenstackProjectID = openstackProjectID } -// WithProjectID adds the projectID to the list openstack server groups params -func (o *ListOpenstackServerGroupsParams) WithProjectID(projectID *string) *ListOpenstackServerGroupsParams { - o.SetProjectID(projectID) +// WithOpenstackTenant adds the openstackTenant to the list openstack server groups params +func (o *ListOpenstackServerGroupsParams) WithOpenstackTenant(openstackTenant *string) *ListOpenstackServerGroupsParams { + o.SetOpenstackTenant(openstackTenant) return o } -// SetProjectID adds the projectId to the list openstack server groups params -func (o *ListOpenstackServerGroupsParams) SetProjectID(projectID *string) { - o.ProjectID = projectID +// SetOpenstackTenant adds the openstackTenant to the list openstack server groups params +func (o *ListOpenstackServerGroupsParams) SetOpenstackTenant(openstackTenant *string) { + o.OpenstackTenant = openstackTenant } -// WithTenant adds the tenant to the list openstack server groups params -func (o *ListOpenstackServerGroupsParams) WithTenant(tenant *string) *ListOpenstackServerGroupsParams { - o.SetTenant(tenant) +// WithOpenstackTenantID adds the openstackTenantID to the list openstack server groups params +func (o *ListOpenstackServerGroupsParams) WithOpenstackTenantID(openstackTenantID *string) *ListOpenstackServerGroupsParams { + o.SetOpenstackTenantID(openstackTenantID) return o } -// SetTenant adds the tenant to the list openstack server groups params -func (o *ListOpenstackServerGroupsParams) SetTenant(tenant *string) { - o.Tenant = tenant +// SetOpenstackTenantID adds the openstackTenantId to the list openstack server groups params +func (o *ListOpenstackServerGroupsParams) SetOpenstackTenantID(openstackTenantID *string) { + o.OpenstackTenantID = openstackTenantID } -// WithTenantID adds the tenantID to the list openstack server groups params -func (o *ListOpenstackServerGroupsParams) WithTenantID(tenantID *string) *ListOpenstackServerGroupsParams { - o.SetTenantID(tenantID) +// WithPassword adds the password to the list openstack server groups params +func (o *ListOpenstackServerGroupsParams) WithPassword(password *string) *ListOpenstackServerGroupsParams { + o.SetPassword(password) return o } -// SetTenantID adds the tenantId to the list openstack server groups params -func (o *ListOpenstackServerGroupsParams) SetTenantID(tenantID *string) { - o.TenantID = tenantID +// SetPassword adds the password to the list openstack server groups params +func (o *ListOpenstackServerGroupsParams) SetPassword(password *string) { + o.Password = password } // WithUsername adds the username to the list openstack server groups params @@ -339,42 +339,42 @@ func (o *ListOpenstackServerGroupsParams) WriteToRequest(r runtime.ClientRequest } } - if o.Password != nil { + if o.OpenstackProject != nil { - // header param Password - if err := r.SetHeaderParam("Password", *o.Password); err != nil { + // header param OpenstackProject + if err := r.SetHeaderParam("OpenstackProject", *o.OpenstackProject); err != nil { return err } } - if o.Project != nil { + if o.OpenstackProjectID != nil { - // header param Project - if err := r.SetHeaderParam("Project", *o.Project); err != nil { + // header param OpenstackProjectID + if err := r.SetHeaderParam("OpenstackProjectID", *o.OpenstackProjectID); err != nil { return err } } - if o.ProjectID != nil { + if o.OpenstackTenant != nil { - // header param ProjectID - if err := r.SetHeaderParam("ProjectID", *o.ProjectID); err != nil { + // header param OpenstackTenant + if err := r.SetHeaderParam("OpenstackTenant", *o.OpenstackTenant); err != nil { return err } } - if o.Tenant != nil { + if o.OpenstackTenantID != nil { - // header param Tenant - if err := r.SetHeaderParam("Tenant", *o.Tenant); err != nil { + // header param OpenstackTenantID + if err := r.SetHeaderParam("OpenstackTenantID", *o.OpenstackTenantID); err != nil { return err } } - if o.TenantID != nil { + if o.Password != nil { - // header param TenantID - if err := r.SetHeaderParam("TenantID", *o.TenantID); err != nil { + // header param Password + if err := r.SetHeaderParam("Password", *o.Password); err != nil { return err } } diff --git a/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_openstack_subnet_pools_parameters.go b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_openstack_subnet_pools_parameters.go index 313cd67d02..c8e7759e98 100644 --- a/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_openstack_subnet_pools_parameters.go +++ b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_openstack_subnet_pools_parameters.go @@ -80,20 +80,20 @@ type ListOpenstackSubnetPoolsParams struct { // OIDCAuthentication. OIDCAuthentication *bool - // Password. - Password *string + // OpenstackProject. + OpenstackProject *string - // Project. - Project *string + // OpenstackProjectID. + OpenstackProjectID *string - // ProjectID. - ProjectID *string + // OpenstackTenant. + OpenstackTenant *string - // Tenant. - Tenant *string + // OpenstackTenantID. + OpenstackTenantID *string - // TenantID. - TenantID *string + // Password. + Password *string // Username. Username *string @@ -222,59 +222,59 @@ func (o *ListOpenstackSubnetPoolsParams) SetOIDCAuthentication(oIDCAuthenticatio o.OIDCAuthentication = oIDCAuthentication } -// WithPassword adds the password to the list openstack subnet pools params -func (o *ListOpenstackSubnetPoolsParams) WithPassword(password *string) *ListOpenstackSubnetPoolsParams { - o.SetPassword(password) +// WithOpenstackProject adds the openstackProject to the list openstack subnet pools params +func (o *ListOpenstackSubnetPoolsParams) WithOpenstackProject(openstackProject *string) *ListOpenstackSubnetPoolsParams { + o.SetOpenstackProject(openstackProject) return o } -// SetPassword adds the password to the list openstack subnet pools params -func (o *ListOpenstackSubnetPoolsParams) SetPassword(password *string) { - o.Password = password +// SetOpenstackProject adds the openstackProject to the list openstack subnet pools params +func (o *ListOpenstackSubnetPoolsParams) SetOpenstackProject(openstackProject *string) { + o.OpenstackProject = openstackProject } -// WithProject adds the project to the list openstack subnet pools params -func (o *ListOpenstackSubnetPoolsParams) WithProject(project *string) *ListOpenstackSubnetPoolsParams { - o.SetProject(project) +// WithOpenstackProjectID adds the openstackProjectID to the list openstack subnet pools params +func (o *ListOpenstackSubnetPoolsParams) WithOpenstackProjectID(openstackProjectID *string) *ListOpenstackSubnetPoolsParams { + o.SetOpenstackProjectID(openstackProjectID) return o } -// SetProject adds the project to the list openstack subnet pools params -func (o *ListOpenstackSubnetPoolsParams) SetProject(project *string) { - o.Project = project +// SetOpenstackProjectID adds the openstackProjectId to the list openstack subnet pools params +func (o *ListOpenstackSubnetPoolsParams) SetOpenstackProjectID(openstackProjectID *string) { + o.OpenstackProjectID = openstackProjectID } -// WithProjectID adds the projectID to the list openstack subnet pools params -func (o *ListOpenstackSubnetPoolsParams) WithProjectID(projectID *string) *ListOpenstackSubnetPoolsParams { - o.SetProjectID(projectID) +// WithOpenstackTenant adds the openstackTenant to the list openstack subnet pools params +func (o *ListOpenstackSubnetPoolsParams) WithOpenstackTenant(openstackTenant *string) *ListOpenstackSubnetPoolsParams { + o.SetOpenstackTenant(openstackTenant) return o } -// SetProjectID adds the projectId to the list openstack subnet pools params -func (o *ListOpenstackSubnetPoolsParams) SetProjectID(projectID *string) { - o.ProjectID = projectID +// SetOpenstackTenant adds the openstackTenant to the list openstack subnet pools params +func (o *ListOpenstackSubnetPoolsParams) SetOpenstackTenant(openstackTenant *string) { + o.OpenstackTenant = openstackTenant } -// WithTenant adds the tenant to the list openstack subnet pools params -func (o *ListOpenstackSubnetPoolsParams) WithTenant(tenant *string) *ListOpenstackSubnetPoolsParams { - o.SetTenant(tenant) +// WithOpenstackTenantID adds the openstackTenantID to the list openstack subnet pools params +func (o *ListOpenstackSubnetPoolsParams) WithOpenstackTenantID(openstackTenantID *string) *ListOpenstackSubnetPoolsParams { + o.SetOpenstackTenantID(openstackTenantID) return o } -// SetTenant adds the tenant to the list openstack subnet pools params -func (o *ListOpenstackSubnetPoolsParams) SetTenant(tenant *string) { - o.Tenant = tenant +// SetOpenstackTenantID adds the openstackTenantId to the list openstack subnet pools params +func (o *ListOpenstackSubnetPoolsParams) SetOpenstackTenantID(openstackTenantID *string) { + o.OpenstackTenantID = openstackTenantID } -// WithTenantID adds the tenantID to the list openstack subnet pools params -func (o *ListOpenstackSubnetPoolsParams) WithTenantID(tenantID *string) *ListOpenstackSubnetPoolsParams { - o.SetTenantID(tenantID) +// WithPassword adds the password to the list openstack subnet pools params +func (o *ListOpenstackSubnetPoolsParams) WithPassword(password *string) *ListOpenstackSubnetPoolsParams { + o.SetPassword(password) return o } -// SetTenantID adds the tenantId to the list openstack subnet pools params -func (o *ListOpenstackSubnetPoolsParams) SetTenantID(tenantID *string) { - o.TenantID = tenantID +// SetPassword adds the password to the list openstack subnet pools params +func (o *ListOpenstackSubnetPoolsParams) SetPassword(password *string) { + o.Password = password } // WithUsername adds the username to the list openstack subnet pools params @@ -355,42 +355,42 @@ func (o *ListOpenstackSubnetPoolsParams) WriteToRequest(r runtime.ClientRequest, } } - if o.Password != nil { + if o.OpenstackProject != nil { - // header param Password - if err := r.SetHeaderParam("Password", *o.Password); err != nil { + // header param OpenstackProject + if err := r.SetHeaderParam("OpenstackProject", *o.OpenstackProject); err != nil { return err } } - if o.Project != nil { + if o.OpenstackProjectID != nil { - // header param Project - if err := r.SetHeaderParam("Project", *o.Project); err != nil { + // header param OpenstackProjectID + if err := r.SetHeaderParam("OpenstackProjectID", *o.OpenstackProjectID); err != nil { return err } } - if o.ProjectID != nil { + if o.OpenstackTenant != nil { - // header param ProjectID - if err := r.SetHeaderParam("ProjectID", *o.ProjectID); err != nil { + // header param OpenstackTenant + if err := r.SetHeaderParam("OpenstackTenant", *o.OpenstackTenant); err != nil { return err } } - if o.Tenant != nil { + if o.OpenstackTenantID != nil { - // header param Tenant - if err := r.SetHeaderParam("Tenant", *o.Tenant); err != nil { + // header param OpenstackTenantID + if err := r.SetHeaderParam("OpenstackTenantID", *o.OpenstackTenantID); err != nil { return err } } - if o.TenantID != nil { + if o.Password != nil { - // header param TenantID - if err := r.SetHeaderParam("TenantID", *o.TenantID); err != nil { + // header param Password + if err := r.SetHeaderParam("Password", *o.Password); err != nil { return err } } diff --git a/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_availability_zones_parameters.go b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_availability_zones_parameters.go new file mode 100644 index 0000000000..28933953ff --- /dev/null +++ b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_availability_zones_parameters.go @@ -0,0 +1,413 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package openstack + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewListProjectOpenstackAvailabilityZonesParams creates a new ListProjectOpenstackAvailabilityZonesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewListProjectOpenstackAvailabilityZonesParams() *ListProjectOpenstackAvailabilityZonesParams { + return &ListProjectOpenstackAvailabilityZonesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListProjectOpenstackAvailabilityZonesParamsWithTimeout creates a new ListProjectOpenstackAvailabilityZonesParams object +// with the ability to set a timeout on a request. +func NewListProjectOpenstackAvailabilityZonesParamsWithTimeout(timeout time.Duration) *ListProjectOpenstackAvailabilityZonesParams { + return &ListProjectOpenstackAvailabilityZonesParams{ + timeout: timeout, + } +} + +// NewListProjectOpenstackAvailabilityZonesParamsWithContext creates a new ListProjectOpenstackAvailabilityZonesParams object +// with the ability to set a context for a request. +func NewListProjectOpenstackAvailabilityZonesParamsWithContext(ctx context.Context) *ListProjectOpenstackAvailabilityZonesParams { + return &ListProjectOpenstackAvailabilityZonesParams{ + Context: ctx, + } +} + +// NewListProjectOpenstackAvailabilityZonesParamsWithHTTPClient creates a new ListProjectOpenstackAvailabilityZonesParams object +// with the ability to set a custom HTTPClient for a request. +func NewListProjectOpenstackAvailabilityZonesParamsWithHTTPClient(client *http.Client) *ListProjectOpenstackAvailabilityZonesParams { + return &ListProjectOpenstackAvailabilityZonesParams{ + HTTPClient: client, + } +} + +/* +ListProjectOpenstackAvailabilityZonesParams contains all the parameters to send to the API endpoint + + for the list project openstack availability zones operation. + + Typically these are written to a http.Request. +*/ +type ListProjectOpenstackAvailabilityZonesParams struct { + + // ApplicationCredentialID. + ApplicationCredentialID *string + + // ApplicationCredentialSecret. + ApplicationCredentialSecret *string + + // Credential. + Credential *string + + // DatacenterName. + DatacenterName *string + + // Domain. + Domain *string + + // OIDCAuthentication. + OIDCAuthentication *bool + + // OpenstackProject. + OpenstackProject *string + + // OpenstackProjectID. + OpenstackProjectID *string + + // OpenstackTenant. + OpenstackTenant *string + + // OpenstackTenantID. + OpenstackTenantID *string + + // Password. + Password *string + + // Username. + Username *string + + // ProjectID. + ProjectID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list project openstack availability zones params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListProjectOpenstackAvailabilityZonesParams) WithDefaults() *ListProjectOpenstackAvailabilityZonesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list project openstack availability zones params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListProjectOpenstackAvailabilityZonesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) WithTimeout(timeout time.Duration) *ListProjectOpenstackAvailabilityZonesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) WithContext(ctx context.Context) *ListProjectOpenstackAvailabilityZonesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) WithHTTPClient(client *http.Client) *ListProjectOpenstackAvailabilityZonesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationCredentialID adds the applicationCredentialID to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) WithApplicationCredentialID(applicationCredentialID *string) *ListProjectOpenstackAvailabilityZonesParams { + o.SetApplicationCredentialID(applicationCredentialID) + return o +} + +// SetApplicationCredentialID adds the applicationCredentialId to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) SetApplicationCredentialID(applicationCredentialID *string) { + o.ApplicationCredentialID = applicationCredentialID +} + +// WithApplicationCredentialSecret adds the applicationCredentialSecret to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) WithApplicationCredentialSecret(applicationCredentialSecret *string) *ListProjectOpenstackAvailabilityZonesParams { + o.SetApplicationCredentialSecret(applicationCredentialSecret) + return o +} + +// SetApplicationCredentialSecret adds the applicationCredentialSecret to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) SetApplicationCredentialSecret(applicationCredentialSecret *string) { + o.ApplicationCredentialSecret = applicationCredentialSecret +} + +// WithCredential adds the credential to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) WithCredential(credential *string) *ListProjectOpenstackAvailabilityZonesParams { + o.SetCredential(credential) + return o +} + +// SetCredential adds the credential to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) SetCredential(credential *string) { + o.Credential = credential +} + +// WithDatacenterName adds the datacenterName to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) WithDatacenterName(datacenterName *string) *ListProjectOpenstackAvailabilityZonesParams { + o.SetDatacenterName(datacenterName) + return o +} + +// SetDatacenterName adds the datacenterName to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) SetDatacenterName(datacenterName *string) { + o.DatacenterName = datacenterName +} + +// WithDomain adds the domain to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) WithDomain(domain *string) *ListProjectOpenstackAvailabilityZonesParams { + o.SetDomain(domain) + return o +} + +// SetDomain adds the domain to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) SetDomain(domain *string) { + o.Domain = domain +} + +// WithOIDCAuthentication adds the oIDCAuthentication to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) WithOIDCAuthentication(oIDCAuthentication *bool) *ListProjectOpenstackAvailabilityZonesParams { + o.SetOIDCAuthentication(oIDCAuthentication) + return o +} + +// SetOIDCAuthentication adds the oIdCAuthentication to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) SetOIDCAuthentication(oIDCAuthentication *bool) { + o.OIDCAuthentication = oIDCAuthentication +} + +// WithOpenstackProject adds the openstackProject to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) WithOpenstackProject(openstackProject *string) *ListProjectOpenstackAvailabilityZonesParams { + o.SetOpenstackProject(openstackProject) + return o +} + +// SetOpenstackProject adds the openstackProject to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) SetOpenstackProject(openstackProject *string) { + o.OpenstackProject = openstackProject +} + +// WithOpenstackProjectID adds the openstackProjectID to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) WithOpenstackProjectID(openstackProjectID *string) *ListProjectOpenstackAvailabilityZonesParams { + o.SetOpenstackProjectID(openstackProjectID) + return o +} + +// SetOpenstackProjectID adds the openstackProjectId to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) SetOpenstackProjectID(openstackProjectID *string) { + o.OpenstackProjectID = openstackProjectID +} + +// WithOpenstackTenant adds the openstackTenant to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) WithOpenstackTenant(openstackTenant *string) *ListProjectOpenstackAvailabilityZonesParams { + o.SetOpenstackTenant(openstackTenant) + return o +} + +// SetOpenstackTenant adds the openstackTenant to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) SetOpenstackTenant(openstackTenant *string) { + o.OpenstackTenant = openstackTenant +} + +// WithOpenstackTenantID adds the openstackTenantID to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) WithOpenstackTenantID(openstackTenantID *string) *ListProjectOpenstackAvailabilityZonesParams { + o.SetOpenstackTenantID(openstackTenantID) + return o +} + +// SetOpenstackTenantID adds the openstackTenantId to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) SetOpenstackTenantID(openstackTenantID *string) { + o.OpenstackTenantID = openstackTenantID +} + +// WithPassword adds the password to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) WithPassword(password *string) *ListProjectOpenstackAvailabilityZonesParams { + o.SetPassword(password) + return o +} + +// SetPassword adds the password to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) SetPassword(password *string) { + o.Password = password +} + +// WithUsername adds the username to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) WithUsername(username *string) *ListProjectOpenstackAvailabilityZonesParams { + o.SetUsername(username) + return o +} + +// SetUsername adds the username to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) SetUsername(username *string) { + o.Username = username +} + +// WithProjectID adds the projectID to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) WithProjectID(projectID string) *ListProjectOpenstackAvailabilityZonesParams { + o.SetProjectID(projectID) + return o +} + +// SetProjectID adds the projectId to the list project openstack availability zones params +func (o *ListProjectOpenstackAvailabilityZonesParams) SetProjectID(projectID string) { + o.ProjectID = projectID +} + +// WriteToRequest writes these params to a swagger request +func (o *ListProjectOpenstackAvailabilityZonesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ApplicationCredentialID != nil { + + // header param ApplicationCredentialID + if err := r.SetHeaderParam("ApplicationCredentialID", *o.ApplicationCredentialID); err != nil { + return err + } + } + + if o.ApplicationCredentialSecret != nil { + + // header param ApplicationCredentialSecret + if err := r.SetHeaderParam("ApplicationCredentialSecret", *o.ApplicationCredentialSecret); err != nil { + return err + } + } + + if o.Credential != nil { + + // header param Credential + if err := r.SetHeaderParam("Credential", *o.Credential); err != nil { + return err + } + } + + if o.DatacenterName != nil { + + // header param DatacenterName + if err := r.SetHeaderParam("DatacenterName", *o.DatacenterName); err != nil { + return err + } + } + + if o.Domain != nil { + + // header param Domain + if err := r.SetHeaderParam("Domain", *o.Domain); err != nil { + return err + } + } + + if o.OIDCAuthentication != nil { + + // header param OIDCAuthentication + if err := r.SetHeaderParam("OIDCAuthentication", swag.FormatBool(*o.OIDCAuthentication)); err != nil { + return err + } + } + + if o.OpenstackProject != nil { + + // header param OpenstackProject + if err := r.SetHeaderParam("OpenstackProject", *o.OpenstackProject); err != nil { + return err + } + } + + if o.OpenstackProjectID != nil { + + // header param OpenstackProjectID + if err := r.SetHeaderParam("OpenstackProjectID", *o.OpenstackProjectID); err != nil { + return err + } + } + + if o.OpenstackTenant != nil { + + // header param OpenstackTenant + if err := r.SetHeaderParam("OpenstackTenant", *o.OpenstackTenant); err != nil { + return err + } + } + + if o.OpenstackTenantID != nil { + + // header param OpenstackTenantID + if err := r.SetHeaderParam("OpenstackTenantID", *o.OpenstackTenantID); err != nil { + return err + } + } + + if o.Password != nil { + + // header param Password + if err := r.SetHeaderParam("Password", *o.Password); err != nil { + return err + } + } + + if o.Username != nil { + + // header param Username + if err := r.SetHeaderParam("Username", *o.Username); err != nil { + return err + } + } + + // path param project_id + if err := r.SetPathParam("project_id", o.ProjectID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_availability_zones_responses.go b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_availability_zones_responses.go new file mode 100644 index 0000000000..4db995610b --- /dev/null +++ b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_availability_zones_responses.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package openstack + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "k8c.io/dashboard/v2/pkg/test/e2e/utils/apiclient/models" +) + +// ListProjectOpenstackAvailabilityZonesReader is a Reader for the ListProjectOpenstackAvailabilityZones structure. +type ListProjectOpenstackAvailabilityZonesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListProjectOpenstackAvailabilityZonesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListProjectOpenstackAvailabilityZonesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListProjectOpenstackAvailabilityZonesDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewListProjectOpenstackAvailabilityZonesOK creates a ListProjectOpenstackAvailabilityZonesOK with default headers values +func NewListProjectOpenstackAvailabilityZonesOK() *ListProjectOpenstackAvailabilityZonesOK { + return &ListProjectOpenstackAvailabilityZonesOK{} +} + +/* +ListProjectOpenstackAvailabilityZonesOK describes a response with status code 200, with default header values. + +OpenstackAvailabilityZone +*/ +type ListProjectOpenstackAvailabilityZonesOK struct { + Payload []*models.OpenstackAvailabilityZone +} + +// IsSuccess returns true when this list project openstack availability zones o k response has a 2xx status code +func (o *ListProjectOpenstackAvailabilityZonesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list project openstack availability zones o k response has a 3xx status code +func (o *ListProjectOpenstackAvailabilityZonesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list project openstack availability zones o k response has a 4xx status code +func (o *ListProjectOpenstackAvailabilityZonesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list project openstack availability zones o k response has a 5xx status code +func (o *ListProjectOpenstackAvailabilityZonesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list project openstack availability zones o k response a status code equal to that given +func (o *ListProjectOpenstackAvailabilityZonesOK) IsCode(code int) bool { + return code == 200 +} + +func (o *ListProjectOpenstackAvailabilityZonesOK) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/availabilityzones][%d] listProjectOpenstackAvailabilityZonesOK %+v", 200, o.Payload) +} + +func (o *ListProjectOpenstackAvailabilityZonesOK) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/availabilityzones][%d] listProjectOpenstackAvailabilityZonesOK %+v", 200, o.Payload) +} + +func (o *ListProjectOpenstackAvailabilityZonesOK) GetPayload() []*models.OpenstackAvailabilityZone { + return o.Payload +} + +func (o *ListProjectOpenstackAvailabilityZonesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListProjectOpenstackAvailabilityZonesDefault creates a ListProjectOpenstackAvailabilityZonesDefault with default headers values +func NewListProjectOpenstackAvailabilityZonesDefault(code int) *ListProjectOpenstackAvailabilityZonesDefault { + return &ListProjectOpenstackAvailabilityZonesDefault{ + _statusCode: code, + } +} + +/* +ListProjectOpenstackAvailabilityZonesDefault describes a response with status code -1, with default header values. + +errorResponse +*/ +type ListProjectOpenstackAvailabilityZonesDefault struct { + _statusCode int + + Payload *models.ErrorResponse +} + +// Code gets the status code for the list project openstack availability zones default response +func (o *ListProjectOpenstackAvailabilityZonesDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this list project openstack availability zones default response has a 2xx status code +func (o *ListProjectOpenstackAvailabilityZonesDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list project openstack availability zones default response has a 3xx status code +func (o *ListProjectOpenstackAvailabilityZonesDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list project openstack availability zones default response has a 4xx status code +func (o *ListProjectOpenstackAvailabilityZonesDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list project openstack availability zones default response has a 5xx status code +func (o *ListProjectOpenstackAvailabilityZonesDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list project openstack availability zones default response a status code equal to that given +func (o *ListProjectOpenstackAvailabilityZonesDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *ListProjectOpenstackAvailabilityZonesDefault) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/availabilityzones][%d] listProjectOpenstackAvailabilityZones default %+v", o._statusCode, o.Payload) +} + +func (o *ListProjectOpenstackAvailabilityZonesDefault) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/availabilityzones][%d] listProjectOpenstackAvailabilityZones default %+v", o._statusCode, o.Payload) +} + +func (o *ListProjectOpenstackAvailabilityZonesDefault) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *ListProjectOpenstackAvailabilityZonesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_networks_parameters.go b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_networks_parameters.go new file mode 100644 index 0000000000..1f292dcb3e --- /dev/null +++ b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_networks_parameters.go @@ -0,0 +1,413 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package openstack + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewListProjectOpenstackNetworksParams creates a new ListProjectOpenstackNetworksParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewListProjectOpenstackNetworksParams() *ListProjectOpenstackNetworksParams { + return &ListProjectOpenstackNetworksParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListProjectOpenstackNetworksParamsWithTimeout creates a new ListProjectOpenstackNetworksParams object +// with the ability to set a timeout on a request. +func NewListProjectOpenstackNetworksParamsWithTimeout(timeout time.Duration) *ListProjectOpenstackNetworksParams { + return &ListProjectOpenstackNetworksParams{ + timeout: timeout, + } +} + +// NewListProjectOpenstackNetworksParamsWithContext creates a new ListProjectOpenstackNetworksParams object +// with the ability to set a context for a request. +func NewListProjectOpenstackNetworksParamsWithContext(ctx context.Context) *ListProjectOpenstackNetworksParams { + return &ListProjectOpenstackNetworksParams{ + Context: ctx, + } +} + +// NewListProjectOpenstackNetworksParamsWithHTTPClient creates a new ListProjectOpenstackNetworksParams object +// with the ability to set a custom HTTPClient for a request. +func NewListProjectOpenstackNetworksParamsWithHTTPClient(client *http.Client) *ListProjectOpenstackNetworksParams { + return &ListProjectOpenstackNetworksParams{ + HTTPClient: client, + } +} + +/* +ListProjectOpenstackNetworksParams contains all the parameters to send to the API endpoint + + for the list project openstack networks operation. + + Typically these are written to a http.Request. +*/ +type ListProjectOpenstackNetworksParams struct { + + // ApplicationCredentialID. + ApplicationCredentialID *string + + // ApplicationCredentialSecret. + ApplicationCredentialSecret *string + + // Credential. + Credential *string + + // DatacenterName. + DatacenterName *string + + // Domain. + Domain *string + + // OIDCAuthentication. + OIDCAuthentication *bool + + // OpenstackProject. + OpenstackProject *string + + // OpenstackProjectID. + OpenstackProjectID *string + + // OpenstackTenant. + OpenstackTenant *string + + // OpenstackTenantID. + OpenstackTenantID *string + + // Password. + Password *string + + // Username. + Username *string + + // ProjectID. + ProjectID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list project openstack networks params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListProjectOpenstackNetworksParams) WithDefaults() *ListProjectOpenstackNetworksParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list project openstack networks params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListProjectOpenstackNetworksParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) WithTimeout(timeout time.Duration) *ListProjectOpenstackNetworksParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) WithContext(ctx context.Context) *ListProjectOpenstackNetworksParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) WithHTTPClient(client *http.Client) *ListProjectOpenstackNetworksParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationCredentialID adds the applicationCredentialID to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) WithApplicationCredentialID(applicationCredentialID *string) *ListProjectOpenstackNetworksParams { + o.SetApplicationCredentialID(applicationCredentialID) + return o +} + +// SetApplicationCredentialID adds the applicationCredentialId to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) SetApplicationCredentialID(applicationCredentialID *string) { + o.ApplicationCredentialID = applicationCredentialID +} + +// WithApplicationCredentialSecret adds the applicationCredentialSecret to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) WithApplicationCredentialSecret(applicationCredentialSecret *string) *ListProjectOpenstackNetworksParams { + o.SetApplicationCredentialSecret(applicationCredentialSecret) + return o +} + +// SetApplicationCredentialSecret adds the applicationCredentialSecret to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) SetApplicationCredentialSecret(applicationCredentialSecret *string) { + o.ApplicationCredentialSecret = applicationCredentialSecret +} + +// WithCredential adds the credential to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) WithCredential(credential *string) *ListProjectOpenstackNetworksParams { + o.SetCredential(credential) + return o +} + +// SetCredential adds the credential to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) SetCredential(credential *string) { + o.Credential = credential +} + +// WithDatacenterName adds the datacenterName to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) WithDatacenterName(datacenterName *string) *ListProjectOpenstackNetworksParams { + o.SetDatacenterName(datacenterName) + return o +} + +// SetDatacenterName adds the datacenterName to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) SetDatacenterName(datacenterName *string) { + o.DatacenterName = datacenterName +} + +// WithDomain adds the domain to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) WithDomain(domain *string) *ListProjectOpenstackNetworksParams { + o.SetDomain(domain) + return o +} + +// SetDomain adds the domain to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) SetDomain(domain *string) { + o.Domain = domain +} + +// WithOIDCAuthentication adds the oIDCAuthentication to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) WithOIDCAuthentication(oIDCAuthentication *bool) *ListProjectOpenstackNetworksParams { + o.SetOIDCAuthentication(oIDCAuthentication) + return o +} + +// SetOIDCAuthentication adds the oIdCAuthentication to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) SetOIDCAuthentication(oIDCAuthentication *bool) { + o.OIDCAuthentication = oIDCAuthentication +} + +// WithOpenstackProject adds the openstackProject to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) WithOpenstackProject(openstackProject *string) *ListProjectOpenstackNetworksParams { + o.SetOpenstackProject(openstackProject) + return o +} + +// SetOpenstackProject adds the openstackProject to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) SetOpenstackProject(openstackProject *string) { + o.OpenstackProject = openstackProject +} + +// WithOpenstackProjectID adds the openstackProjectID to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) WithOpenstackProjectID(openstackProjectID *string) *ListProjectOpenstackNetworksParams { + o.SetOpenstackProjectID(openstackProjectID) + return o +} + +// SetOpenstackProjectID adds the openstackProjectId to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) SetOpenstackProjectID(openstackProjectID *string) { + o.OpenstackProjectID = openstackProjectID +} + +// WithOpenstackTenant adds the openstackTenant to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) WithOpenstackTenant(openstackTenant *string) *ListProjectOpenstackNetworksParams { + o.SetOpenstackTenant(openstackTenant) + return o +} + +// SetOpenstackTenant adds the openstackTenant to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) SetOpenstackTenant(openstackTenant *string) { + o.OpenstackTenant = openstackTenant +} + +// WithOpenstackTenantID adds the openstackTenantID to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) WithOpenstackTenantID(openstackTenantID *string) *ListProjectOpenstackNetworksParams { + o.SetOpenstackTenantID(openstackTenantID) + return o +} + +// SetOpenstackTenantID adds the openstackTenantId to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) SetOpenstackTenantID(openstackTenantID *string) { + o.OpenstackTenantID = openstackTenantID +} + +// WithPassword adds the password to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) WithPassword(password *string) *ListProjectOpenstackNetworksParams { + o.SetPassword(password) + return o +} + +// SetPassword adds the password to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) SetPassword(password *string) { + o.Password = password +} + +// WithUsername adds the username to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) WithUsername(username *string) *ListProjectOpenstackNetworksParams { + o.SetUsername(username) + return o +} + +// SetUsername adds the username to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) SetUsername(username *string) { + o.Username = username +} + +// WithProjectID adds the projectID to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) WithProjectID(projectID string) *ListProjectOpenstackNetworksParams { + o.SetProjectID(projectID) + return o +} + +// SetProjectID adds the projectId to the list project openstack networks params +func (o *ListProjectOpenstackNetworksParams) SetProjectID(projectID string) { + o.ProjectID = projectID +} + +// WriteToRequest writes these params to a swagger request +func (o *ListProjectOpenstackNetworksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ApplicationCredentialID != nil { + + // header param ApplicationCredentialID + if err := r.SetHeaderParam("ApplicationCredentialID", *o.ApplicationCredentialID); err != nil { + return err + } + } + + if o.ApplicationCredentialSecret != nil { + + // header param ApplicationCredentialSecret + if err := r.SetHeaderParam("ApplicationCredentialSecret", *o.ApplicationCredentialSecret); err != nil { + return err + } + } + + if o.Credential != nil { + + // header param Credential + if err := r.SetHeaderParam("Credential", *o.Credential); err != nil { + return err + } + } + + if o.DatacenterName != nil { + + // header param DatacenterName + if err := r.SetHeaderParam("DatacenterName", *o.DatacenterName); err != nil { + return err + } + } + + if o.Domain != nil { + + // header param Domain + if err := r.SetHeaderParam("Domain", *o.Domain); err != nil { + return err + } + } + + if o.OIDCAuthentication != nil { + + // header param OIDCAuthentication + if err := r.SetHeaderParam("OIDCAuthentication", swag.FormatBool(*o.OIDCAuthentication)); err != nil { + return err + } + } + + if o.OpenstackProject != nil { + + // header param OpenstackProject + if err := r.SetHeaderParam("OpenstackProject", *o.OpenstackProject); err != nil { + return err + } + } + + if o.OpenstackProjectID != nil { + + // header param OpenstackProjectID + if err := r.SetHeaderParam("OpenstackProjectID", *o.OpenstackProjectID); err != nil { + return err + } + } + + if o.OpenstackTenant != nil { + + // header param OpenstackTenant + if err := r.SetHeaderParam("OpenstackTenant", *o.OpenstackTenant); err != nil { + return err + } + } + + if o.OpenstackTenantID != nil { + + // header param OpenstackTenantID + if err := r.SetHeaderParam("OpenstackTenantID", *o.OpenstackTenantID); err != nil { + return err + } + } + + if o.Password != nil { + + // header param Password + if err := r.SetHeaderParam("Password", *o.Password); err != nil { + return err + } + } + + if o.Username != nil { + + // header param Username + if err := r.SetHeaderParam("Username", *o.Username); err != nil { + return err + } + } + + // path param project_id + if err := r.SetPathParam("project_id", o.ProjectID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_networks_responses.go b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_networks_responses.go new file mode 100644 index 0000000000..4220f0710b --- /dev/null +++ b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_networks_responses.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package openstack + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "k8c.io/dashboard/v2/pkg/test/e2e/utils/apiclient/models" +) + +// ListProjectOpenstackNetworksReader is a Reader for the ListProjectOpenstackNetworks structure. +type ListProjectOpenstackNetworksReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListProjectOpenstackNetworksReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListProjectOpenstackNetworksOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListProjectOpenstackNetworksDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewListProjectOpenstackNetworksOK creates a ListProjectOpenstackNetworksOK with default headers values +func NewListProjectOpenstackNetworksOK() *ListProjectOpenstackNetworksOK { + return &ListProjectOpenstackNetworksOK{} +} + +/* +ListProjectOpenstackNetworksOK describes a response with status code 200, with default header values. + +OpenstackNetwork +*/ +type ListProjectOpenstackNetworksOK struct { + Payload []*models.OpenstackNetwork +} + +// IsSuccess returns true when this list project openstack networks o k response has a 2xx status code +func (o *ListProjectOpenstackNetworksOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list project openstack networks o k response has a 3xx status code +func (o *ListProjectOpenstackNetworksOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list project openstack networks o k response has a 4xx status code +func (o *ListProjectOpenstackNetworksOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list project openstack networks o k response has a 5xx status code +func (o *ListProjectOpenstackNetworksOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list project openstack networks o k response a status code equal to that given +func (o *ListProjectOpenstackNetworksOK) IsCode(code int) bool { + return code == 200 +} + +func (o *ListProjectOpenstackNetworksOK) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/networks][%d] listProjectOpenstackNetworksOK %+v", 200, o.Payload) +} + +func (o *ListProjectOpenstackNetworksOK) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/networks][%d] listProjectOpenstackNetworksOK %+v", 200, o.Payload) +} + +func (o *ListProjectOpenstackNetworksOK) GetPayload() []*models.OpenstackNetwork { + return o.Payload +} + +func (o *ListProjectOpenstackNetworksOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListProjectOpenstackNetworksDefault creates a ListProjectOpenstackNetworksDefault with default headers values +func NewListProjectOpenstackNetworksDefault(code int) *ListProjectOpenstackNetworksDefault { + return &ListProjectOpenstackNetworksDefault{ + _statusCode: code, + } +} + +/* +ListProjectOpenstackNetworksDefault describes a response with status code -1, with default header values. + +errorResponse +*/ +type ListProjectOpenstackNetworksDefault struct { + _statusCode int + + Payload *models.ErrorResponse +} + +// Code gets the status code for the list project openstack networks default response +func (o *ListProjectOpenstackNetworksDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this list project openstack networks default response has a 2xx status code +func (o *ListProjectOpenstackNetworksDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list project openstack networks default response has a 3xx status code +func (o *ListProjectOpenstackNetworksDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list project openstack networks default response has a 4xx status code +func (o *ListProjectOpenstackNetworksDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list project openstack networks default response has a 5xx status code +func (o *ListProjectOpenstackNetworksDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list project openstack networks default response a status code equal to that given +func (o *ListProjectOpenstackNetworksDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *ListProjectOpenstackNetworksDefault) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/networks][%d] listProjectOpenstackNetworks default %+v", o._statusCode, o.Payload) +} + +func (o *ListProjectOpenstackNetworksDefault) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/networks][%d] listProjectOpenstackNetworks default %+v", o._statusCode, o.Payload) +} + +func (o *ListProjectOpenstackNetworksDefault) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *ListProjectOpenstackNetworksDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_security_groups_parameters.go b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_security_groups_parameters.go new file mode 100644 index 0000000000..ccedc48466 --- /dev/null +++ b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_security_groups_parameters.go @@ -0,0 +1,413 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package openstack + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewListProjectOpenstackSecurityGroupsParams creates a new ListProjectOpenstackSecurityGroupsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewListProjectOpenstackSecurityGroupsParams() *ListProjectOpenstackSecurityGroupsParams { + return &ListProjectOpenstackSecurityGroupsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListProjectOpenstackSecurityGroupsParamsWithTimeout creates a new ListProjectOpenstackSecurityGroupsParams object +// with the ability to set a timeout on a request. +func NewListProjectOpenstackSecurityGroupsParamsWithTimeout(timeout time.Duration) *ListProjectOpenstackSecurityGroupsParams { + return &ListProjectOpenstackSecurityGroupsParams{ + timeout: timeout, + } +} + +// NewListProjectOpenstackSecurityGroupsParamsWithContext creates a new ListProjectOpenstackSecurityGroupsParams object +// with the ability to set a context for a request. +func NewListProjectOpenstackSecurityGroupsParamsWithContext(ctx context.Context) *ListProjectOpenstackSecurityGroupsParams { + return &ListProjectOpenstackSecurityGroupsParams{ + Context: ctx, + } +} + +// NewListProjectOpenstackSecurityGroupsParamsWithHTTPClient creates a new ListProjectOpenstackSecurityGroupsParams object +// with the ability to set a custom HTTPClient for a request. +func NewListProjectOpenstackSecurityGroupsParamsWithHTTPClient(client *http.Client) *ListProjectOpenstackSecurityGroupsParams { + return &ListProjectOpenstackSecurityGroupsParams{ + HTTPClient: client, + } +} + +/* +ListProjectOpenstackSecurityGroupsParams contains all the parameters to send to the API endpoint + + for the list project openstack security groups operation. + + Typically these are written to a http.Request. +*/ +type ListProjectOpenstackSecurityGroupsParams struct { + + // ApplicationCredentialID. + ApplicationCredentialID *string + + // ApplicationCredentialSecret. + ApplicationCredentialSecret *string + + // Credential. + Credential *string + + // DatacenterName. + DatacenterName *string + + // Domain. + Domain *string + + // OIDCAuthentication. + OIDCAuthentication *bool + + // OpenstackProject. + OpenstackProject *string + + // OpenstackProjectID. + OpenstackProjectID *string + + // OpenstackTenant. + OpenstackTenant *string + + // OpenstackTenantID. + OpenstackTenantID *string + + // Password. + Password *string + + // Username. + Username *string + + // ProjectID. + ProjectID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list project openstack security groups params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListProjectOpenstackSecurityGroupsParams) WithDefaults() *ListProjectOpenstackSecurityGroupsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list project openstack security groups params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListProjectOpenstackSecurityGroupsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) WithTimeout(timeout time.Duration) *ListProjectOpenstackSecurityGroupsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) WithContext(ctx context.Context) *ListProjectOpenstackSecurityGroupsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) WithHTTPClient(client *http.Client) *ListProjectOpenstackSecurityGroupsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationCredentialID adds the applicationCredentialID to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) WithApplicationCredentialID(applicationCredentialID *string) *ListProjectOpenstackSecurityGroupsParams { + o.SetApplicationCredentialID(applicationCredentialID) + return o +} + +// SetApplicationCredentialID adds the applicationCredentialId to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) SetApplicationCredentialID(applicationCredentialID *string) { + o.ApplicationCredentialID = applicationCredentialID +} + +// WithApplicationCredentialSecret adds the applicationCredentialSecret to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) WithApplicationCredentialSecret(applicationCredentialSecret *string) *ListProjectOpenstackSecurityGroupsParams { + o.SetApplicationCredentialSecret(applicationCredentialSecret) + return o +} + +// SetApplicationCredentialSecret adds the applicationCredentialSecret to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) SetApplicationCredentialSecret(applicationCredentialSecret *string) { + o.ApplicationCredentialSecret = applicationCredentialSecret +} + +// WithCredential adds the credential to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) WithCredential(credential *string) *ListProjectOpenstackSecurityGroupsParams { + o.SetCredential(credential) + return o +} + +// SetCredential adds the credential to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) SetCredential(credential *string) { + o.Credential = credential +} + +// WithDatacenterName adds the datacenterName to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) WithDatacenterName(datacenterName *string) *ListProjectOpenstackSecurityGroupsParams { + o.SetDatacenterName(datacenterName) + return o +} + +// SetDatacenterName adds the datacenterName to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) SetDatacenterName(datacenterName *string) { + o.DatacenterName = datacenterName +} + +// WithDomain adds the domain to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) WithDomain(domain *string) *ListProjectOpenstackSecurityGroupsParams { + o.SetDomain(domain) + return o +} + +// SetDomain adds the domain to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) SetDomain(domain *string) { + o.Domain = domain +} + +// WithOIDCAuthentication adds the oIDCAuthentication to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) WithOIDCAuthentication(oIDCAuthentication *bool) *ListProjectOpenstackSecurityGroupsParams { + o.SetOIDCAuthentication(oIDCAuthentication) + return o +} + +// SetOIDCAuthentication adds the oIdCAuthentication to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) SetOIDCAuthentication(oIDCAuthentication *bool) { + o.OIDCAuthentication = oIDCAuthentication +} + +// WithOpenstackProject adds the openstackProject to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) WithOpenstackProject(openstackProject *string) *ListProjectOpenstackSecurityGroupsParams { + o.SetOpenstackProject(openstackProject) + return o +} + +// SetOpenstackProject adds the openstackProject to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) SetOpenstackProject(openstackProject *string) { + o.OpenstackProject = openstackProject +} + +// WithOpenstackProjectID adds the openstackProjectID to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) WithOpenstackProjectID(openstackProjectID *string) *ListProjectOpenstackSecurityGroupsParams { + o.SetOpenstackProjectID(openstackProjectID) + return o +} + +// SetOpenstackProjectID adds the openstackProjectId to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) SetOpenstackProjectID(openstackProjectID *string) { + o.OpenstackProjectID = openstackProjectID +} + +// WithOpenstackTenant adds the openstackTenant to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) WithOpenstackTenant(openstackTenant *string) *ListProjectOpenstackSecurityGroupsParams { + o.SetOpenstackTenant(openstackTenant) + return o +} + +// SetOpenstackTenant adds the openstackTenant to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) SetOpenstackTenant(openstackTenant *string) { + o.OpenstackTenant = openstackTenant +} + +// WithOpenstackTenantID adds the openstackTenantID to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) WithOpenstackTenantID(openstackTenantID *string) *ListProjectOpenstackSecurityGroupsParams { + o.SetOpenstackTenantID(openstackTenantID) + return o +} + +// SetOpenstackTenantID adds the openstackTenantId to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) SetOpenstackTenantID(openstackTenantID *string) { + o.OpenstackTenantID = openstackTenantID +} + +// WithPassword adds the password to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) WithPassword(password *string) *ListProjectOpenstackSecurityGroupsParams { + o.SetPassword(password) + return o +} + +// SetPassword adds the password to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) SetPassword(password *string) { + o.Password = password +} + +// WithUsername adds the username to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) WithUsername(username *string) *ListProjectOpenstackSecurityGroupsParams { + o.SetUsername(username) + return o +} + +// SetUsername adds the username to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) SetUsername(username *string) { + o.Username = username +} + +// WithProjectID adds the projectID to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) WithProjectID(projectID string) *ListProjectOpenstackSecurityGroupsParams { + o.SetProjectID(projectID) + return o +} + +// SetProjectID adds the projectId to the list project openstack security groups params +func (o *ListProjectOpenstackSecurityGroupsParams) SetProjectID(projectID string) { + o.ProjectID = projectID +} + +// WriteToRequest writes these params to a swagger request +func (o *ListProjectOpenstackSecurityGroupsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ApplicationCredentialID != nil { + + // header param ApplicationCredentialID + if err := r.SetHeaderParam("ApplicationCredentialID", *o.ApplicationCredentialID); err != nil { + return err + } + } + + if o.ApplicationCredentialSecret != nil { + + // header param ApplicationCredentialSecret + if err := r.SetHeaderParam("ApplicationCredentialSecret", *o.ApplicationCredentialSecret); err != nil { + return err + } + } + + if o.Credential != nil { + + // header param Credential + if err := r.SetHeaderParam("Credential", *o.Credential); err != nil { + return err + } + } + + if o.DatacenterName != nil { + + // header param DatacenterName + if err := r.SetHeaderParam("DatacenterName", *o.DatacenterName); err != nil { + return err + } + } + + if o.Domain != nil { + + // header param Domain + if err := r.SetHeaderParam("Domain", *o.Domain); err != nil { + return err + } + } + + if o.OIDCAuthentication != nil { + + // header param OIDCAuthentication + if err := r.SetHeaderParam("OIDCAuthentication", swag.FormatBool(*o.OIDCAuthentication)); err != nil { + return err + } + } + + if o.OpenstackProject != nil { + + // header param OpenstackProject + if err := r.SetHeaderParam("OpenstackProject", *o.OpenstackProject); err != nil { + return err + } + } + + if o.OpenstackProjectID != nil { + + // header param OpenstackProjectID + if err := r.SetHeaderParam("OpenstackProjectID", *o.OpenstackProjectID); err != nil { + return err + } + } + + if o.OpenstackTenant != nil { + + // header param OpenstackTenant + if err := r.SetHeaderParam("OpenstackTenant", *o.OpenstackTenant); err != nil { + return err + } + } + + if o.OpenstackTenantID != nil { + + // header param OpenstackTenantID + if err := r.SetHeaderParam("OpenstackTenantID", *o.OpenstackTenantID); err != nil { + return err + } + } + + if o.Password != nil { + + // header param Password + if err := r.SetHeaderParam("Password", *o.Password); err != nil { + return err + } + } + + if o.Username != nil { + + // header param Username + if err := r.SetHeaderParam("Username", *o.Username); err != nil { + return err + } + } + + // path param project_id + if err := r.SetPathParam("project_id", o.ProjectID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_security_groups_responses.go b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_security_groups_responses.go new file mode 100644 index 0000000000..ff81d03f02 --- /dev/null +++ b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_security_groups_responses.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package openstack + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "k8c.io/dashboard/v2/pkg/test/e2e/utils/apiclient/models" +) + +// ListProjectOpenstackSecurityGroupsReader is a Reader for the ListProjectOpenstackSecurityGroups structure. +type ListProjectOpenstackSecurityGroupsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListProjectOpenstackSecurityGroupsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListProjectOpenstackSecurityGroupsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListProjectOpenstackSecurityGroupsDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewListProjectOpenstackSecurityGroupsOK creates a ListProjectOpenstackSecurityGroupsOK with default headers values +func NewListProjectOpenstackSecurityGroupsOK() *ListProjectOpenstackSecurityGroupsOK { + return &ListProjectOpenstackSecurityGroupsOK{} +} + +/* +ListProjectOpenstackSecurityGroupsOK describes a response with status code 200, with default header values. + +OpenstackSecurityGroup +*/ +type ListProjectOpenstackSecurityGroupsOK struct { + Payload []*models.OpenstackSecurityGroup +} + +// IsSuccess returns true when this list project openstack security groups o k response has a 2xx status code +func (o *ListProjectOpenstackSecurityGroupsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list project openstack security groups o k response has a 3xx status code +func (o *ListProjectOpenstackSecurityGroupsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list project openstack security groups o k response has a 4xx status code +func (o *ListProjectOpenstackSecurityGroupsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list project openstack security groups o k response has a 5xx status code +func (o *ListProjectOpenstackSecurityGroupsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list project openstack security groups o k response a status code equal to that given +func (o *ListProjectOpenstackSecurityGroupsOK) IsCode(code int) bool { + return code == 200 +} + +func (o *ListProjectOpenstackSecurityGroupsOK) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/securitygroups][%d] listProjectOpenstackSecurityGroupsOK %+v", 200, o.Payload) +} + +func (o *ListProjectOpenstackSecurityGroupsOK) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/securitygroups][%d] listProjectOpenstackSecurityGroupsOK %+v", 200, o.Payload) +} + +func (o *ListProjectOpenstackSecurityGroupsOK) GetPayload() []*models.OpenstackSecurityGroup { + return o.Payload +} + +func (o *ListProjectOpenstackSecurityGroupsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListProjectOpenstackSecurityGroupsDefault creates a ListProjectOpenstackSecurityGroupsDefault with default headers values +func NewListProjectOpenstackSecurityGroupsDefault(code int) *ListProjectOpenstackSecurityGroupsDefault { + return &ListProjectOpenstackSecurityGroupsDefault{ + _statusCode: code, + } +} + +/* +ListProjectOpenstackSecurityGroupsDefault describes a response with status code -1, with default header values. + +errorResponse +*/ +type ListProjectOpenstackSecurityGroupsDefault struct { + _statusCode int + + Payload *models.ErrorResponse +} + +// Code gets the status code for the list project openstack security groups default response +func (o *ListProjectOpenstackSecurityGroupsDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this list project openstack security groups default response has a 2xx status code +func (o *ListProjectOpenstackSecurityGroupsDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list project openstack security groups default response has a 3xx status code +func (o *ListProjectOpenstackSecurityGroupsDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list project openstack security groups default response has a 4xx status code +func (o *ListProjectOpenstackSecurityGroupsDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list project openstack security groups default response has a 5xx status code +func (o *ListProjectOpenstackSecurityGroupsDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list project openstack security groups default response a status code equal to that given +func (o *ListProjectOpenstackSecurityGroupsDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *ListProjectOpenstackSecurityGroupsDefault) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/securitygroups][%d] listProjectOpenstackSecurityGroups default %+v", o._statusCode, o.Payload) +} + +func (o *ListProjectOpenstackSecurityGroupsDefault) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/securitygroups][%d] listProjectOpenstackSecurityGroups default %+v", o._statusCode, o.Payload) +} + +func (o *ListProjectOpenstackSecurityGroupsDefault) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *ListProjectOpenstackSecurityGroupsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_server_groups_parameters.go b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_server_groups_parameters.go new file mode 100644 index 0000000000..d0832fa356 --- /dev/null +++ b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_server_groups_parameters.go @@ -0,0 +1,413 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package openstack + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewListProjectOpenstackServerGroupsParams creates a new ListProjectOpenstackServerGroupsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewListProjectOpenstackServerGroupsParams() *ListProjectOpenstackServerGroupsParams { + return &ListProjectOpenstackServerGroupsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListProjectOpenstackServerGroupsParamsWithTimeout creates a new ListProjectOpenstackServerGroupsParams object +// with the ability to set a timeout on a request. +func NewListProjectOpenstackServerGroupsParamsWithTimeout(timeout time.Duration) *ListProjectOpenstackServerGroupsParams { + return &ListProjectOpenstackServerGroupsParams{ + timeout: timeout, + } +} + +// NewListProjectOpenstackServerGroupsParamsWithContext creates a new ListProjectOpenstackServerGroupsParams object +// with the ability to set a context for a request. +func NewListProjectOpenstackServerGroupsParamsWithContext(ctx context.Context) *ListProjectOpenstackServerGroupsParams { + return &ListProjectOpenstackServerGroupsParams{ + Context: ctx, + } +} + +// NewListProjectOpenstackServerGroupsParamsWithHTTPClient creates a new ListProjectOpenstackServerGroupsParams object +// with the ability to set a custom HTTPClient for a request. +func NewListProjectOpenstackServerGroupsParamsWithHTTPClient(client *http.Client) *ListProjectOpenstackServerGroupsParams { + return &ListProjectOpenstackServerGroupsParams{ + HTTPClient: client, + } +} + +/* +ListProjectOpenstackServerGroupsParams contains all the parameters to send to the API endpoint + + for the list project openstack server groups operation. + + Typically these are written to a http.Request. +*/ +type ListProjectOpenstackServerGroupsParams struct { + + // ApplicationCredentialID. + ApplicationCredentialID *string + + // ApplicationCredentialSecret. + ApplicationCredentialSecret *string + + // Credential. + Credential *string + + // DatacenterName. + DatacenterName *string + + // Domain. + Domain *string + + // OIDCAuthentication. + OIDCAuthentication *bool + + // OpenstackProject. + OpenstackProject *string + + // OpenstackProjectID. + OpenstackProjectID *string + + // OpenstackTenant. + OpenstackTenant *string + + // OpenstackTenantID. + OpenstackTenantID *string + + // Password. + Password *string + + // Username. + Username *string + + // ProjectID. + ProjectID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list project openstack server groups params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListProjectOpenstackServerGroupsParams) WithDefaults() *ListProjectOpenstackServerGroupsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list project openstack server groups params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListProjectOpenstackServerGroupsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) WithTimeout(timeout time.Duration) *ListProjectOpenstackServerGroupsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) WithContext(ctx context.Context) *ListProjectOpenstackServerGroupsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) WithHTTPClient(client *http.Client) *ListProjectOpenstackServerGroupsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationCredentialID adds the applicationCredentialID to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) WithApplicationCredentialID(applicationCredentialID *string) *ListProjectOpenstackServerGroupsParams { + o.SetApplicationCredentialID(applicationCredentialID) + return o +} + +// SetApplicationCredentialID adds the applicationCredentialId to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) SetApplicationCredentialID(applicationCredentialID *string) { + o.ApplicationCredentialID = applicationCredentialID +} + +// WithApplicationCredentialSecret adds the applicationCredentialSecret to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) WithApplicationCredentialSecret(applicationCredentialSecret *string) *ListProjectOpenstackServerGroupsParams { + o.SetApplicationCredentialSecret(applicationCredentialSecret) + return o +} + +// SetApplicationCredentialSecret adds the applicationCredentialSecret to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) SetApplicationCredentialSecret(applicationCredentialSecret *string) { + o.ApplicationCredentialSecret = applicationCredentialSecret +} + +// WithCredential adds the credential to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) WithCredential(credential *string) *ListProjectOpenstackServerGroupsParams { + o.SetCredential(credential) + return o +} + +// SetCredential adds the credential to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) SetCredential(credential *string) { + o.Credential = credential +} + +// WithDatacenterName adds the datacenterName to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) WithDatacenterName(datacenterName *string) *ListProjectOpenstackServerGroupsParams { + o.SetDatacenterName(datacenterName) + return o +} + +// SetDatacenterName adds the datacenterName to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) SetDatacenterName(datacenterName *string) { + o.DatacenterName = datacenterName +} + +// WithDomain adds the domain to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) WithDomain(domain *string) *ListProjectOpenstackServerGroupsParams { + o.SetDomain(domain) + return o +} + +// SetDomain adds the domain to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) SetDomain(domain *string) { + o.Domain = domain +} + +// WithOIDCAuthentication adds the oIDCAuthentication to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) WithOIDCAuthentication(oIDCAuthentication *bool) *ListProjectOpenstackServerGroupsParams { + o.SetOIDCAuthentication(oIDCAuthentication) + return o +} + +// SetOIDCAuthentication adds the oIdCAuthentication to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) SetOIDCAuthentication(oIDCAuthentication *bool) { + o.OIDCAuthentication = oIDCAuthentication +} + +// WithOpenstackProject adds the openstackProject to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) WithOpenstackProject(openstackProject *string) *ListProjectOpenstackServerGroupsParams { + o.SetOpenstackProject(openstackProject) + return o +} + +// SetOpenstackProject adds the openstackProject to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) SetOpenstackProject(openstackProject *string) { + o.OpenstackProject = openstackProject +} + +// WithOpenstackProjectID adds the openstackProjectID to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) WithOpenstackProjectID(openstackProjectID *string) *ListProjectOpenstackServerGroupsParams { + o.SetOpenstackProjectID(openstackProjectID) + return o +} + +// SetOpenstackProjectID adds the openstackProjectId to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) SetOpenstackProjectID(openstackProjectID *string) { + o.OpenstackProjectID = openstackProjectID +} + +// WithOpenstackTenant adds the openstackTenant to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) WithOpenstackTenant(openstackTenant *string) *ListProjectOpenstackServerGroupsParams { + o.SetOpenstackTenant(openstackTenant) + return o +} + +// SetOpenstackTenant adds the openstackTenant to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) SetOpenstackTenant(openstackTenant *string) { + o.OpenstackTenant = openstackTenant +} + +// WithOpenstackTenantID adds the openstackTenantID to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) WithOpenstackTenantID(openstackTenantID *string) *ListProjectOpenstackServerGroupsParams { + o.SetOpenstackTenantID(openstackTenantID) + return o +} + +// SetOpenstackTenantID adds the openstackTenantId to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) SetOpenstackTenantID(openstackTenantID *string) { + o.OpenstackTenantID = openstackTenantID +} + +// WithPassword adds the password to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) WithPassword(password *string) *ListProjectOpenstackServerGroupsParams { + o.SetPassword(password) + return o +} + +// SetPassword adds the password to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) SetPassword(password *string) { + o.Password = password +} + +// WithUsername adds the username to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) WithUsername(username *string) *ListProjectOpenstackServerGroupsParams { + o.SetUsername(username) + return o +} + +// SetUsername adds the username to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) SetUsername(username *string) { + o.Username = username +} + +// WithProjectID adds the projectID to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) WithProjectID(projectID string) *ListProjectOpenstackServerGroupsParams { + o.SetProjectID(projectID) + return o +} + +// SetProjectID adds the projectId to the list project openstack server groups params +func (o *ListProjectOpenstackServerGroupsParams) SetProjectID(projectID string) { + o.ProjectID = projectID +} + +// WriteToRequest writes these params to a swagger request +func (o *ListProjectOpenstackServerGroupsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ApplicationCredentialID != nil { + + // header param ApplicationCredentialID + if err := r.SetHeaderParam("ApplicationCredentialID", *o.ApplicationCredentialID); err != nil { + return err + } + } + + if o.ApplicationCredentialSecret != nil { + + // header param ApplicationCredentialSecret + if err := r.SetHeaderParam("ApplicationCredentialSecret", *o.ApplicationCredentialSecret); err != nil { + return err + } + } + + if o.Credential != nil { + + // header param Credential + if err := r.SetHeaderParam("Credential", *o.Credential); err != nil { + return err + } + } + + if o.DatacenterName != nil { + + // header param DatacenterName + if err := r.SetHeaderParam("DatacenterName", *o.DatacenterName); err != nil { + return err + } + } + + if o.Domain != nil { + + // header param Domain + if err := r.SetHeaderParam("Domain", *o.Domain); err != nil { + return err + } + } + + if o.OIDCAuthentication != nil { + + // header param OIDCAuthentication + if err := r.SetHeaderParam("OIDCAuthentication", swag.FormatBool(*o.OIDCAuthentication)); err != nil { + return err + } + } + + if o.OpenstackProject != nil { + + // header param OpenstackProject + if err := r.SetHeaderParam("OpenstackProject", *o.OpenstackProject); err != nil { + return err + } + } + + if o.OpenstackProjectID != nil { + + // header param OpenstackProjectID + if err := r.SetHeaderParam("OpenstackProjectID", *o.OpenstackProjectID); err != nil { + return err + } + } + + if o.OpenstackTenant != nil { + + // header param OpenstackTenant + if err := r.SetHeaderParam("OpenstackTenant", *o.OpenstackTenant); err != nil { + return err + } + } + + if o.OpenstackTenantID != nil { + + // header param OpenstackTenantID + if err := r.SetHeaderParam("OpenstackTenantID", *o.OpenstackTenantID); err != nil { + return err + } + } + + if o.Password != nil { + + // header param Password + if err := r.SetHeaderParam("Password", *o.Password); err != nil { + return err + } + } + + if o.Username != nil { + + // header param Username + if err := r.SetHeaderParam("Username", *o.Username); err != nil { + return err + } + } + + // path param project_id + if err := r.SetPathParam("project_id", o.ProjectID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_server_groups_responses.go b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_server_groups_responses.go new file mode 100644 index 0000000000..b892770d3e --- /dev/null +++ b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_server_groups_responses.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package openstack + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "k8c.io/dashboard/v2/pkg/test/e2e/utils/apiclient/models" +) + +// ListProjectOpenstackServerGroupsReader is a Reader for the ListProjectOpenstackServerGroups structure. +type ListProjectOpenstackServerGroupsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListProjectOpenstackServerGroupsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListProjectOpenstackServerGroupsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListProjectOpenstackServerGroupsDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewListProjectOpenstackServerGroupsOK creates a ListProjectOpenstackServerGroupsOK with default headers values +func NewListProjectOpenstackServerGroupsOK() *ListProjectOpenstackServerGroupsOK { + return &ListProjectOpenstackServerGroupsOK{} +} + +/* +ListProjectOpenstackServerGroupsOK describes a response with status code 200, with default header values. + +OpenstackServerGroup +*/ +type ListProjectOpenstackServerGroupsOK struct { + Payload []*models.OpenstackServerGroup +} + +// IsSuccess returns true when this list project openstack server groups o k response has a 2xx status code +func (o *ListProjectOpenstackServerGroupsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list project openstack server groups o k response has a 3xx status code +func (o *ListProjectOpenstackServerGroupsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list project openstack server groups o k response has a 4xx status code +func (o *ListProjectOpenstackServerGroupsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list project openstack server groups o k response has a 5xx status code +func (o *ListProjectOpenstackServerGroupsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list project openstack server groups o k response a status code equal to that given +func (o *ListProjectOpenstackServerGroupsOK) IsCode(code int) bool { + return code == 200 +} + +func (o *ListProjectOpenstackServerGroupsOK) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/servergroups][%d] listProjectOpenstackServerGroupsOK %+v", 200, o.Payload) +} + +func (o *ListProjectOpenstackServerGroupsOK) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/servergroups][%d] listProjectOpenstackServerGroupsOK %+v", 200, o.Payload) +} + +func (o *ListProjectOpenstackServerGroupsOK) GetPayload() []*models.OpenstackServerGroup { + return o.Payload +} + +func (o *ListProjectOpenstackServerGroupsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListProjectOpenstackServerGroupsDefault creates a ListProjectOpenstackServerGroupsDefault with default headers values +func NewListProjectOpenstackServerGroupsDefault(code int) *ListProjectOpenstackServerGroupsDefault { + return &ListProjectOpenstackServerGroupsDefault{ + _statusCode: code, + } +} + +/* +ListProjectOpenstackServerGroupsDefault describes a response with status code -1, with default header values. + +errorResponse +*/ +type ListProjectOpenstackServerGroupsDefault struct { + _statusCode int + + Payload *models.ErrorResponse +} + +// Code gets the status code for the list project openstack server groups default response +func (o *ListProjectOpenstackServerGroupsDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this list project openstack server groups default response has a 2xx status code +func (o *ListProjectOpenstackServerGroupsDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list project openstack server groups default response has a 3xx status code +func (o *ListProjectOpenstackServerGroupsDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list project openstack server groups default response has a 4xx status code +func (o *ListProjectOpenstackServerGroupsDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list project openstack server groups default response has a 5xx status code +func (o *ListProjectOpenstackServerGroupsDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list project openstack server groups default response a status code equal to that given +func (o *ListProjectOpenstackServerGroupsDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *ListProjectOpenstackServerGroupsDefault) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/servergroups][%d] listProjectOpenstackServerGroups default %+v", o._statusCode, o.Payload) +} + +func (o *ListProjectOpenstackServerGroupsDefault) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/servergroups][%d] listProjectOpenstackServerGroups default %+v", o._statusCode, o.Payload) +} + +func (o *ListProjectOpenstackServerGroupsDefault) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *ListProjectOpenstackServerGroupsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_sizes_parameters.go b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_sizes_parameters.go new file mode 100644 index 0000000000..fb5e825d75 --- /dev/null +++ b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_sizes_parameters.go @@ -0,0 +1,413 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package openstack + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewListProjectOpenstackSizesParams creates a new ListProjectOpenstackSizesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewListProjectOpenstackSizesParams() *ListProjectOpenstackSizesParams { + return &ListProjectOpenstackSizesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListProjectOpenstackSizesParamsWithTimeout creates a new ListProjectOpenstackSizesParams object +// with the ability to set a timeout on a request. +func NewListProjectOpenstackSizesParamsWithTimeout(timeout time.Duration) *ListProjectOpenstackSizesParams { + return &ListProjectOpenstackSizesParams{ + timeout: timeout, + } +} + +// NewListProjectOpenstackSizesParamsWithContext creates a new ListProjectOpenstackSizesParams object +// with the ability to set a context for a request. +func NewListProjectOpenstackSizesParamsWithContext(ctx context.Context) *ListProjectOpenstackSizesParams { + return &ListProjectOpenstackSizesParams{ + Context: ctx, + } +} + +// NewListProjectOpenstackSizesParamsWithHTTPClient creates a new ListProjectOpenstackSizesParams object +// with the ability to set a custom HTTPClient for a request. +func NewListProjectOpenstackSizesParamsWithHTTPClient(client *http.Client) *ListProjectOpenstackSizesParams { + return &ListProjectOpenstackSizesParams{ + HTTPClient: client, + } +} + +/* +ListProjectOpenstackSizesParams contains all the parameters to send to the API endpoint + + for the list project openstack sizes operation. + + Typically these are written to a http.Request. +*/ +type ListProjectOpenstackSizesParams struct { + + // ApplicationCredentialID. + ApplicationCredentialID *string + + // ApplicationCredentialSecret. + ApplicationCredentialSecret *string + + // Credential. + Credential *string + + // DatacenterName. + DatacenterName *string + + // Domain. + Domain *string + + // OIDCAuthentication. + OIDCAuthentication *bool + + // OpenstackProject. + OpenstackProject *string + + // OpenstackProjectID. + OpenstackProjectID *string + + // OpenstackTenant. + OpenstackTenant *string + + // OpenstackTenantID. + OpenstackTenantID *string + + // Password. + Password *string + + // Username. + Username *string + + // ProjectID. + ProjectID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list project openstack sizes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListProjectOpenstackSizesParams) WithDefaults() *ListProjectOpenstackSizesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list project openstack sizes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListProjectOpenstackSizesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) WithTimeout(timeout time.Duration) *ListProjectOpenstackSizesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) WithContext(ctx context.Context) *ListProjectOpenstackSizesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) WithHTTPClient(client *http.Client) *ListProjectOpenstackSizesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationCredentialID adds the applicationCredentialID to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) WithApplicationCredentialID(applicationCredentialID *string) *ListProjectOpenstackSizesParams { + o.SetApplicationCredentialID(applicationCredentialID) + return o +} + +// SetApplicationCredentialID adds the applicationCredentialId to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) SetApplicationCredentialID(applicationCredentialID *string) { + o.ApplicationCredentialID = applicationCredentialID +} + +// WithApplicationCredentialSecret adds the applicationCredentialSecret to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) WithApplicationCredentialSecret(applicationCredentialSecret *string) *ListProjectOpenstackSizesParams { + o.SetApplicationCredentialSecret(applicationCredentialSecret) + return o +} + +// SetApplicationCredentialSecret adds the applicationCredentialSecret to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) SetApplicationCredentialSecret(applicationCredentialSecret *string) { + o.ApplicationCredentialSecret = applicationCredentialSecret +} + +// WithCredential adds the credential to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) WithCredential(credential *string) *ListProjectOpenstackSizesParams { + o.SetCredential(credential) + return o +} + +// SetCredential adds the credential to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) SetCredential(credential *string) { + o.Credential = credential +} + +// WithDatacenterName adds the datacenterName to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) WithDatacenterName(datacenterName *string) *ListProjectOpenstackSizesParams { + o.SetDatacenterName(datacenterName) + return o +} + +// SetDatacenterName adds the datacenterName to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) SetDatacenterName(datacenterName *string) { + o.DatacenterName = datacenterName +} + +// WithDomain adds the domain to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) WithDomain(domain *string) *ListProjectOpenstackSizesParams { + o.SetDomain(domain) + return o +} + +// SetDomain adds the domain to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) SetDomain(domain *string) { + o.Domain = domain +} + +// WithOIDCAuthentication adds the oIDCAuthentication to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) WithOIDCAuthentication(oIDCAuthentication *bool) *ListProjectOpenstackSizesParams { + o.SetOIDCAuthentication(oIDCAuthentication) + return o +} + +// SetOIDCAuthentication adds the oIdCAuthentication to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) SetOIDCAuthentication(oIDCAuthentication *bool) { + o.OIDCAuthentication = oIDCAuthentication +} + +// WithOpenstackProject adds the openstackProject to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) WithOpenstackProject(openstackProject *string) *ListProjectOpenstackSizesParams { + o.SetOpenstackProject(openstackProject) + return o +} + +// SetOpenstackProject adds the openstackProject to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) SetOpenstackProject(openstackProject *string) { + o.OpenstackProject = openstackProject +} + +// WithOpenstackProjectID adds the openstackProjectID to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) WithOpenstackProjectID(openstackProjectID *string) *ListProjectOpenstackSizesParams { + o.SetOpenstackProjectID(openstackProjectID) + return o +} + +// SetOpenstackProjectID adds the openstackProjectId to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) SetOpenstackProjectID(openstackProjectID *string) { + o.OpenstackProjectID = openstackProjectID +} + +// WithOpenstackTenant adds the openstackTenant to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) WithOpenstackTenant(openstackTenant *string) *ListProjectOpenstackSizesParams { + o.SetOpenstackTenant(openstackTenant) + return o +} + +// SetOpenstackTenant adds the openstackTenant to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) SetOpenstackTenant(openstackTenant *string) { + o.OpenstackTenant = openstackTenant +} + +// WithOpenstackTenantID adds the openstackTenantID to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) WithOpenstackTenantID(openstackTenantID *string) *ListProjectOpenstackSizesParams { + o.SetOpenstackTenantID(openstackTenantID) + return o +} + +// SetOpenstackTenantID adds the openstackTenantId to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) SetOpenstackTenantID(openstackTenantID *string) { + o.OpenstackTenantID = openstackTenantID +} + +// WithPassword adds the password to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) WithPassword(password *string) *ListProjectOpenstackSizesParams { + o.SetPassword(password) + return o +} + +// SetPassword adds the password to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) SetPassword(password *string) { + o.Password = password +} + +// WithUsername adds the username to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) WithUsername(username *string) *ListProjectOpenstackSizesParams { + o.SetUsername(username) + return o +} + +// SetUsername adds the username to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) SetUsername(username *string) { + o.Username = username +} + +// WithProjectID adds the projectID to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) WithProjectID(projectID string) *ListProjectOpenstackSizesParams { + o.SetProjectID(projectID) + return o +} + +// SetProjectID adds the projectId to the list project openstack sizes params +func (o *ListProjectOpenstackSizesParams) SetProjectID(projectID string) { + o.ProjectID = projectID +} + +// WriteToRequest writes these params to a swagger request +func (o *ListProjectOpenstackSizesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ApplicationCredentialID != nil { + + // header param ApplicationCredentialID + if err := r.SetHeaderParam("ApplicationCredentialID", *o.ApplicationCredentialID); err != nil { + return err + } + } + + if o.ApplicationCredentialSecret != nil { + + // header param ApplicationCredentialSecret + if err := r.SetHeaderParam("ApplicationCredentialSecret", *o.ApplicationCredentialSecret); err != nil { + return err + } + } + + if o.Credential != nil { + + // header param Credential + if err := r.SetHeaderParam("Credential", *o.Credential); err != nil { + return err + } + } + + if o.DatacenterName != nil { + + // header param DatacenterName + if err := r.SetHeaderParam("DatacenterName", *o.DatacenterName); err != nil { + return err + } + } + + if o.Domain != nil { + + // header param Domain + if err := r.SetHeaderParam("Domain", *o.Domain); err != nil { + return err + } + } + + if o.OIDCAuthentication != nil { + + // header param OIDCAuthentication + if err := r.SetHeaderParam("OIDCAuthentication", swag.FormatBool(*o.OIDCAuthentication)); err != nil { + return err + } + } + + if o.OpenstackProject != nil { + + // header param OpenstackProject + if err := r.SetHeaderParam("OpenstackProject", *o.OpenstackProject); err != nil { + return err + } + } + + if o.OpenstackProjectID != nil { + + // header param OpenstackProjectID + if err := r.SetHeaderParam("OpenstackProjectID", *o.OpenstackProjectID); err != nil { + return err + } + } + + if o.OpenstackTenant != nil { + + // header param OpenstackTenant + if err := r.SetHeaderParam("OpenstackTenant", *o.OpenstackTenant); err != nil { + return err + } + } + + if o.OpenstackTenantID != nil { + + // header param OpenstackTenantID + if err := r.SetHeaderParam("OpenstackTenantID", *o.OpenstackTenantID); err != nil { + return err + } + } + + if o.Password != nil { + + // header param Password + if err := r.SetHeaderParam("Password", *o.Password); err != nil { + return err + } + } + + if o.Username != nil { + + // header param Username + if err := r.SetHeaderParam("Username", *o.Username); err != nil { + return err + } + } + + // path param project_id + if err := r.SetPathParam("project_id", o.ProjectID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_sizes_responses.go b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_sizes_responses.go new file mode 100644 index 0000000000..ee76a93ac6 --- /dev/null +++ b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_sizes_responses.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package openstack + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "k8c.io/dashboard/v2/pkg/test/e2e/utils/apiclient/models" +) + +// ListProjectOpenstackSizesReader is a Reader for the ListProjectOpenstackSizes structure. +type ListProjectOpenstackSizesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListProjectOpenstackSizesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListProjectOpenstackSizesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListProjectOpenstackSizesDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewListProjectOpenstackSizesOK creates a ListProjectOpenstackSizesOK with default headers values +func NewListProjectOpenstackSizesOK() *ListProjectOpenstackSizesOK { + return &ListProjectOpenstackSizesOK{} +} + +/* +ListProjectOpenstackSizesOK describes a response with status code 200, with default header values. + +OpenstackSize +*/ +type ListProjectOpenstackSizesOK struct { + Payload []*models.OpenstackSize +} + +// IsSuccess returns true when this list project openstack sizes o k response has a 2xx status code +func (o *ListProjectOpenstackSizesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list project openstack sizes o k response has a 3xx status code +func (o *ListProjectOpenstackSizesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list project openstack sizes o k response has a 4xx status code +func (o *ListProjectOpenstackSizesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list project openstack sizes o k response has a 5xx status code +func (o *ListProjectOpenstackSizesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list project openstack sizes o k response a status code equal to that given +func (o *ListProjectOpenstackSizesOK) IsCode(code int) bool { + return code == 200 +} + +func (o *ListProjectOpenstackSizesOK) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/sizes][%d] listProjectOpenstackSizesOK %+v", 200, o.Payload) +} + +func (o *ListProjectOpenstackSizesOK) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/sizes][%d] listProjectOpenstackSizesOK %+v", 200, o.Payload) +} + +func (o *ListProjectOpenstackSizesOK) GetPayload() []*models.OpenstackSize { + return o.Payload +} + +func (o *ListProjectOpenstackSizesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListProjectOpenstackSizesDefault creates a ListProjectOpenstackSizesDefault with default headers values +func NewListProjectOpenstackSizesDefault(code int) *ListProjectOpenstackSizesDefault { + return &ListProjectOpenstackSizesDefault{ + _statusCode: code, + } +} + +/* +ListProjectOpenstackSizesDefault describes a response with status code -1, with default header values. + +errorResponse +*/ +type ListProjectOpenstackSizesDefault struct { + _statusCode int + + Payload *models.ErrorResponse +} + +// Code gets the status code for the list project openstack sizes default response +func (o *ListProjectOpenstackSizesDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this list project openstack sizes default response has a 2xx status code +func (o *ListProjectOpenstackSizesDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list project openstack sizes default response has a 3xx status code +func (o *ListProjectOpenstackSizesDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list project openstack sizes default response has a 4xx status code +func (o *ListProjectOpenstackSizesDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list project openstack sizes default response has a 5xx status code +func (o *ListProjectOpenstackSizesDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list project openstack sizes default response a status code equal to that given +func (o *ListProjectOpenstackSizesDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *ListProjectOpenstackSizesDefault) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/sizes][%d] listProjectOpenstackSizes default %+v", o._statusCode, o.Payload) +} + +func (o *ListProjectOpenstackSizesDefault) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/sizes][%d] listProjectOpenstackSizes default %+v", o._statusCode, o.Payload) +} + +func (o *ListProjectOpenstackSizesDefault) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *ListProjectOpenstackSizesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_subnet_pools_parameters.go b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_subnet_pools_parameters.go new file mode 100644 index 0000000000..5f4ad9559f --- /dev/null +++ b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_subnet_pools_parameters.go @@ -0,0 +1,446 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package openstack + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewListProjectOpenstackSubnetPoolsParams creates a new ListProjectOpenstackSubnetPoolsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewListProjectOpenstackSubnetPoolsParams() *ListProjectOpenstackSubnetPoolsParams { + return &ListProjectOpenstackSubnetPoolsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListProjectOpenstackSubnetPoolsParamsWithTimeout creates a new ListProjectOpenstackSubnetPoolsParams object +// with the ability to set a timeout on a request. +func NewListProjectOpenstackSubnetPoolsParamsWithTimeout(timeout time.Duration) *ListProjectOpenstackSubnetPoolsParams { + return &ListProjectOpenstackSubnetPoolsParams{ + timeout: timeout, + } +} + +// NewListProjectOpenstackSubnetPoolsParamsWithContext creates a new ListProjectOpenstackSubnetPoolsParams object +// with the ability to set a context for a request. +func NewListProjectOpenstackSubnetPoolsParamsWithContext(ctx context.Context) *ListProjectOpenstackSubnetPoolsParams { + return &ListProjectOpenstackSubnetPoolsParams{ + Context: ctx, + } +} + +// NewListProjectOpenstackSubnetPoolsParamsWithHTTPClient creates a new ListProjectOpenstackSubnetPoolsParams object +// with the ability to set a custom HTTPClient for a request. +func NewListProjectOpenstackSubnetPoolsParamsWithHTTPClient(client *http.Client) *ListProjectOpenstackSubnetPoolsParams { + return &ListProjectOpenstackSubnetPoolsParams{ + HTTPClient: client, + } +} + +/* +ListProjectOpenstackSubnetPoolsParams contains all the parameters to send to the API endpoint + + for the list project openstack subnet pools operation. + + Typically these are written to a http.Request. +*/ +type ListProjectOpenstackSubnetPoolsParams struct { + + // ApplicationCredentialID. + ApplicationCredentialID *string + + // ApplicationCredentialSecret. + ApplicationCredentialSecret *string + + // Credential. + Credential *string + + // DatacenterName. + DatacenterName *string + + // Domain. + Domain *string + + // OIDCAuthentication. + OIDCAuthentication *bool + + // OpenstackProject. + OpenstackProject *string + + // OpenstackProjectID. + OpenstackProjectID *string + + // OpenstackTenant. + OpenstackTenant *string + + // OpenstackTenantID. + OpenstackTenantID *string + + // Password. + Password *string + + // Username. + Username *string + + // IPVersion. + // + // Format: int64 + IPVersion *int64 + + // ProjectID. + ProjectID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list project openstack subnet pools params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListProjectOpenstackSubnetPoolsParams) WithDefaults() *ListProjectOpenstackSubnetPoolsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list project openstack subnet pools params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListProjectOpenstackSubnetPoolsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) WithTimeout(timeout time.Duration) *ListProjectOpenstackSubnetPoolsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) WithContext(ctx context.Context) *ListProjectOpenstackSubnetPoolsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) WithHTTPClient(client *http.Client) *ListProjectOpenstackSubnetPoolsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationCredentialID adds the applicationCredentialID to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) WithApplicationCredentialID(applicationCredentialID *string) *ListProjectOpenstackSubnetPoolsParams { + o.SetApplicationCredentialID(applicationCredentialID) + return o +} + +// SetApplicationCredentialID adds the applicationCredentialId to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) SetApplicationCredentialID(applicationCredentialID *string) { + o.ApplicationCredentialID = applicationCredentialID +} + +// WithApplicationCredentialSecret adds the applicationCredentialSecret to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) WithApplicationCredentialSecret(applicationCredentialSecret *string) *ListProjectOpenstackSubnetPoolsParams { + o.SetApplicationCredentialSecret(applicationCredentialSecret) + return o +} + +// SetApplicationCredentialSecret adds the applicationCredentialSecret to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) SetApplicationCredentialSecret(applicationCredentialSecret *string) { + o.ApplicationCredentialSecret = applicationCredentialSecret +} + +// WithCredential adds the credential to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) WithCredential(credential *string) *ListProjectOpenstackSubnetPoolsParams { + o.SetCredential(credential) + return o +} + +// SetCredential adds the credential to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) SetCredential(credential *string) { + o.Credential = credential +} + +// WithDatacenterName adds the datacenterName to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) WithDatacenterName(datacenterName *string) *ListProjectOpenstackSubnetPoolsParams { + o.SetDatacenterName(datacenterName) + return o +} + +// SetDatacenterName adds the datacenterName to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) SetDatacenterName(datacenterName *string) { + o.DatacenterName = datacenterName +} + +// WithDomain adds the domain to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) WithDomain(domain *string) *ListProjectOpenstackSubnetPoolsParams { + o.SetDomain(domain) + return o +} + +// SetDomain adds the domain to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) SetDomain(domain *string) { + o.Domain = domain +} + +// WithOIDCAuthentication adds the oIDCAuthentication to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) WithOIDCAuthentication(oIDCAuthentication *bool) *ListProjectOpenstackSubnetPoolsParams { + o.SetOIDCAuthentication(oIDCAuthentication) + return o +} + +// SetOIDCAuthentication adds the oIdCAuthentication to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) SetOIDCAuthentication(oIDCAuthentication *bool) { + o.OIDCAuthentication = oIDCAuthentication +} + +// WithOpenstackProject adds the openstackProject to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) WithOpenstackProject(openstackProject *string) *ListProjectOpenstackSubnetPoolsParams { + o.SetOpenstackProject(openstackProject) + return o +} + +// SetOpenstackProject adds the openstackProject to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) SetOpenstackProject(openstackProject *string) { + o.OpenstackProject = openstackProject +} + +// WithOpenstackProjectID adds the openstackProjectID to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) WithOpenstackProjectID(openstackProjectID *string) *ListProjectOpenstackSubnetPoolsParams { + o.SetOpenstackProjectID(openstackProjectID) + return o +} + +// SetOpenstackProjectID adds the openstackProjectId to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) SetOpenstackProjectID(openstackProjectID *string) { + o.OpenstackProjectID = openstackProjectID +} + +// WithOpenstackTenant adds the openstackTenant to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) WithOpenstackTenant(openstackTenant *string) *ListProjectOpenstackSubnetPoolsParams { + o.SetOpenstackTenant(openstackTenant) + return o +} + +// SetOpenstackTenant adds the openstackTenant to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) SetOpenstackTenant(openstackTenant *string) { + o.OpenstackTenant = openstackTenant +} + +// WithOpenstackTenantID adds the openstackTenantID to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) WithOpenstackTenantID(openstackTenantID *string) *ListProjectOpenstackSubnetPoolsParams { + o.SetOpenstackTenantID(openstackTenantID) + return o +} + +// SetOpenstackTenantID adds the openstackTenantId to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) SetOpenstackTenantID(openstackTenantID *string) { + o.OpenstackTenantID = openstackTenantID +} + +// WithPassword adds the password to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) WithPassword(password *string) *ListProjectOpenstackSubnetPoolsParams { + o.SetPassword(password) + return o +} + +// SetPassword adds the password to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) SetPassword(password *string) { + o.Password = password +} + +// WithUsername adds the username to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) WithUsername(username *string) *ListProjectOpenstackSubnetPoolsParams { + o.SetUsername(username) + return o +} + +// SetUsername adds the username to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) SetUsername(username *string) { + o.Username = username +} + +// WithIPVersion adds the iPVersion to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) WithIPVersion(iPVersion *int64) *ListProjectOpenstackSubnetPoolsParams { + o.SetIPVersion(iPVersion) + return o +} + +// SetIPVersion adds the ipVersion to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) SetIPVersion(iPVersion *int64) { + o.IPVersion = iPVersion +} + +// WithProjectID adds the projectID to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) WithProjectID(projectID string) *ListProjectOpenstackSubnetPoolsParams { + o.SetProjectID(projectID) + return o +} + +// SetProjectID adds the projectId to the list project openstack subnet pools params +func (o *ListProjectOpenstackSubnetPoolsParams) SetProjectID(projectID string) { + o.ProjectID = projectID +} + +// WriteToRequest writes these params to a swagger request +func (o *ListProjectOpenstackSubnetPoolsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ApplicationCredentialID != nil { + + // header param ApplicationCredentialID + if err := r.SetHeaderParam("ApplicationCredentialID", *o.ApplicationCredentialID); err != nil { + return err + } + } + + if o.ApplicationCredentialSecret != nil { + + // header param ApplicationCredentialSecret + if err := r.SetHeaderParam("ApplicationCredentialSecret", *o.ApplicationCredentialSecret); err != nil { + return err + } + } + + if o.Credential != nil { + + // header param Credential + if err := r.SetHeaderParam("Credential", *o.Credential); err != nil { + return err + } + } + + if o.DatacenterName != nil { + + // header param DatacenterName + if err := r.SetHeaderParam("DatacenterName", *o.DatacenterName); err != nil { + return err + } + } + + if o.Domain != nil { + + // header param Domain + if err := r.SetHeaderParam("Domain", *o.Domain); err != nil { + return err + } + } + + if o.OIDCAuthentication != nil { + + // header param OIDCAuthentication + if err := r.SetHeaderParam("OIDCAuthentication", swag.FormatBool(*o.OIDCAuthentication)); err != nil { + return err + } + } + + if o.OpenstackProject != nil { + + // header param OpenstackProject + if err := r.SetHeaderParam("OpenstackProject", *o.OpenstackProject); err != nil { + return err + } + } + + if o.OpenstackProjectID != nil { + + // header param OpenstackProjectID + if err := r.SetHeaderParam("OpenstackProjectID", *o.OpenstackProjectID); err != nil { + return err + } + } + + if o.OpenstackTenant != nil { + + // header param OpenstackTenant + if err := r.SetHeaderParam("OpenstackTenant", *o.OpenstackTenant); err != nil { + return err + } + } + + if o.OpenstackTenantID != nil { + + // header param OpenstackTenantID + if err := r.SetHeaderParam("OpenstackTenantID", *o.OpenstackTenantID); err != nil { + return err + } + } + + if o.Password != nil { + + // header param Password + if err := r.SetHeaderParam("Password", *o.Password); err != nil { + return err + } + } + + if o.Username != nil { + + // header param Username + if err := r.SetHeaderParam("Username", *o.Username); err != nil { + return err + } + } + + if o.IPVersion != nil { + + // query param ip_version + var qrIPVersion int64 + + if o.IPVersion != nil { + qrIPVersion = *o.IPVersion + } + qIPVersion := swag.FormatInt64(qrIPVersion) + if qIPVersion != "" { + + if err := r.SetQueryParam("ip_version", qIPVersion); err != nil { + return err + } + } + } + + // path param project_id + if err := r.SetPathParam("project_id", o.ProjectID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_subnet_pools_responses.go b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_subnet_pools_responses.go new file mode 100644 index 0000000000..d1bf4f25a8 --- /dev/null +++ b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_subnet_pools_responses.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package openstack + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "k8c.io/dashboard/v2/pkg/test/e2e/utils/apiclient/models" +) + +// ListProjectOpenstackSubnetPoolsReader is a Reader for the ListProjectOpenstackSubnetPools structure. +type ListProjectOpenstackSubnetPoolsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListProjectOpenstackSubnetPoolsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListProjectOpenstackSubnetPoolsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListProjectOpenstackSubnetPoolsDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewListProjectOpenstackSubnetPoolsOK creates a ListProjectOpenstackSubnetPoolsOK with default headers values +func NewListProjectOpenstackSubnetPoolsOK() *ListProjectOpenstackSubnetPoolsOK { + return &ListProjectOpenstackSubnetPoolsOK{} +} + +/* +ListProjectOpenstackSubnetPoolsOK describes a response with status code 200, with default header values. + +OpenstackSubnetPool +*/ +type ListProjectOpenstackSubnetPoolsOK struct { + Payload []*models.OpenstackSubnetPool +} + +// IsSuccess returns true when this list project openstack subnet pools o k response has a 2xx status code +func (o *ListProjectOpenstackSubnetPoolsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list project openstack subnet pools o k response has a 3xx status code +func (o *ListProjectOpenstackSubnetPoolsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list project openstack subnet pools o k response has a 4xx status code +func (o *ListProjectOpenstackSubnetPoolsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list project openstack subnet pools o k response has a 5xx status code +func (o *ListProjectOpenstackSubnetPoolsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list project openstack subnet pools o k response a status code equal to that given +func (o *ListProjectOpenstackSubnetPoolsOK) IsCode(code int) bool { + return code == 200 +} + +func (o *ListProjectOpenstackSubnetPoolsOK) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/subnetpools][%d] listProjectOpenstackSubnetPoolsOK %+v", 200, o.Payload) +} + +func (o *ListProjectOpenstackSubnetPoolsOK) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/subnetpools][%d] listProjectOpenstackSubnetPoolsOK %+v", 200, o.Payload) +} + +func (o *ListProjectOpenstackSubnetPoolsOK) GetPayload() []*models.OpenstackSubnetPool { + return o.Payload +} + +func (o *ListProjectOpenstackSubnetPoolsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListProjectOpenstackSubnetPoolsDefault creates a ListProjectOpenstackSubnetPoolsDefault with default headers values +func NewListProjectOpenstackSubnetPoolsDefault(code int) *ListProjectOpenstackSubnetPoolsDefault { + return &ListProjectOpenstackSubnetPoolsDefault{ + _statusCode: code, + } +} + +/* +ListProjectOpenstackSubnetPoolsDefault describes a response with status code -1, with default header values. + +errorResponse +*/ +type ListProjectOpenstackSubnetPoolsDefault struct { + _statusCode int + + Payload *models.ErrorResponse +} + +// Code gets the status code for the list project openstack subnet pools default response +func (o *ListProjectOpenstackSubnetPoolsDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this list project openstack subnet pools default response has a 2xx status code +func (o *ListProjectOpenstackSubnetPoolsDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list project openstack subnet pools default response has a 3xx status code +func (o *ListProjectOpenstackSubnetPoolsDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list project openstack subnet pools default response has a 4xx status code +func (o *ListProjectOpenstackSubnetPoolsDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list project openstack subnet pools default response has a 5xx status code +func (o *ListProjectOpenstackSubnetPoolsDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list project openstack subnet pools default response a status code equal to that given +func (o *ListProjectOpenstackSubnetPoolsDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *ListProjectOpenstackSubnetPoolsDefault) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/subnetpools][%d] listProjectOpenstackSubnetPools default %+v", o._statusCode, o.Payload) +} + +func (o *ListProjectOpenstackSubnetPoolsDefault) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/subnetpools][%d] listProjectOpenstackSubnetPools default %+v", o._statusCode, o.Payload) +} + +func (o *ListProjectOpenstackSubnetPoolsDefault) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *ListProjectOpenstackSubnetPoolsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_subnets_parameters.go b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_subnets_parameters.go new file mode 100644 index 0000000000..31dc03501d --- /dev/null +++ b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_subnets_parameters.go @@ -0,0 +1,444 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package openstack + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewListProjectOpenstackSubnetsParams creates a new ListProjectOpenstackSubnetsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewListProjectOpenstackSubnetsParams() *ListProjectOpenstackSubnetsParams { + return &ListProjectOpenstackSubnetsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListProjectOpenstackSubnetsParamsWithTimeout creates a new ListProjectOpenstackSubnetsParams object +// with the ability to set a timeout on a request. +func NewListProjectOpenstackSubnetsParamsWithTimeout(timeout time.Duration) *ListProjectOpenstackSubnetsParams { + return &ListProjectOpenstackSubnetsParams{ + timeout: timeout, + } +} + +// NewListProjectOpenstackSubnetsParamsWithContext creates a new ListProjectOpenstackSubnetsParams object +// with the ability to set a context for a request. +func NewListProjectOpenstackSubnetsParamsWithContext(ctx context.Context) *ListProjectOpenstackSubnetsParams { + return &ListProjectOpenstackSubnetsParams{ + Context: ctx, + } +} + +// NewListProjectOpenstackSubnetsParamsWithHTTPClient creates a new ListProjectOpenstackSubnetsParams object +// with the ability to set a custom HTTPClient for a request. +func NewListProjectOpenstackSubnetsParamsWithHTTPClient(client *http.Client) *ListProjectOpenstackSubnetsParams { + return &ListProjectOpenstackSubnetsParams{ + HTTPClient: client, + } +} + +/* +ListProjectOpenstackSubnetsParams contains all the parameters to send to the API endpoint + + for the list project openstack subnets operation. + + Typically these are written to a http.Request. +*/ +type ListProjectOpenstackSubnetsParams struct { + + // ApplicationCredentialID. + ApplicationCredentialID *string + + // ApplicationCredentialSecret. + ApplicationCredentialSecret *string + + // Credential. + Credential *string + + // DatacenterName. + DatacenterName *string + + // Domain. + Domain *string + + // OIDCAuthentication. + OIDCAuthentication *bool + + // OpenstackProject. + OpenstackProject *string + + // OpenstackProjectID. + OpenstackProjectID *string + + // OpenstackTenant. + OpenstackTenant *string + + // OpenstackTenantID. + OpenstackTenantID *string + + // Password. + Password *string + + // Username. + Username *string + + // NetworkID. + NetworkID *string + + // ProjectID. + ProjectID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list project openstack subnets params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListProjectOpenstackSubnetsParams) WithDefaults() *ListProjectOpenstackSubnetsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list project openstack subnets params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListProjectOpenstackSubnetsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) WithTimeout(timeout time.Duration) *ListProjectOpenstackSubnetsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) WithContext(ctx context.Context) *ListProjectOpenstackSubnetsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) WithHTTPClient(client *http.Client) *ListProjectOpenstackSubnetsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationCredentialID adds the applicationCredentialID to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) WithApplicationCredentialID(applicationCredentialID *string) *ListProjectOpenstackSubnetsParams { + o.SetApplicationCredentialID(applicationCredentialID) + return o +} + +// SetApplicationCredentialID adds the applicationCredentialId to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) SetApplicationCredentialID(applicationCredentialID *string) { + o.ApplicationCredentialID = applicationCredentialID +} + +// WithApplicationCredentialSecret adds the applicationCredentialSecret to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) WithApplicationCredentialSecret(applicationCredentialSecret *string) *ListProjectOpenstackSubnetsParams { + o.SetApplicationCredentialSecret(applicationCredentialSecret) + return o +} + +// SetApplicationCredentialSecret adds the applicationCredentialSecret to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) SetApplicationCredentialSecret(applicationCredentialSecret *string) { + o.ApplicationCredentialSecret = applicationCredentialSecret +} + +// WithCredential adds the credential to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) WithCredential(credential *string) *ListProjectOpenstackSubnetsParams { + o.SetCredential(credential) + return o +} + +// SetCredential adds the credential to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) SetCredential(credential *string) { + o.Credential = credential +} + +// WithDatacenterName adds the datacenterName to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) WithDatacenterName(datacenterName *string) *ListProjectOpenstackSubnetsParams { + o.SetDatacenterName(datacenterName) + return o +} + +// SetDatacenterName adds the datacenterName to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) SetDatacenterName(datacenterName *string) { + o.DatacenterName = datacenterName +} + +// WithDomain adds the domain to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) WithDomain(domain *string) *ListProjectOpenstackSubnetsParams { + o.SetDomain(domain) + return o +} + +// SetDomain adds the domain to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) SetDomain(domain *string) { + o.Domain = domain +} + +// WithOIDCAuthentication adds the oIDCAuthentication to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) WithOIDCAuthentication(oIDCAuthentication *bool) *ListProjectOpenstackSubnetsParams { + o.SetOIDCAuthentication(oIDCAuthentication) + return o +} + +// SetOIDCAuthentication adds the oIdCAuthentication to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) SetOIDCAuthentication(oIDCAuthentication *bool) { + o.OIDCAuthentication = oIDCAuthentication +} + +// WithOpenstackProject adds the openstackProject to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) WithOpenstackProject(openstackProject *string) *ListProjectOpenstackSubnetsParams { + o.SetOpenstackProject(openstackProject) + return o +} + +// SetOpenstackProject adds the openstackProject to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) SetOpenstackProject(openstackProject *string) { + o.OpenstackProject = openstackProject +} + +// WithOpenstackProjectID adds the openstackProjectID to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) WithOpenstackProjectID(openstackProjectID *string) *ListProjectOpenstackSubnetsParams { + o.SetOpenstackProjectID(openstackProjectID) + return o +} + +// SetOpenstackProjectID adds the openstackProjectId to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) SetOpenstackProjectID(openstackProjectID *string) { + o.OpenstackProjectID = openstackProjectID +} + +// WithOpenstackTenant adds the openstackTenant to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) WithOpenstackTenant(openstackTenant *string) *ListProjectOpenstackSubnetsParams { + o.SetOpenstackTenant(openstackTenant) + return o +} + +// SetOpenstackTenant adds the openstackTenant to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) SetOpenstackTenant(openstackTenant *string) { + o.OpenstackTenant = openstackTenant +} + +// WithOpenstackTenantID adds the openstackTenantID to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) WithOpenstackTenantID(openstackTenantID *string) *ListProjectOpenstackSubnetsParams { + o.SetOpenstackTenantID(openstackTenantID) + return o +} + +// SetOpenstackTenantID adds the openstackTenantId to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) SetOpenstackTenantID(openstackTenantID *string) { + o.OpenstackTenantID = openstackTenantID +} + +// WithPassword adds the password to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) WithPassword(password *string) *ListProjectOpenstackSubnetsParams { + o.SetPassword(password) + return o +} + +// SetPassword adds the password to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) SetPassword(password *string) { + o.Password = password +} + +// WithUsername adds the username to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) WithUsername(username *string) *ListProjectOpenstackSubnetsParams { + o.SetUsername(username) + return o +} + +// SetUsername adds the username to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) SetUsername(username *string) { + o.Username = username +} + +// WithNetworkID adds the networkID to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) WithNetworkID(networkID *string) *ListProjectOpenstackSubnetsParams { + o.SetNetworkID(networkID) + return o +} + +// SetNetworkID adds the networkId to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) SetNetworkID(networkID *string) { + o.NetworkID = networkID +} + +// WithProjectID adds the projectID to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) WithProjectID(projectID string) *ListProjectOpenstackSubnetsParams { + o.SetProjectID(projectID) + return o +} + +// SetProjectID adds the projectId to the list project openstack subnets params +func (o *ListProjectOpenstackSubnetsParams) SetProjectID(projectID string) { + o.ProjectID = projectID +} + +// WriteToRequest writes these params to a swagger request +func (o *ListProjectOpenstackSubnetsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ApplicationCredentialID != nil { + + // header param ApplicationCredentialID + if err := r.SetHeaderParam("ApplicationCredentialID", *o.ApplicationCredentialID); err != nil { + return err + } + } + + if o.ApplicationCredentialSecret != nil { + + // header param ApplicationCredentialSecret + if err := r.SetHeaderParam("ApplicationCredentialSecret", *o.ApplicationCredentialSecret); err != nil { + return err + } + } + + if o.Credential != nil { + + // header param Credential + if err := r.SetHeaderParam("Credential", *o.Credential); err != nil { + return err + } + } + + if o.DatacenterName != nil { + + // header param DatacenterName + if err := r.SetHeaderParam("DatacenterName", *o.DatacenterName); err != nil { + return err + } + } + + if o.Domain != nil { + + // header param Domain + if err := r.SetHeaderParam("Domain", *o.Domain); err != nil { + return err + } + } + + if o.OIDCAuthentication != nil { + + // header param OIDCAuthentication + if err := r.SetHeaderParam("OIDCAuthentication", swag.FormatBool(*o.OIDCAuthentication)); err != nil { + return err + } + } + + if o.OpenstackProject != nil { + + // header param OpenstackProject + if err := r.SetHeaderParam("OpenstackProject", *o.OpenstackProject); err != nil { + return err + } + } + + if o.OpenstackProjectID != nil { + + // header param OpenstackProjectID + if err := r.SetHeaderParam("OpenstackProjectID", *o.OpenstackProjectID); err != nil { + return err + } + } + + if o.OpenstackTenant != nil { + + // header param OpenstackTenant + if err := r.SetHeaderParam("OpenstackTenant", *o.OpenstackTenant); err != nil { + return err + } + } + + if o.OpenstackTenantID != nil { + + // header param OpenstackTenantID + if err := r.SetHeaderParam("OpenstackTenantID", *o.OpenstackTenantID); err != nil { + return err + } + } + + if o.Password != nil { + + // header param Password + if err := r.SetHeaderParam("Password", *o.Password); err != nil { + return err + } + } + + if o.Username != nil { + + // header param Username + if err := r.SetHeaderParam("Username", *o.Username); err != nil { + return err + } + } + + if o.NetworkID != nil { + + // query param network_id + var qrNetworkID string + + if o.NetworkID != nil { + qrNetworkID = *o.NetworkID + } + qNetworkID := qrNetworkID + if qNetworkID != "" { + + if err := r.SetQueryParam("network_id", qNetworkID); err != nil { + return err + } + } + } + + // path param project_id + if err := r.SetPathParam("project_id", o.ProjectID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_subnets_responses.go b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_subnets_responses.go new file mode 100644 index 0000000000..53a23790b8 --- /dev/null +++ b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_subnets_responses.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package openstack + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "k8c.io/dashboard/v2/pkg/test/e2e/utils/apiclient/models" +) + +// ListProjectOpenstackSubnetsReader is a Reader for the ListProjectOpenstackSubnets structure. +type ListProjectOpenstackSubnetsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListProjectOpenstackSubnetsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListProjectOpenstackSubnetsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListProjectOpenstackSubnetsDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewListProjectOpenstackSubnetsOK creates a ListProjectOpenstackSubnetsOK with default headers values +func NewListProjectOpenstackSubnetsOK() *ListProjectOpenstackSubnetsOK { + return &ListProjectOpenstackSubnetsOK{} +} + +/* +ListProjectOpenstackSubnetsOK describes a response with status code 200, with default header values. + +OpenstackSubnet +*/ +type ListProjectOpenstackSubnetsOK struct { + Payload []*models.OpenstackSubnet +} + +// IsSuccess returns true when this list project openstack subnets o k response has a 2xx status code +func (o *ListProjectOpenstackSubnetsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list project openstack subnets o k response has a 3xx status code +func (o *ListProjectOpenstackSubnetsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list project openstack subnets o k response has a 4xx status code +func (o *ListProjectOpenstackSubnetsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list project openstack subnets o k response has a 5xx status code +func (o *ListProjectOpenstackSubnetsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list project openstack subnets o k response a status code equal to that given +func (o *ListProjectOpenstackSubnetsOK) IsCode(code int) bool { + return code == 200 +} + +func (o *ListProjectOpenstackSubnetsOK) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/subnets][%d] listProjectOpenstackSubnetsOK %+v", 200, o.Payload) +} + +func (o *ListProjectOpenstackSubnetsOK) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/subnets][%d] listProjectOpenstackSubnetsOK %+v", 200, o.Payload) +} + +func (o *ListProjectOpenstackSubnetsOK) GetPayload() []*models.OpenstackSubnet { + return o.Payload +} + +func (o *ListProjectOpenstackSubnetsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListProjectOpenstackSubnetsDefault creates a ListProjectOpenstackSubnetsDefault with default headers values +func NewListProjectOpenstackSubnetsDefault(code int) *ListProjectOpenstackSubnetsDefault { + return &ListProjectOpenstackSubnetsDefault{ + _statusCode: code, + } +} + +/* +ListProjectOpenstackSubnetsDefault describes a response with status code -1, with default header values. + +errorResponse +*/ +type ListProjectOpenstackSubnetsDefault struct { + _statusCode int + + Payload *models.ErrorResponse +} + +// Code gets the status code for the list project openstack subnets default response +func (o *ListProjectOpenstackSubnetsDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this list project openstack subnets default response has a 2xx status code +func (o *ListProjectOpenstackSubnetsDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list project openstack subnets default response has a 3xx status code +func (o *ListProjectOpenstackSubnetsDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list project openstack subnets default response has a 4xx status code +func (o *ListProjectOpenstackSubnetsDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list project openstack subnets default response has a 5xx status code +func (o *ListProjectOpenstackSubnetsDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list project openstack subnets default response a status code equal to that given +func (o *ListProjectOpenstackSubnetsDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *ListProjectOpenstackSubnetsDefault) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/subnets][%d] listProjectOpenstackSubnets default %+v", o._statusCode, o.Payload) +} + +func (o *ListProjectOpenstackSubnetsDefault) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/subnets][%d] listProjectOpenstackSubnets default %+v", o._statusCode, o.Payload) +} + +func (o *ListProjectOpenstackSubnetsDefault) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *ListProjectOpenstackSubnetsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_tenants_parameters.go b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_tenants_parameters.go new file mode 100644 index 0000000000..6cf622379a --- /dev/null +++ b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_tenants_parameters.go @@ -0,0 +1,325 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package openstack + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewListProjectOpenstackTenantsParams creates a new ListProjectOpenstackTenantsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewListProjectOpenstackTenantsParams() *ListProjectOpenstackTenantsParams { + return &ListProjectOpenstackTenantsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListProjectOpenstackTenantsParamsWithTimeout creates a new ListProjectOpenstackTenantsParams object +// with the ability to set a timeout on a request. +func NewListProjectOpenstackTenantsParamsWithTimeout(timeout time.Duration) *ListProjectOpenstackTenantsParams { + return &ListProjectOpenstackTenantsParams{ + timeout: timeout, + } +} + +// NewListProjectOpenstackTenantsParamsWithContext creates a new ListProjectOpenstackTenantsParams object +// with the ability to set a context for a request. +func NewListProjectOpenstackTenantsParamsWithContext(ctx context.Context) *ListProjectOpenstackTenantsParams { + return &ListProjectOpenstackTenantsParams{ + Context: ctx, + } +} + +// NewListProjectOpenstackTenantsParamsWithHTTPClient creates a new ListProjectOpenstackTenantsParams object +// with the ability to set a custom HTTPClient for a request. +func NewListProjectOpenstackTenantsParamsWithHTTPClient(client *http.Client) *ListProjectOpenstackTenantsParams { + return &ListProjectOpenstackTenantsParams{ + HTTPClient: client, + } +} + +/* +ListProjectOpenstackTenantsParams contains all the parameters to send to the API endpoint + + for the list project openstack tenants operation. + + Typically these are written to a http.Request. +*/ +type ListProjectOpenstackTenantsParams struct { + + // ApplicationCredentialID. + ApplicationCredentialID *string + + // ApplicationCredentialSecret. + ApplicationCredentialSecret *string + + // Credential. + Credential *string + + // DatacenterName. + DatacenterName *string + + // Domain. + Domain *string + + // OIDCAuthentication. + OIDCAuthentication *bool + + // Password. + Password *string + + // Username. + Username *string + + // ProjectID. + ProjectID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list project openstack tenants params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListProjectOpenstackTenantsParams) WithDefaults() *ListProjectOpenstackTenantsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list project openstack tenants params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListProjectOpenstackTenantsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) WithTimeout(timeout time.Duration) *ListProjectOpenstackTenantsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) WithContext(ctx context.Context) *ListProjectOpenstackTenantsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) WithHTTPClient(client *http.Client) *ListProjectOpenstackTenantsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationCredentialID adds the applicationCredentialID to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) WithApplicationCredentialID(applicationCredentialID *string) *ListProjectOpenstackTenantsParams { + o.SetApplicationCredentialID(applicationCredentialID) + return o +} + +// SetApplicationCredentialID adds the applicationCredentialId to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) SetApplicationCredentialID(applicationCredentialID *string) { + o.ApplicationCredentialID = applicationCredentialID +} + +// WithApplicationCredentialSecret adds the applicationCredentialSecret to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) WithApplicationCredentialSecret(applicationCredentialSecret *string) *ListProjectOpenstackTenantsParams { + o.SetApplicationCredentialSecret(applicationCredentialSecret) + return o +} + +// SetApplicationCredentialSecret adds the applicationCredentialSecret to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) SetApplicationCredentialSecret(applicationCredentialSecret *string) { + o.ApplicationCredentialSecret = applicationCredentialSecret +} + +// WithCredential adds the credential to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) WithCredential(credential *string) *ListProjectOpenstackTenantsParams { + o.SetCredential(credential) + return o +} + +// SetCredential adds the credential to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) SetCredential(credential *string) { + o.Credential = credential +} + +// WithDatacenterName adds the datacenterName to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) WithDatacenterName(datacenterName *string) *ListProjectOpenstackTenantsParams { + o.SetDatacenterName(datacenterName) + return o +} + +// SetDatacenterName adds the datacenterName to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) SetDatacenterName(datacenterName *string) { + o.DatacenterName = datacenterName +} + +// WithDomain adds the domain to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) WithDomain(domain *string) *ListProjectOpenstackTenantsParams { + o.SetDomain(domain) + return o +} + +// SetDomain adds the domain to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) SetDomain(domain *string) { + o.Domain = domain +} + +// WithOIDCAuthentication adds the oIDCAuthentication to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) WithOIDCAuthentication(oIDCAuthentication *bool) *ListProjectOpenstackTenantsParams { + o.SetOIDCAuthentication(oIDCAuthentication) + return o +} + +// SetOIDCAuthentication adds the oIdCAuthentication to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) SetOIDCAuthentication(oIDCAuthentication *bool) { + o.OIDCAuthentication = oIDCAuthentication +} + +// WithPassword adds the password to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) WithPassword(password *string) *ListProjectOpenstackTenantsParams { + o.SetPassword(password) + return o +} + +// SetPassword adds the password to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) SetPassword(password *string) { + o.Password = password +} + +// WithUsername adds the username to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) WithUsername(username *string) *ListProjectOpenstackTenantsParams { + o.SetUsername(username) + return o +} + +// SetUsername adds the username to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) SetUsername(username *string) { + o.Username = username +} + +// WithProjectID adds the projectID to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) WithProjectID(projectID string) *ListProjectOpenstackTenantsParams { + o.SetProjectID(projectID) + return o +} + +// SetProjectID adds the projectId to the list project openstack tenants params +func (o *ListProjectOpenstackTenantsParams) SetProjectID(projectID string) { + o.ProjectID = projectID +} + +// WriteToRequest writes these params to a swagger request +func (o *ListProjectOpenstackTenantsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ApplicationCredentialID != nil { + + // header param ApplicationCredentialID + if err := r.SetHeaderParam("ApplicationCredentialID", *o.ApplicationCredentialID); err != nil { + return err + } + } + + if o.ApplicationCredentialSecret != nil { + + // header param ApplicationCredentialSecret + if err := r.SetHeaderParam("ApplicationCredentialSecret", *o.ApplicationCredentialSecret); err != nil { + return err + } + } + + if o.Credential != nil { + + // header param Credential + if err := r.SetHeaderParam("Credential", *o.Credential); err != nil { + return err + } + } + + if o.DatacenterName != nil { + + // header param DatacenterName + if err := r.SetHeaderParam("DatacenterName", *o.DatacenterName); err != nil { + return err + } + } + + if o.Domain != nil { + + // header param Domain + if err := r.SetHeaderParam("Domain", *o.Domain); err != nil { + return err + } + } + + if o.OIDCAuthentication != nil { + + // header param OIDCAuthentication + if err := r.SetHeaderParam("OIDCAuthentication", swag.FormatBool(*o.OIDCAuthentication)); err != nil { + return err + } + } + + if o.Password != nil { + + // header param Password + if err := r.SetHeaderParam("Password", *o.Password); err != nil { + return err + } + } + + if o.Username != nil { + + // header param Username + if err := r.SetHeaderParam("Username", *o.Username); err != nil { + return err + } + } + + // path param project_id + if err := r.SetPathParam("project_id", o.ProjectID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_tenants_responses.go b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_tenants_responses.go new file mode 100644 index 0000000000..ba850a5dd4 --- /dev/null +++ b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/list_project_openstack_tenants_responses.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package openstack + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "k8c.io/dashboard/v2/pkg/test/e2e/utils/apiclient/models" +) + +// ListProjectOpenstackTenantsReader is a Reader for the ListProjectOpenstackTenants structure. +type ListProjectOpenstackTenantsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListProjectOpenstackTenantsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListProjectOpenstackTenantsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListProjectOpenstackTenantsDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewListProjectOpenstackTenantsOK creates a ListProjectOpenstackTenantsOK with default headers values +func NewListProjectOpenstackTenantsOK() *ListProjectOpenstackTenantsOK { + return &ListProjectOpenstackTenantsOK{} +} + +/* +ListProjectOpenstackTenantsOK describes a response with status code 200, with default header values. + +OpenstackTenant +*/ +type ListProjectOpenstackTenantsOK struct { + Payload []*models.OpenstackTenant +} + +// IsSuccess returns true when this list project openstack tenants o k response has a 2xx status code +func (o *ListProjectOpenstackTenantsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list project openstack tenants o k response has a 3xx status code +func (o *ListProjectOpenstackTenantsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list project openstack tenants o k response has a 4xx status code +func (o *ListProjectOpenstackTenantsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list project openstack tenants o k response has a 5xx status code +func (o *ListProjectOpenstackTenantsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list project openstack tenants o k response a status code equal to that given +func (o *ListProjectOpenstackTenantsOK) IsCode(code int) bool { + return code == 200 +} + +func (o *ListProjectOpenstackTenantsOK) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/tenants][%d] listProjectOpenstackTenantsOK %+v", 200, o.Payload) +} + +func (o *ListProjectOpenstackTenantsOK) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/tenants][%d] listProjectOpenstackTenantsOK %+v", 200, o.Payload) +} + +func (o *ListProjectOpenstackTenantsOK) GetPayload() []*models.OpenstackTenant { + return o.Payload +} + +func (o *ListProjectOpenstackTenantsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListProjectOpenstackTenantsDefault creates a ListProjectOpenstackTenantsDefault with default headers values +func NewListProjectOpenstackTenantsDefault(code int) *ListProjectOpenstackTenantsDefault { + return &ListProjectOpenstackTenantsDefault{ + _statusCode: code, + } +} + +/* +ListProjectOpenstackTenantsDefault describes a response with status code -1, with default header values. + +errorResponse +*/ +type ListProjectOpenstackTenantsDefault struct { + _statusCode int + + Payload *models.ErrorResponse +} + +// Code gets the status code for the list project openstack tenants default response +func (o *ListProjectOpenstackTenantsDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this list project openstack tenants default response has a 2xx status code +func (o *ListProjectOpenstackTenantsDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list project openstack tenants default response has a 3xx status code +func (o *ListProjectOpenstackTenantsDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list project openstack tenants default response has a 4xx status code +func (o *ListProjectOpenstackTenantsDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list project openstack tenants default response has a 5xx status code +func (o *ListProjectOpenstackTenantsDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list project openstack tenants default response a status code equal to that given +func (o *ListProjectOpenstackTenantsDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *ListProjectOpenstackTenantsDefault) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/tenants][%d] listProjectOpenstackTenants default %+v", o._statusCode, o.Payload) +} + +func (o *ListProjectOpenstackTenantsDefault) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/providers/openstack/tenants][%d] listProjectOpenstackTenants default %+v", o._statusCode, o.Payload) +} + +func (o *ListProjectOpenstackTenantsDefault) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *ListProjectOpenstackTenantsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/openstack_client.go b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/openstack_client.go index e5d0133c17..1346cfc0f1 100644 --- a/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/openstack_client.go +++ b/modules/api/pkg/test/e2e/utils/apiclient/client/openstack/openstack_client.go @@ -70,6 +70,22 @@ type ClientService interface { ListOpenstackTenantsNoCredentialsV2(params *ListOpenstackTenantsNoCredentialsV2Params, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOpenstackTenantsNoCredentialsV2OK, error) + ListProjectOpenstackAvailabilityZones(params *ListProjectOpenstackAvailabilityZonesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListProjectOpenstackAvailabilityZonesOK, error) + + ListProjectOpenstackNetworks(params *ListProjectOpenstackNetworksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListProjectOpenstackNetworksOK, error) + + ListProjectOpenstackSecurityGroups(params *ListProjectOpenstackSecurityGroupsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListProjectOpenstackSecurityGroupsOK, error) + + ListProjectOpenstackServerGroups(params *ListProjectOpenstackServerGroupsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListProjectOpenstackServerGroupsOK, error) + + ListProjectOpenstackSizes(params *ListProjectOpenstackSizesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListProjectOpenstackSizesOK, error) + + ListProjectOpenstackSubnetPools(params *ListProjectOpenstackSubnetPoolsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListProjectOpenstackSubnetPoolsOK, error) + + ListProjectOpenstackSubnets(params *ListProjectOpenstackSubnetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListProjectOpenstackSubnetsOK, error) + + ListProjectOpenstackTenants(params *ListProjectOpenstackTenantsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListProjectOpenstackTenantsOK, error) + SetTransport(transport runtime.ClientTransport) } @@ -871,6 +887,310 @@ func (a *Client) ListOpenstackTenantsNoCredentialsV2(params *ListOpenstackTenant return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +ListProjectOpenstackAvailabilityZones Lists availability zones from openstack +*/ +func (a *Client) ListProjectOpenstackAvailabilityZones(params *ListProjectOpenstackAvailabilityZonesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListProjectOpenstackAvailabilityZonesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListProjectOpenstackAvailabilityZonesParams() + } + op := &runtime.ClientOperation{ + ID: "listProjectOpenstackAvailabilityZones", + Method: "GET", + PathPattern: "/api/v2/projects/{project_id}/providers/openstack/availabilityzones", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ListProjectOpenstackAvailabilityZonesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListProjectOpenstackAvailabilityZonesOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListProjectOpenstackAvailabilityZonesDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ListProjectOpenstackNetworks Lists networks from openstack +*/ +func (a *Client) ListProjectOpenstackNetworks(params *ListProjectOpenstackNetworksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListProjectOpenstackNetworksOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListProjectOpenstackNetworksParams() + } + op := &runtime.ClientOperation{ + ID: "listProjectOpenstackNetworks", + Method: "GET", + PathPattern: "/api/v2/projects/{project_id}/providers/openstack/networks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ListProjectOpenstackNetworksReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListProjectOpenstackNetworksOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListProjectOpenstackNetworksDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ListProjectOpenstackSecurityGroups Lists security groups from openstack +*/ +func (a *Client) ListProjectOpenstackSecurityGroups(params *ListProjectOpenstackSecurityGroupsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListProjectOpenstackSecurityGroupsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListProjectOpenstackSecurityGroupsParams() + } + op := &runtime.ClientOperation{ + ID: "listProjectOpenstackSecurityGroups", + Method: "GET", + PathPattern: "/api/v2/projects/{project_id}/providers/openstack/securitygroups", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ListProjectOpenstackSecurityGroupsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListProjectOpenstackSecurityGroupsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListProjectOpenstackSecurityGroupsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ListProjectOpenstackServerGroups Lists server groups from openstack +*/ +func (a *Client) ListProjectOpenstackServerGroups(params *ListProjectOpenstackServerGroupsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListProjectOpenstackServerGroupsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListProjectOpenstackServerGroupsParams() + } + op := &runtime.ClientOperation{ + ID: "listProjectOpenstackServerGroups", + Method: "GET", + PathPattern: "/api/v2/projects/{project_id}/providers/openstack/servergroups", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ListProjectOpenstackServerGroupsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListProjectOpenstackServerGroupsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListProjectOpenstackServerGroupsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ListProjectOpenstackSizes Lists sizes from openstack +*/ +func (a *Client) ListProjectOpenstackSizes(params *ListProjectOpenstackSizesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListProjectOpenstackSizesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListProjectOpenstackSizesParams() + } + op := &runtime.ClientOperation{ + ID: "listProjectOpenstackSizes", + Method: "GET", + PathPattern: "/api/v2/projects/{project_id}/providers/openstack/sizes", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ListProjectOpenstackSizesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListProjectOpenstackSizesOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListProjectOpenstackSizesDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ListProjectOpenstackSubnetPools Lists subnet pools from openstack +*/ +func (a *Client) ListProjectOpenstackSubnetPools(params *ListProjectOpenstackSubnetPoolsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListProjectOpenstackSubnetPoolsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListProjectOpenstackSubnetPoolsParams() + } + op := &runtime.ClientOperation{ + ID: "listProjectOpenstackSubnetPools", + Method: "GET", + PathPattern: "/api/v2/projects/{project_id}/providers/openstack/subnetpools", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ListProjectOpenstackSubnetPoolsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListProjectOpenstackSubnetPoolsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListProjectOpenstackSubnetPoolsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ListProjectOpenstackSubnets Lists subnets from openstack +*/ +func (a *Client) ListProjectOpenstackSubnets(params *ListProjectOpenstackSubnetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListProjectOpenstackSubnetsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListProjectOpenstackSubnetsParams() + } + op := &runtime.ClientOperation{ + ID: "listProjectOpenstackSubnets", + Method: "GET", + PathPattern: "/api/v2/projects/{project_id}/providers/openstack/subnets", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ListProjectOpenstackSubnetsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListProjectOpenstackSubnetsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListProjectOpenstackSubnetsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ListProjectOpenstackTenants Lists tenants from openstack +*/ +func (a *Client) ListProjectOpenstackTenants(params *ListProjectOpenstackTenantsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListProjectOpenstackTenantsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListProjectOpenstackTenantsParams() + } + op := &runtime.ClientOperation{ + ID: "listProjectOpenstackTenants", + Method: "GET", + PathPattern: "/api/v2/projects/{project_id}/providers/openstack/tenants", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ListProjectOpenstackTenantsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListProjectOpenstackTenantsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListProjectOpenstackTenantsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + // SetTransport changes the transport on the client func (a *Client) SetTransport(transport runtime.ClientTransport) { a.transport = transport