diff --git a/Makefile b/Makefile index aeb365f..e1b793b 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,9 @@ REVISION := $(shell git rev-parse HEAD) CONTROLLERS = \ unikorn-region-controller \ unikorn-identity-controller \ - unikorn-physical-network-controller + unikorn-physical-network-controller \ + unikorn-security-group-controller \ + unikorn-security-group-rule-controller # Release will do cross compliation of all images for the 'all' target. # Note we aren't fucking about with docker here because that opens up a diff --git a/charts/region/crds/region.unikorn-cloud.org_openstacksecuritygrouprules.yaml b/charts/region/crds/region.unikorn-cloud.org_openstacksecuritygrouprules.yaml new file mode 100644 index 0000000..eca670b --- /dev/null +++ b/charts/region/crds/region.unikorn-cloud.org_openstacksecuritygrouprules.yaml @@ -0,0 +1,59 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.16.1 + name: openstacksecuritygrouprules.region.unikorn-cloud.org +spec: + group: region.unikorn-cloud.org + names: + categories: + - unikorn + kind: OpenstackSecurityGroupRule + listKind: OpenstackSecurityGroupRuleList + plural: openstacksecuritygrouprules + singular: openstacksecuritygrouprule + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + description: OpenstackSecurityGroupRule has no controller, its a database + record of state. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + properties: + securityGroupRuleID: + description: SecurityGroupRuleID is the security group rule ID. + type: string + type: object + status: + type: object + required: + - spec + type: object + served: true + storage: true + subresources: {} diff --git a/charts/region/crds/region.unikorn-cloud.org_openstacksecuritygroups.yaml b/charts/region/crds/region.unikorn-cloud.org_openstacksecuritygroups.yaml new file mode 100644 index 0000000..e30ec03 --- /dev/null +++ b/charts/region/crds/region.unikorn-cloud.org_openstacksecuritygroups.yaml @@ -0,0 +1,59 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.16.1 + name: openstacksecuritygroups.region.unikorn-cloud.org +spec: + group: region.unikorn-cloud.org + names: + categories: + - unikorn + kind: OpenstackSecurityGroup + listKind: OpenstackSecurityGroupList + plural: openstacksecuritygroups + singular: openstacksecuritygroup + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + description: OpenstackSecurityGroup has no controller, its a database record + of state. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + properties: + securityGroupID: + description: SecurityGroupID is the security group ID. + type: string + type: object + status: + type: object + required: + - spec + type: object + served: true + storage: true + subresources: {} diff --git a/charts/region/crds/region.unikorn-cloud.org_securitygrouprules.yaml b/charts/region/crds/region.unikorn-cloud.org_securitygrouprules.yaml new file mode 100644 index 0000000..c849903 --- /dev/null +++ b/charts/region/crds/region.unikorn-cloud.org_securitygrouprules.yaml @@ -0,0 +1,156 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.16.1 + name: securitygrouprules.region.unikorn-cloud.org +spec: + group: region.unikorn-cloud.org + names: + categories: + - unikorn + kind: SecurityGroupRule + listKind: SecurityGroupRuleList + plural: securitygrouprules + singular: securitygrouprule + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=="Available")].reason + name: status + type: string + - jsonPath: .metadata.creationTimestamp + name: age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + description: SecurityGroupRule defines a security group rule beloning to a + security group. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + properties: + cidr: + description: CIDR is the CIDR block to allow traffic from. + pattern: ^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\/(?:3[0-2]|[1-2]?[0-9])$ + type: string + direction: + description: Direction is the direction of the rule. + enum: + - ingress + - egress + type: string + pause: + description: Pause, if true, will inhibit reconciliation. + type: boolean + port: + description: Port is the port or range of ports. + properties: + number: + description: Number is the port number. + type: integer + range: + description: Range is the port range. + properties: + end: + description: End is the end of the range. + maximum: 65535 + type: integer + start: + description: Start is the start of the range. + minimum: 1 + type: integer + required: + - end + - start + type: object + type: object + x-kubernetes-validations: + - message: at least one of number or range must be defined + rule: (has(self.number) || has(self.range)) + protocol: + description: Protocol is the protocol of the rule. + enum: + - tcp + - udp + type: string + required: + - cidr + - direction + - port + - protocol + type: object + status: + properties: + conditions: + description: Current service state of a security group rule. + items: + description: |- + Condition is a generic condition type for use across all resource types. + It's generic so that the underlying controller-manager functionality can + be shared across all resources. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. + format: date-time + type: string + message: + description: Human-readable message indicating details about + last transition. + type: string + reason: + description: Unique, one-word, CamelCase reason for the condition's + last transition. + enum: + - Provisioning + - Provisioned + - Cancelled + - Errored + - Deprovisioning + - Deprovisioned + type: string + status: + description: |- + Status is the status of the condition. + Can be True, False, Unknown. + type: string + type: + description: Type is the type of the condition. + enum: + - Available + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} diff --git a/charts/region/crds/region.unikorn-cloud.org_securitygroups.yaml b/charts/region/crds/region.unikorn-cloud.org_securitygroups.yaml new file mode 100644 index 0000000..492c743 --- /dev/null +++ b/charts/region/crds/region.unikorn-cloud.org_securitygroups.yaml @@ -0,0 +1,134 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.16.1 + name: securitygroups.region.unikorn-cloud.org +spec: + group: region.unikorn-cloud.org + names: + categories: + - unikorn + kind: SecurityGroup + listKind: SecurityGroupList + plural: securitygroups + singular: securitygroup + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=="Available")].reason + name: status + type: string + - jsonPath: .metadata.creationTimestamp + name: age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + description: SecurityGroup defines a security group beloning to an identity. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + properties: + pause: + description: Pause, if true, will inhibit reconciliation. + type: boolean + provider: + description: Provider defines the provider type. + enum: + - openstack + type: string + tags: + description: |- + Tags are an abitrary list of key/value pairs that a client + may populate to store metadata for the resource. + items: + description: Tag is an arbirary key/value. + properties: + name: + description: Name of the tag. + type: string + value: + description: Value of the tag. + type: string + required: + - name + - value + type: object + type: array + required: + - provider + type: object + status: + properties: + conditions: + description: Current service state of a security group. + items: + description: |- + Condition is a generic condition type for use across all resource types. + It's generic so that the underlying controller-manager functionality can + be shared across all resources. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. + format: date-time + type: string + message: + description: Human-readable message indicating details about + last transition. + type: string + reason: + description: Unique, one-word, CamelCase reason for the condition's + last transition. + enum: + - Provisioning + - Provisioned + - Cancelled + - Errored + - Deprovisioning + - Deprovisioned + type: string + status: + description: |- + Status is the status of the condition. + Can be True, False, Unknown. + type: string + type: + description: Type is the type of the condition. + enum: + - Available + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} diff --git a/charts/region/templates/_helpers.tpl b/charts/region/templates/_helpers.tpl index 3a9e961..bae55e7 100644 --- a/charts/region/templates/_helpers.tpl +++ b/charts/region/templates/_helpers.tpl @@ -13,6 +13,14 @@ Create the container images {{- .Values.physicalNetworkController.image | default (printf "%s/unikorn-physical-network-controller:%s" (include "unikorn.defaultRepositoryPath" .) (.Values.tag | default .Chart.Version)) }} {{- end }} +{{- define "unikorn.securityGroupControllerImage" -}} +{{- .Values.securityGroupController.image | default (printf "%s/unikorn-security-group-controller:%s" (include "unikorn.defaultRepositoryPath" .) (.Values.tag | default .Chart.Version)) }} +{{- end }} + +{{- define "unikorn.securityGroupRuleControllerImage" -}} +{{- .Values.securityGroupRuleController.image | default (printf "%s/unikorn-security-group-rule-controller:%s" (include "unikorn.defaultRepositoryPath" .) (.Values.tag | default .Chart.Version)) }} +{{- end }} + {{/* Create image pull secrets */}} diff --git a/charts/region/templates/identity-controller/clusterrole.yaml b/charts/region/templates/identity-controller/clusterrole.yaml index 65b7fb1..9987ccf 100644 --- a/charts/region/templates/identity-controller/clusterrole.yaml +++ b/charts/region/templates/identity-controller/clusterrole.yaml @@ -37,6 +37,7 @@ rules: resources: - quotas - physicalnetworks + - securitygroups verbs: - list - watch diff --git a/charts/region/templates/region-controller/clusterrole.yaml b/charts/region/templates/region-controller/clusterrole.yaml index f91d9b1..1625ca1 100644 --- a/charts/region/templates/region-controller/clusterrole.yaml +++ b/charts/region/templates/region-controller/clusterrole.yaml @@ -19,6 +19,8 @@ rules: - identities - physicalnetworks - quotas + - securitygroups + - securitygrouprules verbs: - list - watch @@ -31,6 +33,8 @@ rules: resources: - openstackidentities - openstackphysicalnetworks + - openstacksecuritygroups + - openstacksecuritygrouprules verbs: - list - watch diff --git a/charts/region/templates/security-group-controller/clusterrole.yaml b/charts/region/templates/security-group-controller/clusterrole.yaml new file mode 100644 index 0000000..29066b0 --- /dev/null +++ b/charts/region/templates/security-group-controller/clusterrole.yaml @@ -0,0 +1,63 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: unikorn-security-group-controller + labels: + {{- include "unikorn.labels" . | nindent 4 }} +rules: +# Orchestrate Unikorn resources (my job). +- apiGroups: + - region.unikorn-cloud.org + resources: + - identities + - openstackidentities + verbs: + - list + - watch +- apiGroups: + - region.unikorn-cloud.org + resources: + - securitygroups + verbs: + - list + - watch + - update + - patch +- apiGroups: + - region.unikorn-cloud.org + resources: + - securitygroups/status + verbs: + - update +- apiGroups: + - region.unikorn-cloud.org + resources: + - openstacksecuritygroups + verbs: + - list + - watch + - create + - update + - delete +- apiGroups: + - region.unikorn-cloud.org + resources: + - securitygrouprules + verbs: + - list + - watch + - delete +- apiGroups: + - "" + resources: + - secrets + verbs: + - list + - watch +- apiGroups: + - region.unikorn-cloud.org + resources: + - regions + verbs: + - list + - watch diff --git a/charts/region/templates/security-group-controller/clusterrolebinding.yaml b/charts/region/templates/security-group-controller/clusterrolebinding.yaml new file mode 100644 index 0000000..a35b2b5 --- /dev/null +++ b/charts/region/templates/security-group-controller/clusterrolebinding.yaml @@ -0,0 +1,14 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: unikorn-security-group-controller + labels: + {{- include "unikorn.labels" . | nindent 4 }} +subjects: +- kind: ServiceAccount + namespace: {{ .Release.Namespace }} + name: unikorn-security-group-controller +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: unikorn-security-group-controller diff --git a/charts/region/templates/security-group-controller/deployment.yaml b/charts/region/templates/security-group-controller/deployment.yaml new file mode 100644 index 0000000..f030579 --- /dev/null +++ b/charts/region/templates/security-group-controller/deployment.yaml @@ -0,0 +1,41 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: unikorn-security-group-controller + labels: + {{- include "unikorn.labels" . | nindent 4 }} +spec: + replicas: 1 + selector: + matchLabels: + app: unikorn-security-group-controller + template: + metadata: + labels: + app: unikorn-security-group-controller + spec: + containers: + - name: unikorn-security-group-controller + image: {{ include "unikorn.securityGroupControllerImage" . }} + args: + {{- include "unikorn.core.flags" . | nindent 8 }} + {{- include "unikorn.otlp.flags" . | nindent 8 }} + ports: + - name: http + containerPort: 6080 + - name: prometheus + containerPort: 8080 + - name: pprof + containerPort: 6060 + resources: + requests: + cpu: "50m" + memory: 50Mi + limits: + cpu: "100m" + memory: 100Mi + securityContext: + readOnlyRootFilesystem: true + serviceAccountName: unikorn-security-group-controller + securityContext: + runAsNonRoot: true diff --git a/charts/region/templates/security-group-controller/role.yaml b/charts/region/templates/security-group-controller/role.yaml new file mode 100644 index 0000000..fbdec62 --- /dev/null +++ b/charts/region/templates/security-group-controller/role.yaml @@ -0,0 +1,23 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: unikorn-security-group-controller + labels: + {{- include "unikorn.labels" . | nindent 4 }} +rules: +# Controller prerequisites. +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - create + - get + - update +- apiGroups: + - "" + resources: + - events + verbs: + - create + - update diff --git a/charts/region/templates/security-group-controller/rolebinding.yaml b/charts/region/templates/security-group-controller/rolebinding.yaml new file mode 100644 index 0000000..387bf9d --- /dev/null +++ b/charts/region/templates/security-group-controller/rolebinding.yaml @@ -0,0 +1,14 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: unikorn-security-group-controller + labels: + {{- include "unikorn.labels" . | nindent 4 }} +subjects: +- kind: ServiceAccount + namespace: {{ .Release.Namespace }} + name: unikorn-security-group-controller +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: unikorn-security-group-controller diff --git a/charts/region/templates/security-group-controller/serviceaccount.yaml b/charts/region/templates/security-group-controller/serviceaccount.yaml new file mode 100644 index 0000000..a2718e7 --- /dev/null +++ b/charts/region/templates/security-group-controller/serviceaccount.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: unikorn-security-group-controller + labels: + {{- include "unikorn.labels" . | nindent 4 }} +{{- with ( include "unikorn.imagePullSecrets" . ) }} +imagePullSecrets: +{{ . }} +{{- end }} diff --git a/charts/region/templates/security-group-rule-controller/clusterrole.yaml b/charts/region/templates/security-group-rule-controller/clusterrole.yaml new file mode 100644 index 0000000..9a87e19 --- /dev/null +++ b/charts/region/templates/security-group-rule-controller/clusterrole.yaml @@ -0,0 +1,57 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: unikorn-security-group-rule-controller + labels: + {{- include "unikorn.labels" . | nindent 4 }} +rules: +# Orchestrate Unikorn resources (my job). +- apiGroups: + - region.unikorn-cloud.org + resources: + - identities + - openstackidentities + - securitygroups + - openstacksecuritygroups + verbs: + - list + - watch +- apiGroups: + - region.unikorn-cloud.org + resources: + - securitygrouprules + verbs: + - list + - watch + - update + - patch +- apiGroups: + - region.unikorn-cloud.org + resources: + - securitygrouprules/status + verbs: + - update +- apiGroups: + - region.unikorn-cloud.org + resources: + - openstacksecuritygrouprules + verbs: + - list + - watch + - create + - update + - delete +- apiGroups: + - "" + resources: + - secrets + verbs: + - list + - watch +- apiGroups: + - region.unikorn-cloud.org + resources: + - regions + verbs: + - list + - watch diff --git a/charts/region/templates/security-group-rule-controller/clusterrolebinding.yaml b/charts/region/templates/security-group-rule-controller/clusterrolebinding.yaml new file mode 100644 index 0000000..666d7c3 --- /dev/null +++ b/charts/region/templates/security-group-rule-controller/clusterrolebinding.yaml @@ -0,0 +1,14 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: unikorn-security-group-rule-controller + labels: + {{- include "unikorn.labels" . | nindent 4 }} +subjects: +- kind: ServiceAccount + namespace: {{ .Release.Namespace }} + name: unikorn-security-group-rule-controller +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: unikorn-security-group-rule-controller diff --git a/charts/region/templates/security-group-rule-controller/deployment.yaml b/charts/region/templates/security-group-rule-controller/deployment.yaml new file mode 100644 index 0000000..65aab77 --- /dev/null +++ b/charts/region/templates/security-group-rule-controller/deployment.yaml @@ -0,0 +1,41 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: unikorn-security-group-rule-controller + labels: + {{- include "unikorn.labels" . | nindent 4 }} +spec: + replicas: 1 + selector: + matchLabels: + app: unikorn-security-group-rule-controller + template: + metadata: + labels: + app: unikorn-security-group-rule-controller + spec: + containers: + - name: unikorn-security-group-rule-controller + image: {{ include "unikorn.securityGroupRuleControllerImage" . }} + args: + {{- include "unikorn.core.flags" . | nindent 8 }} + {{- include "unikorn.otlp.flags" . | nindent 8 }} + ports: + - name: http + containerPort: 6080 + - name: prometheus + containerPort: 8080 + - name: pprof + containerPort: 6060 + resources: + requests: + cpu: "50m" + memory: 50Mi + limits: + cpu: "100m" + memory: 100Mi + securityContext: + readOnlyRootFilesystem: true + serviceAccountName: unikorn-security-group-rule-controller + securityContext: + runAsNonRoot: true diff --git a/charts/region/templates/security-group-rule-controller/role.yaml b/charts/region/templates/security-group-rule-controller/role.yaml new file mode 100644 index 0000000..cf262d4 --- /dev/null +++ b/charts/region/templates/security-group-rule-controller/role.yaml @@ -0,0 +1,23 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: unikorn-security-group-rule-controller + labels: + {{- include "unikorn.labels" . | nindent 4 }} +rules: +# Controller prerequisites. +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - create + - get + - update +- apiGroups: + - "" + resources: + - events + verbs: + - create + - update diff --git a/charts/region/templates/security-group-rule-controller/rolebinding.yaml b/charts/region/templates/security-group-rule-controller/rolebinding.yaml new file mode 100644 index 0000000..ee4e6f8 --- /dev/null +++ b/charts/region/templates/security-group-rule-controller/rolebinding.yaml @@ -0,0 +1,14 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: unikorn-security-group-rule-controller + labels: + {{- include "unikorn.labels" . | nindent 4 }} +subjects: +- kind: ServiceAccount + namespace: {{ .Release.Namespace }} + name: unikorn-security-group-rule-controller +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: unikorn-security-group-rule-controller diff --git a/charts/region/templates/security-group-rule-controller/serviceaccount.yaml b/charts/region/templates/security-group-rule-controller/serviceaccount.yaml new file mode 100644 index 0000000..dfea428 --- /dev/null +++ b/charts/region/templates/security-group-rule-controller/serviceaccount.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: unikorn-security-group-rule-controller + labels: + {{- include "unikorn.labels" . | nindent 4 }} +{{- with ( include "unikorn.imagePullSecrets" . ) }} +imagePullSecrets: +{{ . }} +{{- end }} diff --git a/charts/region/values.yaml b/charts/region/values.yaml index 918afcc..3edaf42 100644 --- a/charts/region/values.yaml +++ b/charts/region/values.yaml @@ -104,12 +104,20 @@ organization: unikorn-cloud # Identity controller configuration. identityController: - # Allow override of the identity controller image. - image: + # Allow override of the controller image. + image: ~ physicalNetworkController: - # Allow override of the identity controller image. - image: + # Allow override of the controller image. + image: ~ + +securityGroupController: + # Allow override of the controller image. + image: ~ + +securityGroupRuleController: + # Allow override of the controller image. + image: ~ # Sets the DNS hosts/X.509 Certs. region: diff --git a/cmd/unikorn-security-group-controller/main.go b/cmd/unikorn-security-group-controller/main.go new file mode 100644 index 0000000..72860b0 --- /dev/null +++ b/cmd/unikorn-security-group-controller/main.go @@ -0,0 +1,26 @@ +/* +Copyright 2024 the Unikorn Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "github.com/unikorn-cloud/core/pkg/manager" + securitygroup "github.com/unikorn-cloud/region/pkg/managers/security-group" +) + +func main() { + manager.Run(&securitygroup.Factory{}) +} diff --git a/cmd/unikorn-security-group-rule-controller/main.go b/cmd/unikorn-security-group-rule-controller/main.go new file mode 100644 index 0000000..8baf166 --- /dev/null +++ b/cmd/unikorn-security-group-rule-controller/main.go @@ -0,0 +1,26 @@ +/* +Copyright 2024 the Unikorn Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "github.com/unikorn-cloud/core/pkg/manager" + securitygrouprule "github.com/unikorn-cloud/region/pkg/managers/security-group-rule" +) + +func main() { + manager.Run(&securitygrouprule.Factory{}) +} diff --git a/docker/unikorn-security-group-controller/.dockerignore b/docker/unikorn-security-group-controller/.dockerignore new file mode 100644 index 0000000..83d9b90 --- /dev/null +++ b/docker/unikorn-security-group-controller/.dockerignore @@ -0,0 +1,2 @@ +* +!bin/*-linux-gnu/unikorn-security-group-controller diff --git a/docker/unikorn-security-group-controller/Dockerfile b/docker/unikorn-security-group-controller/Dockerfile new file mode 100644 index 0000000..d5bcfdc --- /dev/null +++ b/docker/unikorn-security-group-controller/Dockerfile @@ -0,0 +1,8 @@ +FROM gcr.io/distroless/static:nonroot + +# This is implcitly created by 'docker buildx build' +ARG TARGETARCH + +COPY bin/${TARGETARCH}-linux-gnu/unikorn-security-group-controller / + +ENTRYPOINT ["/unikorn-security-group-controller"] diff --git a/docker/unikorn-security-group-rule-controller/.dockerignore b/docker/unikorn-security-group-rule-controller/.dockerignore new file mode 100644 index 0000000..93d7c1d --- /dev/null +++ b/docker/unikorn-security-group-rule-controller/.dockerignore @@ -0,0 +1,2 @@ +* +!bin/*-linux-gnu/unikorn-security-group-rule-controller diff --git a/docker/unikorn-security-group-rule-controller/Dockerfile b/docker/unikorn-security-group-rule-controller/Dockerfile new file mode 100644 index 0000000..24eb181 --- /dev/null +++ b/docker/unikorn-security-group-rule-controller/Dockerfile @@ -0,0 +1,8 @@ +FROM gcr.io/distroless/static:nonroot + +# This is implcitly created by 'docker buildx build' +ARG TARGETARCH + +COPY bin/${TARGETARCH}-linux-gnu/unikorn-security-group-rule-controller / + +ENTRYPOINT ["/unikorn-security-group-rule-controller"] diff --git a/pkg/apis/unikorn/v1alpha1/helpers.go b/pkg/apis/unikorn/v1alpha1/helpers.go index f0b528b..c2f8eb2 100644 --- a/pkg/apis/unikorn/v1alpha1/helpers.go +++ b/pkg/apis/unikorn/v1alpha1/helpers.go @@ -70,3 +70,51 @@ func (c *PhysicalNetwork) StatusConditionWrite(t unikornv1core.ConditionType, st func (c *PhysicalNetwork) ResourceLabels() (labels.Set, error) { return nil, nil } + +// Paused implements the ReconcilePauser interface. +func (c *SecurityGroup) Paused() bool { + return c.Spec.Pause +} + +// StatusConditionRead scans the status conditions for an existing condition whose type +// matches. +func (c *SecurityGroup) StatusConditionRead(t unikornv1core.ConditionType) (*unikornv1core.Condition, error) { + return unikornv1core.GetCondition(c.Status.Conditions, t) +} + +// StatusConditionWrite either adds or updates a condition in the cluster manager status. +// If the condition, status and message match an existing condition the update is +// ignored. +func (c *SecurityGroup) StatusConditionWrite(t unikornv1core.ConditionType, status corev1.ConditionStatus, reason unikornv1core.ConditionReason, message string) { + unikornv1core.UpdateCondition(&c.Status.Conditions, t, status, reason, message) +} + +// ResourceLabels generates a set of labels to uniquely identify the resource +// if it were to be placed in a single global namespace. +func (c *SecurityGroup) ResourceLabels() (labels.Set, error) { + return nil, nil +} + +// Paused implements the ReconcilePauser interface. +func (c *SecurityGroupRule) Paused() bool { + return c.Spec.Pause +} + +// StatusConditionRead scans the status conditions for an existing condition whose type +// matches. +func (c *SecurityGroupRule) StatusConditionRead(t unikornv1core.ConditionType) (*unikornv1core.Condition, error) { + return unikornv1core.GetCondition(c.Status.Conditions, t) +} + +// StatusConditionWrite either adds or updates a condition in the cluster manager status. +// If the condition, status and message match an existing condition the update is +// ignored. +func (c *SecurityGroupRule) StatusConditionWrite(t unikornv1core.ConditionType, status corev1.ConditionStatus, reason unikornv1core.ConditionReason, message string) { + unikornv1core.UpdateCondition(&c.Status.Conditions, t, status, reason, message) +} + +// ResourceLabels generates a set of labels to uniquely identify the resource +// if it were to be placed in a single global namespace. +func (c *SecurityGroupRule) ResourceLabels() (labels.Set, error) { + return nil, nil +} diff --git a/pkg/apis/unikorn/v1alpha1/register.go b/pkg/apis/unikorn/v1alpha1/register.go index 5406aee..f630441 100644 --- a/pkg/apis/unikorn/v1alpha1/register.go +++ b/pkg/apis/unikorn/v1alpha1/register.go @@ -55,6 +55,10 @@ func init() { SchemeBuilder.Register(&OpenstackIdentity{}, &OpenstackIdentityList{}) SchemeBuilder.Register(&OpenstackPhysicalNetwork{}, &OpenstackPhysicalNetworkList{}) SchemeBuilder.Register(&VLANAllocation{}, &VLANAllocationList{}) + SchemeBuilder.Register(&SecurityGroup{}, &SecurityGroupList{}) + SchemeBuilder.Register(&OpenstackSecurityGroup{}, &OpenstackSecurityGroupList{}) + SchemeBuilder.Register(&SecurityGroupRule{}, &SecurityGroupRuleList{}) + SchemeBuilder.Register(&OpenstackSecurityGroupRule{}, &OpenstackSecurityGroupRuleList{}) } // Resource maps a resource type to a group resource. diff --git a/pkg/apis/unikorn/v1alpha1/types.go b/pkg/apis/unikorn/v1alpha1/types.go index d68d40a..c212b9d 100644 --- a/pkg/apis/unikorn/v1alpha1/types.go +++ b/pkg/apis/unikorn/v1alpha1/types.go @@ -517,3 +517,166 @@ type FlavorQuota struct { type QuotaStatus struct { } + +// SecurityGroupList is a typed list of security groups. +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type SecurityGroupList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []SecurityGroup `json:"items"` +} + +// SecurityGroup defines a security group beloning to an identity. +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:resource:scope=Namespaced,categories=unikorn +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="status",type="string",JSONPath=".status.conditions[?(@.type==\"Available\")].reason" +// +kubebuilder:printcolumn:name="age",type="date",JSONPath=".metadata.creationTimestamp" +type SecurityGroup struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec SecurityGroupSpec `json:"spec"` + Status SecurityGroupStatus `json:"status,omitempty"` +} + +type SecurityGroupSpec struct { + // Pause, if true, will inhibit reconciliation. + Pause bool `json:"pause,omitempty"` + // Tags are an abitrary list of key/value pairs that a client + // may populate to store metadata for the resource. + Tags TagList `json:"tags,omitempty"` + // Provider defines the provider type. + Provider Provider `json:"provider"` +} + +type SecurityGroupStatus struct { + // Current service state of a security group. + Conditions []unikornv1core.Condition `json:"conditions,omitempty"` +} + +// OpenstackSecurityGroupList is a typed list of security groups. +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type OpenstackSecurityGroupList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []OpenstackSecurityGroup `json:"items"` +} + +// OpenstackSecurityGroup has no controller, its a database record of state. +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:resource:scope=Namespaced,categories=unikorn +// +kubebuilder:printcolumn:name="age",type="date",JSONPath=".metadata.creationTimestamp" +type OpenstackSecurityGroup struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec OpenstackSecurityGroupSpec `json:"spec"` + Status OpenstackSecurityGroupStatus `json:"status,omitempty"` +} + +type OpenstackSecurityGroupSpec struct { + // SecurityGroupID is the security group ID. + SecurityGroupID *string `json:"securityGroupID,omitempty"` +} + +type OpenstackSecurityGroupStatus struct { +} + +// SecurityGroupRuleList is a typed list of security group rules. +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type SecurityGroupRuleList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []SecurityGroupRule `json:"items"` +} + +// SecurityGroupRule defines a security group rule beloning to a security group. +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:resource:scope=Namespaced,categories=unikorn +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="status",type="string",JSONPath=".status.conditions[?(@.type==\"Available\")].reason" +// +kubebuilder:printcolumn:name="age",type="date",JSONPath=".metadata.creationTimestamp" +type SecurityGroupRule struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec SecurityGroupRuleSpec `json:"spec"` + Status SecurityGroupRuleStatus `json:"status,omitempty"` +} + +type SecurityGroupRuleSpec struct { + // Pause, if true, will inhibit reconciliation. + Pause bool `json:"pause,omitempty"` + // Direction is the direction of the rule. + Direction *SecurityGroupRuleDirection `json:"direction"` + // Protocol is the protocol of the rule. + Protocol *SecurityGroupRuleProtocol `json:"protocol"` + // Port is the port or range of ports. + Port *SecurityGroupRulePort `json:"port"` + // CIDR is the CIDR block to allow traffic from. + CIDR *unikornv1core.IPv4Prefix `json:"cidr"` +} + +type SecurityGroupRuleStatus struct { + // Current service state of a security group rule. + Conditions []unikornv1core.Condition `json:"conditions,omitempty"` +} + +// +kubebuilder:validation:Enum=tcp;udp +type SecurityGroupRuleProtocol string + +// +kubebuilder:validation:Enum=ingress;egress +type SecurityGroupRuleDirection string + +const ( + TCP SecurityGroupRuleProtocol = "tcp" + UDP SecurityGroupRuleProtocol = "udp" + Ingress SecurityGroupRuleDirection = "ingress" + Egress SecurityGroupRuleDirection = "egress" +) + +type SecurityGroupRulePortRange struct { + // Start is the start of the range. + // +kubebuilder:validation:Minimum=1 + Start int `json:"start"` + // End is the end of the range. + // +kubebuilder:validation:Maximum=65535 + End int `json:"end"` +} + +// +kubebuilder:validation:XValidation:message="at least one of number or range must be defined",rule=(has(self.number) || has(self.range)) +type SecurityGroupRulePort struct { + // Number is the port number. + Number *int `json:"number,omitempty"` + // Range is the port range. + Range *SecurityGroupRulePortRange `json:"range,omitempty"` +} + +// OpenstackSecurityGroupRuleList is a typed list of security groups. +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type OpenstackSecurityGroupRuleList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []OpenstackSecurityGroupRule `json:"items"` +} + +// OpenstackSecurityGroupRule has no controller, its a database record of state. +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:resource:scope=Namespaced,categories=unikorn +// +kubebuilder:printcolumn:name="age",type="date",JSONPath=".metadata.creationTimestamp" +type OpenstackSecurityGroupRule struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec OpenstackSecurityGroupRuleSpec `json:"spec"` + Status OpenstackSecurityGroupRuleStatus `json:"status,omitempty"` +} + +type OpenstackSecurityGroupRuleSpec struct { + // SecurityGroupRuleID is the security group rule ID. + SecurityGroupRuleID *string `json:"securityGroupRuleID,omitempty"` +} + +type OpenstackSecurityGroupRuleStatus struct { +} diff --git a/pkg/apis/unikorn/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/unikorn/v1alpha1/zz_generated.deepcopy.go index 8aefec4..0713b15 100644 --- a/pkg/apis/unikorn/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/unikorn/v1alpha1/zz_generated.deepcopy.go @@ -619,6 +619,202 @@ func (in *OpenstackPhysicalNetworkStatus) DeepCopy() *OpenstackPhysicalNetworkSt return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OpenstackSecurityGroup) DeepCopyInto(out *OpenstackSecurityGroup) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenstackSecurityGroup. +func (in *OpenstackSecurityGroup) DeepCopy() *OpenstackSecurityGroup { + if in == nil { + return nil + } + out := new(OpenstackSecurityGroup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OpenstackSecurityGroup) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OpenstackSecurityGroupList) DeepCopyInto(out *OpenstackSecurityGroupList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OpenstackSecurityGroup, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenstackSecurityGroupList. +func (in *OpenstackSecurityGroupList) DeepCopy() *OpenstackSecurityGroupList { + if in == nil { + return nil + } + out := new(OpenstackSecurityGroupList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OpenstackSecurityGroupList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OpenstackSecurityGroupRule) DeepCopyInto(out *OpenstackSecurityGroupRule) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenstackSecurityGroupRule. +func (in *OpenstackSecurityGroupRule) DeepCopy() *OpenstackSecurityGroupRule { + if in == nil { + return nil + } + out := new(OpenstackSecurityGroupRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OpenstackSecurityGroupRule) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OpenstackSecurityGroupRuleList) DeepCopyInto(out *OpenstackSecurityGroupRuleList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OpenstackSecurityGroupRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenstackSecurityGroupRuleList. +func (in *OpenstackSecurityGroupRuleList) DeepCopy() *OpenstackSecurityGroupRuleList { + if in == nil { + return nil + } + out := new(OpenstackSecurityGroupRuleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OpenstackSecurityGroupRuleList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OpenstackSecurityGroupRuleSpec) DeepCopyInto(out *OpenstackSecurityGroupRuleSpec) { + *out = *in + if in.SecurityGroupRuleID != nil { + in, out := &in.SecurityGroupRuleID, &out.SecurityGroupRuleID + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenstackSecurityGroupRuleSpec. +func (in *OpenstackSecurityGroupRuleSpec) DeepCopy() *OpenstackSecurityGroupRuleSpec { + if in == nil { + return nil + } + out := new(OpenstackSecurityGroupRuleSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OpenstackSecurityGroupRuleStatus) DeepCopyInto(out *OpenstackSecurityGroupRuleStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenstackSecurityGroupRuleStatus. +func (in *OpenstackSecurityGroupRuleStatus) DeepCopy() *OpenstackSecurityGroupRuleStatus { + if in == nil { + return nil + } + out := new(OpenstackSecurityGroupRuleStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OpenstackSecurityGroupSpec) DeepCopyInto(out *OpenstackSecurityGroupSpec) { + *out = *in + if in.SecurityGroupID != nil { + in, out := &in.SecurityGroupID, &out.SecurityGroupID + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenstackSecurityGroupSpec. +func (in *OpenstackSecurityGroupSpec) DeepCopy() *OpenstackSecurityGroupSpec { + if in == nil { + return nil + } + out := new(OpenstackSecurityGroupSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OpenstackSecurityGroupStatus) DeepCopyInto(out *OpenstackSecurityGroupStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenstackSecurityGroupStatus. +func (in *OpenstackSecurityGroupStatus) DeepCopy() *OpenstackSecurityGroupStatus { + if in == nil { + return nil + } + out := new(OpenstackSecurityGroupStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PhysicalNetwork) DeepCopyInto(out *PhysicalNetwork) { *out = *in @@ -1099,6 +1295,272 @@ func (in *RegionStatus) DeepCopy() *RegionStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecurityGroup) DeepCopyInto(out *SecurityGroup) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityGroup. +func (in *SecurityGroup) DeepCopy() *SecurityGroup { + if in == nil { + return nil + } + out := new(SecurityGroup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SecurityGroup) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecurityGroupList) DeepCopyInto(out *SecurityGroupList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]SecurityGroup, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityGroupList. +func (in *SecurityGroupList) DeepCopy() *SecurityGroupList { + if in == nil { + return nil + } + out := new(SecurityGroupList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SecurityGroupList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecurityGroupRule) DeepCopyInto(out *SecurityGroupRule) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityGroupRule. +func (in *SecurityGroupRule) DeepCopy() *SecurityGroupRule { + if in == nil { + return nil + } + out := new(SecurityGroupRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SecurityGroupRule) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecurityGroupRuleList) DeepCopyInto(out *SecurityGroupRuleList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]SecurityGroupRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityGroupRuleList. +func (in *SecurityGroupRuleList) DeepCopy() *SecurityGroupRuleList { + if in == nil { + return nil + } + out := new(SecurityGroupRuleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SecurityGroupRuleList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecurityGroupRulePort) DeepCopyInto(out *SecurityGroupRulePort) { + *out = *in + if in.Number != nil { + in, out := &in.Number, &out.Number + *out = new(int) + **out = **in + } + if in.Range != nil { + in, out := &in.Range, &out.Range + *out = new(SecurityGroupRulePortRange) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityGroupRulePort. +func (in *SecurityGroupRulePort) DeepCopy() *SecurityGroupRulePort { + if in == nil { + return nil + } + out := new(SecurityGroupRulePort) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecurityGroupRulePortRange) DeepCopyInto(out *SecurityGroupRulePortRange) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityGroupRulePortRange. +func (in *SecurityGroupRulePortRange) DeepCopy() *SecurityGroupRulePortRange { + if in == nil { + return nil + } + out := new(SecurityGroupRulePortRange) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecurityGroupRuleSpec) DeepCopyInto(out *SecurityGroupRuleSpec) { + *out = *in + if in.Direction != nil { + in, out := &in.Direction, &out.Direction + *out = new(SecurityGroupRuleDirection) + **out = **in + } + if in.Protocol != nil { + in, out := &in.Protocol, &out.Protocol + *out = new(SecurityGroupRuleProtocol) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(SecurityGroupRulePort) + (*in).DeepCopyInto(*out) + } + if in.CIDR != nil { + in, out := &in.CIDR, &out.CIDR + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityGroupRuleSpec. +func (in *SecurityGroupRuleSpec) DeepCopy() *SecurityGroupRuleSpec { + if in == nil { + return nil + } + out := new(SecurityGroupRuleSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecurityGroupRuleStatus) DeepCopyInto(out *SecurityGroupRuleStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]unikornv1alpha1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityGroupRuleStatus. +func (in *SecurityGroupRuleStatus) DeepCopy() *SecurityGroupRuleStatus { + if in == nil { + return nil + } + out := new(SecurityGroupRuleStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecurityGroupSpec) DeepCopyInto(out *SecurityGroupSpec) { + *out = *in + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(TagList, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityGroupSpec. +func (in *SecurityGroupSpec) DeepCopy() *SecurityGroupSpec { + if in == nil { + return nil + } + out := new(SecurityGroupSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecurityGroupStatus) DeepCopyInto(out *SecurityGroupStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]unikornv1alpha1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityGroupStatus. +func (in *SecurityGroupStatus) DeepCopy() *SecurityGroupStatus { + if in == nil { + return nil + } + out := new(SecurityGroupStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Tag) DeepCopyInto(out *Tag) { *out = *in diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go index 5101d74..d5187a6 100644 --- a/pkg/constants/constants.go +++ b/pkg/constants/constants.go @@ -54,4 +54,7 @@ const ( // PhysicalNetworkLabel creates an indexable linkage between resources // and an owning entity. PhysicalNetworkLabel = "regions.unikorn-cloud.org/phyiscal-network-id" + // SecurityGroupLabel creates an indexable linkage between resources + // and an owning entity. + SecurityGroupLabel = "regions.unikorn-cloud.org/security-group-id" ) diff --git a/pkg/handler/handler.go b/pkg/handler/handler.go index 7ef42b9..8c41784 100644 --- a/pkg/handler/handler.go +++ b/pkg/handler/handler.go @@ -919,3 +919,512 @@ func (h *Handler) GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetw h.setCacheable(w) util.WriteJSONResponse(w, r, http.StatusOK, convertExternalNetworks(result)) } + +func (h *Handler) convertSecurityGroup(in *unikornv1.SecurityGroup) *openapi.SecurityGroupRead { + provisioningStatus := coreapi.ResourceProvisioningStatusUnknown + + if condition, err := in.StatusConditionRead(unikornv1core.ConditionAvailable); err == nil { + provisioningStatus = conversion.ConvertStatusCondition(condition) + } + + out := &openapi.SecurityGroupRead{ + Metadata: conversion.ProjectScopedResourceReadMetadata(in, provisioningStatus), + Spec: openapi.SecurityGroupReadSpec{ + RegionId: in.Labels[constants.RegionLabel], + }, + } + + if tags := convertTags(in.Spec.Tags); tags != nil { + out.Spec.Tags = &tags + } + + return out +} + +func (h *Handler) convertSecurityGroupList(in *unikornv1.SecurityGroupList) *openapi.SecurityGroupsRead { + out := make(openapi.SecurityGroupsRead, len(in.Items)) + + for i := range in.Items { + out[i] = *h.convertSecurityGroup(&in.Items[i]) + } + + return &out +} + +func (h *Handler) getSecurityGroup(ctx context.Context, id string) (*unikornv1.SecurityGroup, error) { + resource := &unikornv1.SecurityGroup{} + + if err := h.client.Get(ctx, client.ObjectKey{Namespace: h.namespace, Name: id}, resource); err != nil { + if kerrors.IsNotFound(err) { + return nil, errors.HTTPNotFound().WithError(err) + } + + return nil, errors.OAuth2ServerError("unable to get security group").WithError(err) + } + + return resource, nil +} + +func (h *Handler) getSecurityGroupList(ctx context.Context, organizationID string) (*unikornv1.SecurityGroupList, error) { + result := &unikornv1.SecurityGroupList{} + + options := &client.ListOptions{ + LabelSelector: labels.SelectorFromSet(map[string]string{ + coreconstants.OrganizationLabel: organizationID, + }), + } + + if err := h.client.List(ctx, result, options); err != nil { + return nil, errors.OAuth2ServerError("unable to list security groups").WithError(err) + } + + slices.SortStableFunc(result.Items, func(a, b unikornv1.SecurityGroup) int { + return cmp.Compare(a.Name, b.Name) + }) + + return result, nil +} + +func (h *Handler) generateSecurityGroup(ctx context.Context, organizationID, projectID string, identity *unikornv1.Identity, in *openapi.SecurityGroupWrite) (*unikornv1.SecurityGroup, error) { + userinfo, err := authorization.UserinfoFromContext(ctx) + if err != nil { + return nil, errors.OAuth2ServerError("unable to get userinfo").WithError(err) + } + + resource := &unikornv1.SecurityGroup{ + ObjectMeta: conversion.NewObjectMetadata(&in.Metadata, h.namespace, userinfo.Sub).WithOrganization(organizationID).WithProject(projectID).WithLabel(constants.RegionLabel, identity.Labels[constants.RegionLabel]). + WithLabel(constants.IdentityLabel, identity.Name).Get(), + Spec: unikornv1.SecurityGroupSpec{ + Provider: identity.Spec.Provider, + }, + } + + if in.Spec != nil { + resource.Spec.Tags = generateTagList(in.Spec.Tags) + } + + // Ensure the security is owned by the identity so it is automatically cleaned + // up on identity deletion. + if err := controllerutil.SetOwnerReference(identity, resource, h.client.Scheme()); err != nil { + return nil, err + } + + return resource, nil +} + +// (GET /api/v1/organizations/{organizationID}/securitygroups) +func (h *Handler) GetApiV1OrganizationsOrganizationIDSecuritygroups(w http.ResponseWriter, r *http.Request, organizationID openapi.OrganizationIDParameter) { + if err := rbac.AllowOrganizationScope(r.Context(), "securitygroups", identityapi.Read, organizationID); err != nil { + errors.HandleError(w, r, err) + return + } + + result, err := h.getSecurityGroupList(r.Context(), organizationID) + if err != nil { + errors.HandleError(w, r, err) + return + } + + util.WriteJSONResponse(w, r, http.StatusOK, h.convertSecurityGroupList(result)) +} + +// (POST /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups) +func (h *Handler) PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroups(w http.ResponseWriter, r *http.Request, organizationID openapi.OrganizationIDParameter, + projectID openapi.ProjectIDParameter, identityID openapi.IdentityIDParameter) { + + if err := rbac.AllowProjectScope(r.Context(), "securitygroups", identityapi.Create, organizationID, projectID); err != nil { + errors.HandleError(w, r, err) + return + } + + request := &openapi.SecurityGroupWrite{} + if err := util.ReadJSONBody(r, request); err != nil { + errors.HandleError(w, r, err) + return + } + + identity, err := h.getIdentity(r.Context(), identityID) + if err != nil { + errors.HandleError(w, r, err) + return + } + + securityGroup, err := h.generateSecurityGroup(r.Context(), organizationID, projectID, identity, request) + if err != nil { + errors.HandleError(w, r, err) + return + } + + if err := h.client.Create(r.Context(), securityGroup); err != nil { + errors.HandleError(w, r, errors.OAuth2ServerError("unable to create security group").WithError(err)) + return + } + + util.WriteJSONResponse(w, r, http.StatusCreated, h.convertSecurityGroup(securityGroup)) +} + +// (DELETE /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}) +func (h *Handler) DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(w http.ResponseWriter, r *http.Request, organizationID openapi.OrganizationIDParameter, + projectID openapi.ProjectIDParameter, identityID openapi.IdentityIDParameter, securityGroupID openapi.SecurityGroupIDParameter) { + + if err := rbac.AllowProjectScope(r.Context(), "securitygroups", identityapi.Delete, organizationID, projectID); err != nil { + errors.HandleError(w, r, err) + return + } + + resource, err := h.getSecurityGroup(r.Context(), securityGroupID) + if err != nil { + errors.HandleError(w, r, err) + return + } + + if err := h.client.Delete(r.Context(), resource); err != nil { + if kerrors.IsNotFound(err) { + errors.HandleError(w, r, errors.HTTPNotFound().WithError(err)) + return + } + + errors.HandleError(w, r, errors.OAuth2ServerError("unable to delete security group").WithError(err)) + return + } + + w.WriteHeader(http.StatusAccepted) +} + +// (GET /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}) +func (h *Handler) GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(w http.ResponseWriter, r *http.Request, organizationID openapi.OrganizationIDParameter, + projectID openapi.ProjectIDParameter, identityID openapi.IdentityIDParameter, securityGroupID openapi.SecurityGroupIDParameter) { + + if err := rbac.AllowProjectScope(r.Context(), "securitygroups", identityapi.Read, organizationID, projectID); err != nil { + errors.HandleError(w, r, err) + return + } + + resource, err := h.getSecurityGroup(r.Context(), securityGroupID) + if err != nil { + errors.HandleError(w, r, err) + return + } + + util.WriteJSONResponse(w, r, http.StatusOK, h.convertSecurityGroup(resource)) +} + +// (PUT /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}) +func (h *Handler) PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(w http.ResponseWriter, r *http.Request, organizationID openapi.OrganizationIDParameter, + projectID openapi.ProjectIDParameter, identityID openapi.IdentityIDParameter, securityGroupID openapi.SecurityGroupIDParameter) { + + if err := rbac.AllowProjectScope(r.Context(), "securitygroups", identityapi.Update, organizationID, projectID); err != nil { + errors.HandleError(w, r, err) + return + } + + request := &openapi.SecurityGroupWrite{} + if err := util.ReadJSONBody(r, request); err != nil { + errors.HandleError(w, r, err) + return + } + + identity, err := h.getIdentity(r.Context(), identityID) + if err != nil { + errors.HandleError(w, r, err) + return + } + + required, err := h.generateSecurityGroup(r.Context(), organizationID, projectID, identity, request) + if err != nil { + errors.HandleError(w, r, err) + return + } + + current, err := h.getSecurityGroup(r.Context(), securityGroupID) + if err != nil { + errors.HandleError(w, r, err) + return + } + + updated := current.DeepCopy() + updated.Labels = required.Labels + updated.Annotations = required.Annotations + updated.Spec = required.Spec + + if err := h.client.Patch(r.Context(), updated, client.MergeFrom(current)); err != nil { + errors.HandleError(w, r, errors.OAuth2ServerError("unable to updated security group").WithError(err)) + return + } + + w.WriteHeader(http.StatusAccepted) + +} + +func convertSecurityGroupRulePort(in unikornv1.SecurityGroupRulePort) openapi.SecurityGroupRulePort { + out := openapi.SecurityGroupRulePort{} + + if in.Number != nil { + out.Number = in.Number + } + + if in.Range != nil { + out.Range = &openapi.SecurityGroupRulePortRange{ + Start: in.Range.Start, + End: in.Range.End, + } + } + + return out +} + +func generateSecurityGroupRulePort(in openapi.SecurityGroupRulePort) *unikornv1.SecurityGroupRulePort { + out := unikornv1.SecurityGroupRulePort{} + + if in.Number != nil { + out.Number = in.Number + } + + if in.Range != nil { + out.Range = &unikornv1.SecurityGroupRulePortRange{ + Start: in.Range.Start, + End: in.Range.End, + } + } + + return &out +} + +func generateSecurityGroupRuleProtocol(in openapi.SecurityGroupRuleWriteSpecProtocol) *unikornv1.SecurityGroupRuleProtocol { + var out unikornv1.SecurityGroupRuleProtocol + + switch in { + case openapi.SecurityGroupRuleWriteSpecProtocolTcp: + out = unikornv1.TCP + case openapi.SecurityGroupRuleWriteSpecProtocolUdp: + out = unikornv1.UDP + } + + return &out +} + +func convertSecurityGroupRuleDirection(in unikornv1.SecurityGroupRuleDirection) openapi.SecurityGroupRuleReadSpecDirection { + switch in { + case unikornv1.Ingress: + return openapi.SecurityGroupRuleReadSpecDirectionIngress + case unikornv1.Egress: + return openapi.SecurityGroupRuleReadSpecDirectionEgress + } + + return "" +} + +func generateSecurityGroupRuleDirection(in openapi.SecurityGroupRuleWriteSpecDirection) *unikornv1.SecurityGroupRuleDirection { + var out unikornv1.SecurityGroupRuleDirection + + switch in { + case openapi.SecurityGroupRuleWriteSpecDirectionIngress: + out = unikornv1.Ingress + case openapi.SecurityGroupRuleWriteSpecDirectionEgress: + out = unikornv1.Egress + } + + return &out +} + +func (h *Handler) convertSecurityGroupRule(in *unikornv1.SecurityGroupRule) *openapi.SecurityGroupRuleRead { + provisioningStatus := coreapi.ResourceProvisioningStatusUnknown + + if condition, err := in.StatusConditionRead(unikornv1core.ConditionAvailable); err == nil { + provisioningStatus = conversion.ConvertStatusCondition(condition) + } + + out := &openapi.SecurityGroupRuleRead{ + Metadata: conversion.ProjectScopedResourceReadMetadata(in, provisioningStatus), + Spec: openapi.SecurityGroupRuleReadSpec{ + Direction: convertSecurityGroupRuleDirection(*in.Spec.Direction), + Protocol: openapi.SecurityGroupRuleReadSpecProtocol(*in.Spec.Protocol), + Cidr: in.Spec.CIDR.String(), + Port: convertSecurityGroupRulePort(*in.Spec.Port), + }, + } + + return out +} + +func (h *Handler) convertSecurityGroupRuleList(in *unikornv1.SecurityGroupRuleList) *openapi.SecurityGroupRulesRead { + out := make(openapi.SecurityGroupRulesRead, len(in.Items)) + + for i := range in.Items { + out[i] = *h.convertSecurityGroupRule(&in.Items[i]) + } + + return &out +} + +func (h *Handler) getSecurityGroupRule(ctx context.Context, id string) (*unikornv1.SecurityGroupRule, error) { + resource := &unikornv1.SecurityGroupRule{} + + if err := h.client.Get(ctx, client.ObjectKey{Namespace: h.namespace, Name: id}, resource); err != nil { + if kerrors.IsNotFound(err) { + return nil, errors.HTTPNotFound().WithError(err) + } + + return nil, errors.OAuth2ServerError("unable to get security group rule").WithError(err) + } + + return resource, nil +} + +func (h *Handler) getSecurityGroupRuleList(ctx context.Context, securityGroupID string) (*unikornv1.SecurityGroupRuleList, error) { + result := &unikornv1.SecurityGroupRuleList{} + + options := &client.ListOptions{ + LabelSelector: labels.SelectorFromSet(map[string]string{ + constants.SecurityGroupLabel: securityGroupID, + }), + } + + if err := h.client.List(ctx, result, options); err != nil { + return nil, errors.OAuth2ServerError("unable to list security group rules").WithError(err) + } + + slices.SortStableFunc(result.Items, func(a, b unikornv1.SecurityGroupRule) int { + return cmp.Compare(a.Name, b.Name) + }) + + return result, nil +} + +func (h *Handler) generateSecurityGroupRule(ctx context.Context, organizationID, projectID string, identity *unikornv1.Identity, securityGroup *unikornv1.SecurityGroup, in *openapi.SecurityGroupRuleWrite) (*unikornv1.SecurityGroupRule, error) { + userinfo, err := authorization.UserinfoFromContext(ctx) + if err != nil { + return nil, errors.OAuth2ServerError("unable to get userinfo").WithError(err) + } + + _, prefix, err := net.ParseCIDR(in.Spec.Cidr) + if err != nil { + return nil, errors.OAuth2InvalidRequest("unable to parse prefix").WithError(err) + } + + resource := &unikornv1.SecurityGroupRule{ + ObjectMeta: conversion.NewObjectMetadata(&in.Metadata, h.namespace, userinfo.Sub).WithOrganization(organizationID).WithProject(projectID).WithLabel(constants.RegionLabel, identity.Labels[constants.RegionLabel]). + WithLabel(constants.IdentityLabel, identity.Name).WithLabel(constants.SecurityGroupLabel, securityGroup.Name).Get(), + Spec: unikornv1.SecurityGroupRuleSpec{ + Direction: generateSecurityGroupRuleDirection(in.Spec.Direction), + Protocol: generateSecurityGroupRuleProtocol(in.Spec.Protocol), + Port: generateSecurityGroupRulePort(in.Spec.Port), + CIDR: &unikornv1core.IPv4Prefix{ + IPNet: *prefix, + }, + }, + } + + // Ensure the security is owned by the security group so it is automatically cleaned + // up on security group deletion. + if err := controllerutil.SetOwnerReference(securityGroup, resource, h.client.Scheme()); err != nil { + return nil, err + } + + return resource, nil +} + +// (GET /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}/rules) +func (h *Handler) GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules(w http.ResponseWriter, r *http.Request, organizationID openapi.OrganizationIDParameter, + projectID openapi.ProjectIDParameter, identityID openapi.IdentityIDParameter, securityGroupID openapi.SecurityGroupIDParameter) { + + if err := rbac.AllowProjectScope(r.Context(), "securitygroups", identityapi.Read, organizationID, projectID); err != nil { + errors.HandleError(w, r, err) + return + } + + result, err := h.getSecurityGroupRuleList(r.Context(), securityGroupID) + if err != nil { + errors.HandleError(w, r, err) + return + } + + util.WriteJSONResponse(w, r, http.StatusOK, h.convertSecurityGroupRuleList(result)) +} + +// (POST /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}/rules) +func (h *Handler) PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules(w http.ResponseWriter, r *http.Request, organizationID openapi.OrganizationIDParameter, + projectID openapi.ProjectIDParameter, identityID openapi.IdentityIDParameter, securityGroupID openapi.SecurityGroupIDParameter) { + + if err := rbac.AllowProjectScope(r.Context(), "securitygroups", identityapi.Create, organizationID, projectID); err != nil { + errors.HandleError(w, r, err) + return + } + + request := &openapi.SecurityGroupRuleWrite{} + if err := util.ReadJSONBody(r, request); err != nil { + errors.HandleError(w, r, err) + return + } + + identity, err := h.getIdentity(r.Context(), identityID) + if err != nil { + errors.HandleError(w, r, err) + return + } + + securityGroup, err := h.getSecurityGroup(r.Context(), securityGroupID) + if err != nil { + errors.HandleError(w, r, err) + return + } + + securityGroupRule, err := h.generateSecurityGroupRule(r.Context(), organizationID, projectID, identity, securityGroup, request) + if err != nil { + errors.HandleError(w, r, err) + return + } + + if err := h.client.Create(r.Context(), securityGroupRule); err != nil { + errors.HandleError(w, r, errors.OAuth2ServerError("unable to create security group rule").WithError(err)) + return + } + + util.WriteJSONResponse(w, r, http.StatusCreated, h.convertSecurityGroupRule(securityGroupRule)) +} + +// (DELETE /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}/rules/{ruleID}) +func (h *Handler) DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID(w http.ResponseWriter, r *http.Request, organizationID openapi.OrganizationIDParameter, + projectID openapi.ProjectIDParameter, identityID openapi.IdentityIDParameter, securityGroupID openapi.SecurityGroupIDParameter, ruleID openapi.RuleIDParameter) { + + if err := rbac.AllowProjectScope(r.Context(), "securitygroups", identityapi.Delete, organizationID, projectID); err != nil { + errors.HandleError(w, r, err) + return + } + + resource, err := h.getSecurityGroupRule(r.Context(), ruleID) + if err != nil { + errors.HandleError(w, r, err) + return + } + + if err := h.client.Delete(r.Context(), resource); err != nil { + if kerrors.IsNotFound(err) { + errors.HandleError(w, r, errors.HTTPNotFound().WithError(err)) + return + } + + errors.HandleError(w, r, errors.OAuth2ServerError("unable to delete security group rule").WithError(err)) + return + } + + w.WriteHeader(http.StatusAccepted) +} + +// (GET /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}/rules/{ruleID}) +func (h *Handler) GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID(w http.ResponseWriter, r *http.Request, organizationID openapi.OrganizationIDParameter, + projectID openapi.ProjectIDParameter, identityID openapi.IdentityIDParameter, securityGroupID openapi.SecurityGroupIDParameter, ruleID openapi.RuleIDParameter) { + + if err := rbac.AllowProjectScope(r.Context(), "securitygroups", identityapi.Read, organizationID, projectID); err != nil { + errors.HandleError(w, r, err) + return + } + + resource, err := h.getSecurityGroupRule(r.Context(), ruleID) + if err != nil { + errors.HandleError(w, r, err) + return + } + + util.WriteJSONResponse(w, r, http.StatusOK, h.convertSecurityGroupRule(resource)) +} diff --git a/pkg/managers/security-group-rule/manager.go b/pkg/managers/security-group-rule/manager.go new file mode 100644 index 0000000..4d8b8db --- /dev/null +++ b/pkg/managers/security-group-rule/manager.go @@ -0,0 +1,79 @@ +/* +Copyright 2024 the Unikorn Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package securitygrouprule + +import ( + coreclient "github.com/unikorn-cloud/core/pkg/client" + coremanager "github.com/unikorn-cloud/core/pkg/manager" + "github.com/unikorn-cloud/core/pkg/manager/options" + unikornv1 "github.com/unikorn-cloud/region/pkg/apis/unikorn/v1alpha1" + "github.com/unikorn-cloud/region/pkg/constants" + securitygrouprule "github.com/unikorn-cloud/region/pkg/provisioners/managers/security-group-rule" + + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/controller" + "sigs.k8s.io/controller-runtime/pkg/handler" + "sigs.k8s.io/controller-runtime/pkg/manager" + "sigs.k8s.io/controller-runtime/pkg/predicate" + "sigs.k8s.io/controller-runtime/pkg/reconcile" + "sigs.k8s.io/controller-runtime/pkg/source" +) + +// Factory provides methods that can build a type specific controller. +type Factory struct{} + +var _ coremanager.ControllerFactory = &Factory{} + +// Metadata returns the application, version and revision. +func (*Factory) Metadata() (string, string, string) { + return constants.Application, constants.Version, constants.Revision +} + +// Options returns any options to be added to the CLI flags and passed to the reconciler. +func (*Factory) Options() coremanager.ControllerOptions { + return nil +} + +// Reconciler returns a new reconciler instance. +func (*Factory) Reconciler(options *options.Options, controllerOptions coremanager.ControllerOptions, manager manager.Manager) reconcile.Reconciler { + return coremanager.NewReconciler(options, controllerOptions, manager, securitygrouprule.New) +} + +// RegisterWatches adds any watches that would trigger a reconcile. +func (*Factory) RegisterWatches(manager manager.Manager, controller controller.Controller) error { + // Any changes to the security group rule spec, trigger a reconcile. + if err := controller.Watch(source.Kind(manager.GetCache(), &unikornv1.SecurityGroupRule{}, &handler.TypedEnqueueRequestForObject[*unikornv1.SecurityGroupRule]{}, &predicate.TypedGenerationChangedPredicate[*unikornv1.SecurityGroupRule]{})); err != nil { + return err + } + + return nil +} + +// Upgrade can perform metadata upgrades of all versioned resources on restart/upgrade +// of the controller. This must not affect the spec in any way as it causes split brain +// and potential fail. +func (*Factory) Upgrade(_ client.Client) error { + return nil +} + +// Schemes allows controllers to add types to the client beyond +// the defaults defined in this repository. +func (*Factory) Schemes() []coreclient.SchemeAdder { + return []coreclient.SchemeAdder{ + unikornv1.AddToScheme, + } +} diff --git a/pkg/managers/security-group/manager.go b/pkg/managers/security-group/manager.go new file mode 100644 index 0000000..a55ed81 --- /dev/null +++ b/pkg/managers/security-group/manager.go @@ -0,0 +1,79 @@ +/* +Copyright 2024 the Unikorn Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package securitygroup + +import ( + coreclient "github.com/unikorn-cloud/core/pkg/client" + coremanager "github.com/unikorn-cloud/core/pkg/manager" + "github.com/unikorn-cloud/core/pkg/manager/options" + unikornv1 "github.com/unikorn-cloud/region/pkg/apis/unikorn/v1alpha1" + "github.com/unikorn-cloud/region/pkg/constants" + securitygroup "github.com/unikorn-cloud/region/pkg/provisioners/managers/security-group" + + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/controller" + "sigs.k8s.io/controller-runtime/pkg/handler" + "sigs.k8s.io/controller-runtime/pkg/manager" + "sigs.k8s.io/controller-runtime/pkg/predicate" + "sigs.k8s.io/controller-runtime/pkg/reconcile" + "sigs.k8s.io/controller-runtime/pkg/source" +) + +// Factory provides methods that can build a type specific controller. +type Factory struct{} + +var _ coremanager.ControllerFactory = &Factory{} + +// Metadata returns the application, version and revision. +func (*Factory) Metadata() (string, string, string) { + return constants.Application, constants.Version, constants.Revision +} + +// Options returns any options to be added to the CLI flags and passed to the reconciler. +func (*Factory) Options() coremanager.ControllerOptions { + return nil +} + +// Reconciler returns a new reconciler instance. +func (*Factory) Reconciler(options *options.Options, controllerOptions coremanager.ControllerOptions, manager manager.Manager) reconcile.Reconciler { + return coremanager.NewReconciler(options, controllerOptions, manager, securitygroup.New) +} + +// RegisterWatches adds any watches that would trigger a reconcile. +func (*Factory) RegisterWatches(manager manager.Manager, controller controller.Controller) error { + // Any changes to the security group spec, trigger a reconcile. + if err := controller.Watch(source.Kind(manager.GetCache(), &unikornv1.SecurityGroup{}, &handler.TypedEnqueueRequestForObject[*unikornv1.SecurityGroup]{}, &predicate.TypedGenerationChangedPredicate[*unikornv1.SecurityGroup]{})); err != nil { + return err + } + + return nil +} + +// Upgrade can perform metadata upgrades of all versioned resources on restart/upgrade +// of the controller. This must not affect the spec in any way as it causes split brain +// and potential fail. +func (*Factory) Upgrade(_ client.Client) error { + return nil +} + +// Schemes allows controllers to add types to the client beyond +// the defaults defined in this repository. +func (*Factory) Schemes() []coreclient.SchemeAdder { + return []coreclient.SchemeAdder{ + unikornv1.AddToScheme, + } +} diff --git a/pkg/openapi/client.go b/pkg/openapi/client.go index e4c6749..5d5fac6 100644 --- a/pkg/openapi/client.go +++ b/pkg/openapi/client.go @@ -126,6 +126,36 @@ type ClientInterface interface { PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotas(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, body PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsWithBody request with any body + PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsWithBody(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroups(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, body PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID request + DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID request + GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDWithBody request with any body + PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDWithBody(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, body PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules request + GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesWithBody request with any body + PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesWithBody(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, body PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID request + DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, ruleID RuleIDParameter, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID request + GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, ruleID RuleIDParameter, reqEditors ...RequestEditorFn) (*http.Response, error) + // GetApiV1OrganizationsOrganizationIDRegions request GetApiV1OrganizationsOrganizationIDRegions(ctx context.Context, organizationID OrganizationIDParameter, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -137,6 +167,9 @@ type ClientInterface interface { // GetApiV1OrganizationsOrganizationIDRegionsRegionIDImages request GetApiV1OrganizationsOrganizationIDRegionsRegionIDImages(ctx context.Context, organizationID OrganizationIDParameter, regionID RegionIDParameter, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetApiV1OrganizationsOrganizationIDSecuritygroups request + GetApiV1OrganizationsOrganizationIDSecuritygroups(ctx context.Context, organizationID OrganizationIDParameter, reqEditors ...RequestEditorFn) (*http.Response, error) } func (c *Client) GetApiV1OrganizationsOrganizationIDIdentities(ctx context.Context, organizationID OrganizationIDParameter, reqEditors ...RequestEditorFn) (*http.Response, error) { @@ -295,6 +328,138 @@ func (c *Client) PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesI return c.Client.Do(req) } +func (c *Client) PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsWithBody(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsRequestWithBody(c.Server, organizationID, projectID, identityID, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroups(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, body PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsRequest(c.Server, organizationID, projectID, identityID, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRequest(c.Server, organizationID, projectID, identityID, securityGroupID) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRequest(c.Server, organizationID, projectID, identityID, securityGroupID) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDWithBody(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRequestWithBody(c.Server, organizationID, projectID, identityID, securityGroupID, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, body PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRequest(c.Server, organizationID, projectID, identityID, securityGroupID, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRequest(c.Server, organizationID, projectID, identityID, securityGroupID) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesWithBody(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRequestWithBody(c.Server, organizationID, projectID, identityID, securityGroupID, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, body PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRequest(c.Server, organizationID, projectID, identityID, securityGroupID, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, ruleID RuleIDParameter, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDRequest(c.Server, organizationID, projectID, identityID, securityGroupID, ruleID) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, ruleID RuleIDParameter, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDRequest(c.Server, organizationID, projectID, identityID, securityGroupID, ruleID) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) GetApiV1OrganizationsOrganizationIDRegions(ctx context.Context, organizationID OrganizationIDParameter, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetApiV1OrganizationsOrganizationIDRegionsRequest(c.Server, organizationID) if err != nil { @@ -343,6 +508,18 @@ func (c *Client) GetApiV1OrganizationsOrganizationIDRegionsRegionIDImages(ctx co return c.Client.Do(req) } +func (c *Client) GetApiV1OrganizationsOrganizationIDSecuritygroups(ctx context.Context, organizationID OrganizationIDParameter, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetApiV1OrganizationsOrganizationIDSecuritygroupsRequest(c.Server, organizationID) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + // NewGetApiV1OrganizationsOrganizationIDIdentitiesRequest generates requests for GetApiV1OrganizationsOrganizationIDIdentities func NewGetApiV1OrganizationsOrganizationIDIdentitiesRequest(server string, organizationID OrganizationIDParameter) (*http.Request, error) { var err error @@ -841,8 +1018,19 @@ func NewPutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityID return req, nil } -// NewGetApiV1OrganizationsOrganizationIDRegionsRequest generates requests for GetApiV1OrganizationsOrganizationIDRegions -func NewGetApiV1OrganizationsOrganizationIDRegionsRequest(server string, organizationID OrganizationIDParameter) (*http.Request, error) { +// NewPostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsRequest calls the generic PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroups builder with application/json body +func NewPostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsRequest(server string, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, body PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewPostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsRequestWithBody(server, organizationID, projectID, identityID, "application/json", bodyReader) +} + +// NewPostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsRequestWithBody generates requests for PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroups with any type of body +func NewPostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsRequestWithBody(server string, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -852,12 +1040,26 @@ func NewGetApiV1OrganizationsOrganizationIDRegionsRequest(server string, organiz return nil, err } + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "projectID", runtime.ParamLocationPath, projectID) + if err != nil { + return nil, err + } + + var pathParam2 string + + pathParam2, err = runtime.StyleParamWithLocation("simple", false, "identityID", runtime.ParamLocationPath, identityID) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/api/v1/organizations/%s/regions", pathParam0) + operationPath := fmt.Sprintf("/api/v1/organizations/%s/projects/%s/identities/%s/securitygroups", pathParam0, pathParam1, pathParam2) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -867,16 +1069,18 @@ func NewGetApiV1OrganizationsOrganizationIDRegionsRequest(server string, organiz return nil, err } - req, err := http.NewRequest("GET", queryURL.String(), nil) + req, err := http.NewRequest("POST", queryURL.String(), body) if err != nil { return nil, err } + req.Header.Add("Content-Type", contentType) + return req, nil } -// NewGetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksRequest generates requests for GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworks -func NewGetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksRequest(server string, organizationID OrganizationIDParameter, regionID RegionIDParameter) (*http.Request, error) { +// NewDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRequest generates requests for DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID +func NewDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRequest(server string, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter) (*http.Request, error) { var err error var pathParam0 string @@ -888,7 +1092,21 @@ func NewGetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksReques var pathParam1 string - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "regionID", runtime.ParamLocationPath, regionID) + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "projectID", runtime.ParamLocationPath, projectID) + if err != nil { + return nil, err + } + + var pathParam2 string + + pathParam2, err = runtime.StyleParamWithLocation("simple", false, "identityID", runtime.ParamLocationPath, identityID) + if err != nil { + return nil, err + } + + var pathParam3 string + + pathParam3, err = runtime.StyleParamWithLocation("simple", false, "securityGroupID", runtime.ParamLocationPath, securityGroupID) if err != nil { return nil, err } @@ -898,7 +1116,7 @@ func NewGetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksReques return nil, err } - operationPath := fmt.Sprintf("/api/v1/organizations/%s/regions/%s/externalnetworks", pathParam0, pathParam1) + operationPath := fmt.Sprintf("/api/v1/organizations/%s/projects/%s/identities/%s/securitygroups/%s", pathParam0, pathParam1, pathParam2, pathParam3) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -908,7 +1126,7 @@ func NewGetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksReques return nil, err } - req, err := http.NewRequest("GET", queryURL.String(), nil) + req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { return nil, err } @@ -916,8 +1134,8 @@ func NewGetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksReques return req, nil } -// NewGetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsRequest generates requests for GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavors -func NewGetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsRequest(server string, organizationID OrganizationIDParameter, regionID RegionIDParameter) (*http.Request, error) { +// NewGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRequest generates requests for GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID +func NewGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRequest(server string, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter) (*http.Request, error) { var err error var pathParam0 string @@ -929,7 +1147,21 @@ func NewGetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsRequest(server var pathParam1 string - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "regionID", runtime.ParamLocationPath, regionID) + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "projectID", runtime.ParamLocationPath, projectID) + if err != nil { + return nil, err + } + + var pathParam2 string + + pathParam2, err = runtime.StyleParamWithLocation("simple", false, "identityID", runtime.ParamLocationPath, identityID) + if err != nil { + return nil, err + } + + var pathParam3 string + + pathParam3, err = runtime.StyleParamWithLocation("simple", false, "securityGroupID", runtime.ParamLocationPath, securityGroupID) if err != nil { return nil, err } @@ -939,7 +1171,7 @@ func NewGetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsRequest(server return nil, err } - operationPath := fmt.Sprintf("/api/v1/organizations/%s/regions/%s/flavors", pathParam0, pathParam1) + operationPath := fmt.Sprintf("/api/v1/organizations/%s/projects/%s/identities/%s/securitygroups/%s", pathParam0, pathParam1, pathParam2, pathParam3) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -957,8 +1189,19 @@ func NewGetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsRequest(server return req, nil } -// NewGetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesRequest generates requests for GetApiV1OrganizationsOrganizationIDRegionsRegionIDImages -func NewGetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesRequest(server string, organizationID OrganizationIDParameter, regionID RegionIDParameter) (*http.Request, error) { +// NewPutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRequest calls the generic PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID builder with application/json body +func NewPutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRequest(server string, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, body PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewPutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRequestWithBody(server, organizationID, projectID, identityID, securityGroupID, "application/json", bodyReader) +} + +// NewPutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRequestWithBody generates requests for PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID with any type of body +func NewPutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRequestWithBody(server string, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -970,7 +1213,21 @@ func NewGetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesRequest(server s var pathParam1 string - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "regionID", runtime.ParamLocationPath, regionID) + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "projectID", runtime.ParamLocationPath, projectID) + if err != nil { + return nil, err + } + + var pathParam2 string + + pathParam2, err = runtime.StyleParamWithLocation("simple", false, "identityID", runtime.ParamLocationPath, identityID) + if err != nil { + return nil, err + } + + var pathParam3 string + + pathParam3, err = runtime.StyleParamWithLocation("simple", false, "securityGroupID", runtime.ParamLocationPath, securityGroupID) if err != nil { return nil, err } @@ -980,7 +1237,7 @@ func NewGetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesRequest(server s return nil, err } - operationPath := fmt.Sprintf("/api/v1/organizations/%s/regions/%s/images", pathParam0, pathParam1) + operationPath := fmt.Sprintf("/api/v1/organizations/%s/projects/%s/identities/%s/securitygroups/%s", pathParam0, pathParam1, pathParam2, pathParam3) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -990,630 +1247,1810 @@ func NewGetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesRequest(server s return nil, err } - req, err := http.NewRequest("GET", queryURL.String(), nil) + req, err := http.NewRequest("PUT", queryURL.String(), body) if err != nil { return nil, err } + req.Header.Add("Content-Type", contentType) + return req, nil } -func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { - for _, r := range c.RequestEditors { - if err := r(ctx, req); err != nil { - return err - } - } - for _, r := range additionalEditors { - if err := r(ctx, req); err != nil { - return err - } - } - return nil -} +// NewGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRequest generates requests for GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules +func NewGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRequest(server string, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter) (*http.Request, error) { + var err error -// ClientWithResponses builds on ClientInterface to offer response payloads -type ClientWithResponses struct { - ClientInterface -} + var pathParam0 string -// NewClientWithResponses creates a new ClientWithResponses, which wraps -// Client with return type handling -func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) { - client, err := NewClient(server, opts...) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationID", runtime.ParamLocationPath, organizationID) if err != nil { return nil, err } - return &ClientWithResponses{client}, nil -} -// WithBaseURL overrides the baseURL. -func WithBaseURL(baseURL string) ClientOption { - return func(c *Client) error { - newBaseURL, err := url.Parse(baseURL) - if err != nil { - return err - } - c.Server = newBaseURL.String() - return nil + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "projectID", runtime.ParamLocationPath, projectID) + if err != nil { + return nil, err } -} -// ClientWithResponsesInterface is the interface specification for the client with responses above. -type ClientWithResponsesInterface interface { - // GetApiV1OrganizationsOrganizationIDIdentitiesWithResponse request - GetApiV1OrganizationsOrganizationIDIdentitiesWithResponse(ctx context.Context, organizationID OrganizationIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDIdentitiesResponse, error) + var pathParam2 string - // GetApiV1OrganizationsOrganizationIDPhysicalnetworksWithResponse request - GetApiV1OrganizationsOrganizationIDPhysicalnetworksWithResponse(ctx context.Context, organizationID OrganizationIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDPhysicalnetworksResponse, error) + pathParam2, err = runtime.StyleParamWithLocation("simple", false, "identityID", runtime.ParamLocationPath, identityID) + if err != nil { + return nil, err + } - // PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesWithBodyWithResponse request with any body - PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesWithBodyWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse, error) + var pathParam3 string - PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, body PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse, error) + pathParam3, err = runtime.StyleParamWithLocation("simple", false, "securityGroupID", runtime.ParamLocationPath, securityGroupID) + if err != nil { + return nil, err + } - // DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDWithResponse request - DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, reqEditors ...RequestEditorFn) (*DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse, error) + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } - // GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDWithResponse request - GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse, error) + operationPath := fmt.Sprintf("/api/v1/organizations/%s/projects/%s/identities/%s/securitygroups/%s/rules", pathParam0, pathParam1, pathParam2, pathParam3) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } - // PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksWithBodyWithResponse request with any body - PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksWithBodyWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse, error) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, body PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse, error) + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } - // DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDWithResponse request - DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, physicalNetworkID PhysicalNetworkIDParameter, reqEditors ...RequestEditorFn) (*DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse, error) + return req, nil +} - // GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDWithResponse request - GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, physicalNetworkID PhysicalNetworkIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse, error) +// NewPostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRequest calls the generic PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules builder with application/json body +func NewPostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRequest(server string, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, body PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewPostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRequestWithBody(server, organizationID, projectID, identityID, securityGroupID, "application/json", bodyReader) +} - // GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithResponse request - GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse, error) +// NewPostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRequestWithBody generates requests for PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules with any type of body +func NewPostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRequestWithBody(server string, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, contentType string, body io.Reader) (*http.Request, error) { + var err error - // PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithBodyWithResponse request with any body - PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithBodyWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse, error) + var pathParam0 string - PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, body PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasJSONRequestBody, reqEditors ...RequestEditorFn) (*PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse, error) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationID", runtime.ParamLocationPath, organizationID) + if err != nil { + return nil, err + } - // GetApiV1OrganizationsOrganizationIDRegionsWithResponse request - GetApiV1OrganizationsOrganizationIDRegionsWithResponse(ctx context.Context, organizationID OrganizationIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDRegionsResponse, error) + var pathParam1 string - // GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksWithResponse request - GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksWithResponse(ctx context.Context, organizationID OrganizationIDParameter, regionID RegionIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksResponse, error) + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "projectID", runtime.ParamLocationPath, projectID) + if err != nil { + return nil, err + } - // GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsWithResponse request - GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsWithResponse(ctx context.Context, organizationID OrganizationIDParameter, regionID RegionIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsResponse, error) + var pathParam2 string - // GetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesWithResponse request - GetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesWithResponse(ctx context.Context, organizationID OrganizationIDParameter, regionID RegionIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesResponse, error) -} + pathParam2, err = runtime.StyleParamWithLocation("simple", false, "identityID", runtime.ParamLocationPath, identityID) + if err != nil { + return nil, err + } -type GetApiV1OrganizationsOrganizationIDIdentitiesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *IdentitiesResponse - JSON400 *externalRef0.BadRequestResponse - JSON401 *externalRef0.UnauthorizedResponse - JSON403 *externalRef0.ForbiddenResponse - JSON500 *externalRef0.InternalServerErrorResponse -} + var pathParam3 string -// Status returns HTTPResponse.Status -func (r GetApiV1OrganizationsOrganizationIDIdentitiesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam3, err = runtime.StyleParamWithLocation("simple", false, "securityGroupID", runtime.ParamLocationPath, securityGroupID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetApiV1OrganizationsOrganizationIDIdentitiesResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(server) + if err != nil { + return nil, err } - return 0 -} -type GetApiV1OrganizationsOrganizationIDPhysicalnetworksResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *PhysicalNetworksResponse - JSON400 *externalRef0.BadRequestResponse - JSON401 *externalRef0.UnauthorizedResponse - JSON403 *externalRef0.ForbiddenResponse - JSON500 *externalRef0.InternalServerErrorResponse -} + operationPath := fmt.Sprintf("/api/v1/organizations/%s/projects/%s/identities/%s/securitygroups/%s/rules", pathParam0, pathParam1, pathParam2, pathParam3) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } -// Status returns HTTPResponse.Status -func (r GetApiV1OrganizationsOrganizationIDPhysicalnetworksResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetApiV1OrganizationsOrganizationIDPhysicalnetworksResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err } - return 0 -} -type PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *IdentityResponse - JSON400 *externalRef0.BadRequestResponse - JSON401 *externalRef0.UnauthorizedResponse - JSON403 *externalRef0.ForbiddenResponse - JSON500 *externalRef0.InternalServerErrorResponse -} + req.Header.Add("Content-Type", contentType) -// Status returns HTTPResponse.Status -func (r PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) + return req, nil } -// StatusCode returns HTTPResponse.StatusCode -func (r PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} +// NewDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDRequest generates requests for DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID +func NewDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDRequest(server string, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, ruleID RuleIDParameter) (*http.Request, error) { + var err error -type DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON400 *externalRef0.BadRequestResponse - JSON401 *externalRef0.UnauthorizedResponse - JSON403 *externalRef0.ForbiddenResponse - JSON404 *externalRef0.NotFoundResponse - JSON500 *externalRef0.InternalServerErrorResponse -} + var pathParam0 string -// Status returns HTTPResponse.Status -func (r DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationID", runtime.ParamLocationPath, organizationID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "projectID", runtime.ParamLocationPath, projectID) + if err != nil { + return nil, err } - return 0 -} -type GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *IdentityResponse - JSON400 *externalRef0.BadRequestResponse - JSON401 *externalRef0.UnauthorizedResponse - JSON403 *externalRef0.ForbiddenResponse - JSON500 *externalRef0.InternalServerErrorResponse -} + var pathParam2 string -// Status returns HTTPResponse.Status -func (r GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam2, err = runtime.StyleParamWithLocation("simple", false, "identityID", runtime.ParamLocationPath, identityID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + var pathParam3 string + + pathParam3, err = runtime.StyleParamWithLocation("simple", false, "securityGroupID", runtime.ParamLocationPath, securityGroupID) + if err != nil { + return nil, err } - return 0 -} -type PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *PhysicalNetworkResponse - JSON400 *externalRef0.BadRequestResponse - JSON401 *externalRef0.UnauthorizedResponse - JSON403 *externalRef0.ForbiddenResponse - JSON500 *externalRef0.InternalServerErrorResponse -} + var pathParam4 string -// Status returns HTTPResponse.Status -func (r PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam4, err = runtime.StyleParamWithLocation("simple", false, "ruleID", runtime.ParamLocationPath, ruleID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(server) + if err != nil { + return nil, err } - return 0 -} - -type DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON400 *externalRef0.BadRequestResponse - JSON401 *externalRef0.UnauthorizedResponse - JSON403 *externalRef0.ForbiddenResponse - JSON500 *externalRef0.InternalServerErrorResponse -} -// Status returns HTTPResponse.Status -func (r DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + operationPath := fmt.Sprintf("/api/v1/organizations/%s/projects/%s/identities/%s/securitygroups/%s/rules/%s", pathParam0, pathParam1, pathParam2, pathParam3, pathParam4) + if operationPath[0] == '/' { + operationPath = "." + operationPath } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return 0 -} - -type GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *PhysicalNetworkResponse - JSON400 *externalRef0.BadRequestResponse - JSON401 *externalRef0.UnauthorizedResponse - JSON403 *externalRef0.ForbiddenResponse - JSON500 *externalRef0.InternalServerErrorResponse -} -// Status returns HTTPResponse.Status -func (r GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 + return req, nil } -type GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *QuotasResponse - JSON400 *externalRef0.BadRequestResponse - JSON401 *externalRef0.UnauthorizedResponse - JSON403 *externalRef0.ForbiddenResponse - JSON500 *externalRef0.InternalServerErrorResponse -} +// NewGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDRequest generates requests for GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID +func NewGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDRequest(server string, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, ruleID RuleIDParameter) (*http.Request, error) { + var err error -// Status returns HTTPResponse.Status -func (r GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + var pathParam0 string -// StatusCode returns HTTPResponse.StatusCode -func (r GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationID", runtime.ParamLocationPath, organizationID) + if err != nil { + return nil, err } - return 0 -} - -type PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse struct { - Body []byte - HTTPResponse *http.Response - JSON400 *externalRef0.BadRequestResponse - JSON401 *externalRef0.UnauthorizedResponse - JSON403 *externalRef0.ForbiddenResponse - JSON500 *externalRef0.InternalServerErrorResponse -} -// Status returns HTTPResponse.Status -func (r PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + var pathParam1 string -// StatusCode returns HTTPResponse.StatusCode -func (r PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "projectID", runtime.ParamLocationPath, projectID) + if err != nil { + return nil, err } - return 0 -} -type GetApiV1OrganizationsOrganizationIDRegionsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *RegionsResponse - JSON401 *externalRef0.UnauthorizedResponse - JSON500 *externalRef0.InternalServerErrorResponse -} + var pathParam2 string -// Status returns HTTPResponse.Status -func (r GetApiV1OrganizationsOrganizationIDRegionsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam2, err = runtime.StyleParamWithLocation("simple", false, "identityID", runtime.ParamLocationPath, identityID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetApiV1OrganizationsOrganizationIDRegionsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + var pathParam3 string + + pathParam3, err = runtime.StyleParamWithLocation("simple", false, "securityGroupID", runtime.ParamLocationPath, securityGroupID) + if err != nil { + return nil, err } - return 0 -} -type GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ExternalNetworksResponse - JSON401 *externalRef0.UnauthorizedResponse - JSON403 *externalRef0.ForbiddenResponse - JSON404 *externalRef0.NotFoundResponse - JSON500 *externalRef0.InternalServerErrorResponse -} + var pathParam4 string -// Status returns HTTPResponse.Status -func (r GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam4, err = runtime.StyleParamWithLocation("simple", false, "ruleID", runtime.ParamLocationPath, ruleID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(server) + if err != nil { + return nil, err } - return 0 -} -type GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *FlavorsResponse - JSON400 *externalRef0.BadRequestResponse - JSON401 *externalRef0.UnauthorizedResponse - JSON500 *externalRef0.InternalServerErrorResponse -} + operationPath := fmt.Sprintf("/api/v1/organizations/%s/projects/%s/identities/%s/securitygroups/%s/rules/%s", pathParam0, pathParam1, pathParam2, pathParam3, pathParam4) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } -// Status returns HTTPResponse.Status -func (r GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - return 0 -} -type GetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ImagesResponse - JSON400 *externalRef0.BadRequestResponse - JSON401 *externalRef0.UnauthorizedResponse - JSON500 *externalRef0.InternalServerErrorResponse + return req, nil } -// Status returns HTTPResponse.Status -func (r GetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} +// NewGetApiV1OrganizationsOrganizationIDRegionsRequest generates requests for GetApiV1OrganizationsOrganizationIDRegions +func NewGetApiV1OrganizationsOrganizationIDRegionsRequest(server string, organizationID OrganizationIDParameter) (*http.Request, error) { + var err error -// StatusCode returns HTTPResponse.StatusCode -func (r GetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + var pathParam0 string -// GetApiV1OrganizationsOrganizationIDIdentitiesWithResponse request returning *GetApiV1OrganizationsOrganizationIDIdentitiesResponse -func (c *ClientWithResponses) GetApiV1OrganizationsOrganizationIDIdentitiesWithResponse(ctx context.Context, organizationID OrganizationIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDIdentitiesResponse, error) { - rsp, err := c.GetApiV1OrganizationsOrganizationIDIdentities(ctx, organizationID, reqEditors...) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationID", runtime.ParamLocationPath, organizationID) if err != nil { return nil, err } - return ParseGetApiV1OrganizationsOrganizationIDIdentitiesResponse(rsp) -} -// GetApiV1OrganizationsOrganizationIDPhysicalnetworksWithResponse request returning *GetApiV1OrganizationsOrganizationIDPhysicalnetworksResponse -func (c *ClientWithResponses) GetApiV1OrganizationsOrganizationIDPhysicalnetworksWithResponse(ctx context.Context, organizationID OrganizationIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDPhysicalnetworksResponse, error) { - rsp, err := c.GetApiV1OrganizationsOrganizationIDPhysicalnetworks(ctx, organizationID, reqEditors...) + serverURL, err := url.Parse(server) if err != nil { return nil, err } - return ParseGetApiV1OrganizationsOrganizationIDPhysicalnetworksResponse(rsp) -} -// PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesWithBodyWithResponse request with arbitrary body returning *PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse -func (c *ClientWithResponses) PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesWithBodyWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse, error) { - rsp, err := c.PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesWithBody(ctx, organizationID, projectID, contentType, body, reqEditors...) - if err != nil { - return nil, err + operationPath := fmt.Sprintf("/api/v1/organizations/%s/regions", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath } - return ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse(rsp) -} -func (c *ClientWithResponses) PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, body PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse, error) { - rsp, err := c.PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentities(ctx, organizationID, projectID, body, reqEditors...) + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse(rsp) -} -// DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDWithResponse request returning *DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse -func (c *ClientWithResponses) DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, reqEditors ...RequestEditorFn) (*DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse, error) { - rsp, err := c.DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityID(ctx, organizationID, projectID, identityID, reqEditors...) + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - return ParseDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse(rsp) + + return req, nil } -// GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDWithResponse request returning *GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse -func (c *ClientWithResponses) GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse, error) { - rsp, err := c.GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityID(ctx, organizationID, projectID, identityID, reqEditors...) +// NewGetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksRequest generates requests for GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworks +func NewGetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksRequest(server string, organizationID OrganizationIDParameter, regionID RegionIDParameter) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationID", runtime.ParamLocationPath, organizationID) if err != nil { return nil, err } - return ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse(rsp) -} -// PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksWithBodyWithResponse request with arbitrary body returning *PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse -func (c *ClientWithResponses) PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksWithBodyWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse, error) { - rsp, err := c.PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksWithBody(ctx, organizationID, projectID, identityID, contentType, body, reqEditors...) + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "regionID", runtime.ParamLocationPath, regionID) if err != nil { return nil, err } - return ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse(rsp) + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/api/v1/organizations/%s/regions/%s/externalnetworks", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil } -func (c *ClientWithResponses) PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, body PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse, error) { - rsp, err := c.PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworks(ctx, organizationID, projectID, identityID, body, reqEditors...) +// NewGetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsRequest generates requests for GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavors +func NewGetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsRequest(server string, organizationID OrganizationIDParameter, regionID RegionIDParameter) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationID", runtime.ParamLocationPath, organizationID) if err != nil { return nil, err } - return ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse(rsp) + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "regionID", runtime.ParamLocationPath, regionID) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/api/v1/organizations/%s/regions/%s/flavors", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil } -// DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDWithResponse request returning *DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse -func (c *ClientWithResponses) DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, physicalNetworkID PhysicalNetworkIDParameter, reqEditors ...RequestEditorFn) (*DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse, error) { - rsp, err := c.DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkID(ctx, organizationID, projectID, identityID, physicalNetworkID, reqEditors...) +// NewGetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesRequest generates requests for GetApiV1OrganizationsOrganizationIDRegionsRegionIDImages +func NewGetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesRequest(server string, organizationID OrganizationIDParameter, regionID RegionIDParameter) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationID", runtime.ParamLocationPath, organizationID) if err != nil { return nil, err } - return ParseDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse(rsp) + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "regionID", runtime.ParamLocationPath, regionID) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/api/v1/organizations/%s/regions/%s/images", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil } -// GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDWithResponse request returning *GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse -func (c *ClientWithResponses) GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, physicalNetworkID PhysicalNetworkIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse, error) { - rsp, err := c.GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkID(ctx, organizationID, projectID, identityID, physicalNetworkID, reqEditors...) +// NewGetApiV1OrganizationsOrganizationIDSecuritygroupsRequest generates requests for GetApiV1OrganizationsOrganizationIDSecuritygroups +func NewGetApiV1OrganizationsOrganizationIDSecuritygroupsRequest(server string, organizationID OrganizationIDParameter) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationID", runtime.ParamLocationPath, organizationID) if err != nil { return nil, err } - return ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse(rsp) + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/api/v1/organizations/%s/securitygroups", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil } -// GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithResponse request returning *GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse -func (c *ClientWithResponses) GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse, error) { - rsp, err := c.GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotas(ctx, organizationID, projectID, identityID, reqEditors...) +func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { + for _, r := range c.RequestEditors { + if err := r(ctx, req); err != nil { + return err + } + } + for _, r := range additionalEditors { + if err := r(ctx, req); err != nil { + return err + } + } + return nil +} + +// ClientWithResponses builds on ClientInterface to offer response payloads +type ClientWithResponses struct { + ClientInterface +} + +// NewClientWithResponses creates a new ClientWithResponses, which wraps +// Client with return type handling +func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) { + client, err := NewClient(server, opts...) if err != nil { return nil, err } - return ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse(rsp) + return &ClientWithResponses{client}, nil +} + +// WithBaseURL overrides the baseURL. +func WithBaseURL(baseURL string) ClientOption { + return func(c *Client) error { + newBaseURL, err := url.Parse(baseURL) + if err != nil { + return err + } + c.Server = newBaseURL.String() + return nil + } +} + +// ClientWithResponsesInterface is the interface specification for the client with responses above. +type ClientWithResponsesInterface interface { + // GetApiV1OrganizationsOrganizationIDIdentitiesWithResponse request + GetApiV1OrganizationsOrganizationIDIdentitiesWithResponse(ctx context.Context, organizationID OrganizationIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDIdentitiesResponse, error) + + // GetApiV1OrganizationsOrganizationIDPhysicalnetworksWithResponse request + GetApiV1OrganizationsOrganizationIDPhysicalnetworksWithResponse(ctx context.Context, organizationID OrganizationIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDPhysicalnetworksResponse, error) + + // PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesWithBodyWithResponse request with any body + PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesWithBodyWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse, error) + + PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, body PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse, error) + + // DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDWithResponse request + DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, reqEditors ...RequestEditorFn) (*DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse, error) + + // GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDWithResponse request + GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse, error) + + // PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksWithBodyWithResponse request with any body + PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksWithBodyWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse, error) + + PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, body PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse, error) + + // DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDWithResponse request + DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, physicalNetworkID PhysicalNetworkIDParameter, reqEditors ...RequestEditorFn) (*DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse, error) + + // GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDWithResponse request + GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, physicalNetworkID PhysicalNetworkIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse, error) + + // GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithResponse request + GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse, error) + + // PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithBodyWithResponse request with any body + PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithBodyWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse, error) + + PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, body PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasJSONRequestBody, reqEditors ...RequestEditorFn) (*PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse, error) + + // PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsWithBodyWithResponse request with any body + PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsWithBodyWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsResponse, error) + + PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, body PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsResponse, error) + + // DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDWithResponse request + DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, reqEditors ...RequestEditorFn) (*DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse, error) + + // GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDWithResponse request + GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse, error) + + // PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDWithBodyWithResponse request with any body + PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDWithBodyWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse, error) + + PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, body PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDJSONRequestBody, reqEditors ...RequestEditorFn) (*PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse, error) + + // GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesWithResponse request + GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse, error) + + // PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesWithBodyWithResponse request with any body + PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesWithBodyWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse, error) + + PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, body PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse, error) + + // DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDWithResponse request + DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, ruleID RuleIDParameter, reqEditors ...RequestEditorFn) (*DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDResponse, error) + + // GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDWithResponse request + GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, ruleID RuleIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDResponse, error) + + // GetApiV1OrganizationsOrganizationIDRegionsWithResponse request + GetApiV1OrganizationsOrganizationIDRegionsWithResponse(ctx context.Context, organizationID OrganizationIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDRegionsResponse, error) + + // GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksWithResponse request + GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksWithResponse(ctx context.Context, organizationID OrganizationIDParameter, regionID RegionIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksResponse, error) + + // GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsWithResponse request + GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsWithResponse(ctx context.Context, organizationID OrganizationIDParameter, regionID RegionIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsResponse, error) + + // GetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesWithResponse request + GetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesWithResponse(ctx context.Context, organizationID OrganizationIDParameter, regionID RegionIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesResponse, error) + + // GetApiV1OrganizationsOrganizationIDSecuritygroupsWithResponse request + GetApiV1OrganizationsOrganizationIDSecuritygroupsWithResponse(ctx context.Context, organizationID OrganizationIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDSecuritygroupsResponse, error) } -// PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithBodyWithResponse request with arbitrary body returning *PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse -func (c *ClientWithResponses) PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithBodyWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse, error) { - rsp, err := c.PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithBody(ctx, organizationID, projectID, identityID, contentType, body, reqEditors...) - if err != nil { - return nil, err +type GetApiV1OrganizationsOrganizationIDIdentitiesResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *IdentitiesResponse + JSON400 *externalRef0.BadRequestResponse + JSON401 *externalRef0.UnauthorizedResponse + JSON403 *externalRef0.ForbiddenResponse + JSON500 *externalRef0.InternalServerErrorResponse +} + +// Status returns HTTPResponse.Status +func (r GetApiV1OrganizationsOrganizationIDIdentitiesResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetApiV1OrganizationsOrganizationIDIdentitiesResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetApiV1OrganizationsOrganizationIDPhysicalnetworksResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *PhysicalNetworksResponse + JSON400 *externalRef0.BadRequestResponse + JSON401 *externalRef0.UnauthorizedResponse + JSON403 *externalRef0.ForbiddenResponse + JSON500 *externalRef0.InternalServerErrorResponse +} + +// Status returns HTTPResponse.Status +func (r GetApiV1OrganizationsOrganizationIDPhysicalnetworksResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetApiV1OrganizationsOrganizationIDPhysicalnetworksResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse struct { + Body []byte + HTTPResponse *http.Response + JSON201 *IdentityResponse + JSON400 *externalRef0.BadRequestResponse + JSON401 *externalRef0.UnauthorizedResponse + JSON403 *externalRef0.ForbiddenResponse + JSON500 *externalRef0.InternalServerErrorResponse +} + +// Status returns HTTPResponse.Status +func (r PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse struct { + Body []byte + HTTPResponse *http.Response + JSON400 *externalRef0.BadRequestResponse + JSON401 *externalRef0.UnauthorizedResponse + JSON403 *externalRef0.ForbiddenResponse + JSON404 *externalRef0.NotFoundResponse + JSON500 *externalRef0.InternalServerErrorResponse +} + +// Status returns HTTPResponse.Status +func (r DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *IdentityResponse + JSON400 *externalRef0.BadRequestResponse + JSON401 *externalRef0.UnauthorizedResponse + JSON403 *externalRef0.ForbiddenResponse + JSON500 *externalRef0.InternalServerErrorResponse +} + +// Status returns HTTPResponse.Status +func (r GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse struct { + Body []byte + HTTPResponse *http.Response + JSON201 *PhysicalNetworkResponse + JSON400 *externalRef0.BadRequestResponse + JSON401 *externalRef0.UnauthorizedResponse + JSON403 *externalRef0.ForbiddenResponse + JSON500 *externalRef0.InternalServerErrorResponse +} + +// Status returns HTTPResponse.Status +func (r PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse struct { + Body []byte + HTTPResponse *http.Response + JSON400 *externalRef0.BadRequestResponse + JSON401 *externalRef0.UnauthorizedResponse + JSON403 *externalRef0.ForbiddenResponse + JSON500 *externalRef0.InternalServerErrorResponse +} + +// Status returns HTTPResponse.Status +func (r DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *PhysicalNetworkResponse + JSON400 *externalRef0.BadRequestResponse + JSON401 *externalRef0.UnauthorizedResponse + JSON403 *externalRef0.ForbiddenResponse + JSON500 *externalRef0.InternalServerErrorResponse +} + +// Status returns HTTPResponse.Status +func (r GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *QuotasResponse + JSON400 *externalRef0.BadRequestResponse + JSON401 *externalRef0.UnauthorizedResponse + JSON403 *externalRef0.ForbiddenResponse + JSON500 *externalRef0.InternalServerErrorResponse +} + +// Status returns HTTPResponse.Status +func (r GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse struct { + Body []byte + HTTPResponse *http.Response + JSON400 *externalRef0.BadRequestResponse + JSON401 *externalRef0.UnauthorizedResponse + JSON403 *externalRef0.ForbiddenResponse + JSON500 *externalRef0.InternalServerErrorResponse +} + +// Status returns HTTPResponse.Status +func (r PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsResponse struct { + Body []byte + HTTPResponse *http.Response + JSON201 *SecurityGroupResponse + JSON400 *externalRef0.BadRequestResponse + JSON401 *externalRef0.UnauthorizedResponse + JSON403 *externalRef0.ForbiddenResponse + JSON500 *externalRef0.InternalServerErrorResponse +} + +// Status returns HTTPResponse.Status +func (r PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse struct { + Body []byte + HTTPResponse *http.Response + JSON400 *externalRef0.BadRequestResponse + JSON401 *externalRef0.UnauthorizedResponse + JSON403 *externalRef0.ForbiddenResponse + JSON500 *externalRef0.InternalServerErrorResponse +} + +// Status returns HTTPResponse.Status +func (r DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *SecurityGroupResponse + JSON400 *externalRef0.BadRequestResponse + JSON401 *externalRef0.UnauthorizedResponse + JSON403 *externalRef0.ForbiddenResponse + JSON500 *externalRef0.InternalServerErrorResponse +} + +// Status returns HTTPResponse.Status +func (r GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse struct { + Body []byte + HTTPResponse *http.Response + JSON400 *externalRef0.BadRequestResponse + JSON401 *externalRef0.UnauthorizedResponse + JSON403 *externalRef0.ForbiddenResponse + JSON500 *externalRef0.InternalServerErrorResponse +} + +// Status returns HTTPResponse.Status +func (r PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *SecurityGroupRulesResponse + JSON400 *externalRef0.BadRequestResponse + JSON401 *externalRef0.UnauthorizedResponse + JSON403 *externalRef0.ForbiddenResponse + JSON500 *externalRef0.InternalServerErrorResponse +} + +// Status returns HTTPResponse.Status +func (r GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse struct { + Body []byte + HTTPResponse *http.Response + JSON201 *SecurityGroupRuleResponse + JSON400 *externalRef0.BadRequestResponse + JSON401 *externalRef0.UnauthorizedResponse + JSON403 *externalRef0.ForbiddenResponse + JSON500 *externalRef0.InternalServerErrorResponse +} + +// Status returns HTTPResponse.Status +func (r PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDResponse struct { + Body []byte + HTTPResponse *http.Response + JSON400 *externalRef0.BadRequestResponse + JSON401 *externalRef0.UnauthorizedResponse + JSON403 *externalRef0.ForbiddenResponse + JSON500 *externalRef0.InternalServerErrorResponse +} + +// Status returns HTTPResponse.Status +func (r DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *SecurityGroupRuleResponse + JSON400 *externalRef0.BadRequestResponse + JSON401 *externalRef0.UnauthorizedResponse + JSON403 *externalRef0.ForbiddenResponse + JSON500 *externalRef0.InternalServerErrorResponse +} + +// Status returns HTTPResponse.Status +func (r GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetApiV1OrganizationsOrganizationIDRegionsResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *RegionsResponse + JSON401 *externalRef0.UnauthorizedResponse + JSON500 *externalRef0.InternalServerErrorResponse +} + +// Status returns HTTPResponse.Status +func (r GetApiV1OrganizationsOrganizationIDRegionsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetApiV1OrganizationsOrganizationIDRegionsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *ExternalNetworksResponse + JSON401 *externalRef0.UnauthorizedResponse + JSON403 *externalRef0.ForbiddenResponse + JSON404 *externalRef0.NotFoundResponse + JSON500 *externalRef0.InternalServerErrorResponse +} + +// Status returns HTTPResponse.Status +func (r GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *FlavorsResponse + JSON400 *externalRef0.BadRequestResponse + JSON401 *externalRef0.UnauthorizedResponse + JSON500 *externalRef0.InternalServerErrorResponse +} + +// Status returns HTTPResponse.Status +func (r GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *ImagesResponse + JSON400 *externalRef0.BadRequestResponse + JSON401 *externalRef0.UnauthorizedResponse + JSON500 *externalRef0.InternalServerErrorResponse +} + +// Status returns HTTPResponse.Status +func (r GetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetApiV1OrganizationsOrganizationIDSecuritygroupsResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *SecurityGroupsResponse + JSON400 *externalRef0.BadRequestResponse + JSON401 *externalRef0.UnauthorizedResponse + JSON403 *externalRef0.ForbiddenResponse + JSON500 *externalRef0.InternalServerErrorResponse +} + +// Status returns HTTPResponse.Status +func (r GetApiV1OrganizationsOrganizationIDSecuritygroupsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetApiV1OrganizationsOrganizationIDSecuritygroupsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// GetApiV1OrganizationsOrganizationIDIdentitiesWithResponse request returning *GetApiV1OrganizationsOrganizationIDIdentitiesResponse +func (c *ClientWithResponses) GetApiV1OrganizationsOrganizationIDIdentitiesWithResponse(ctx context.Context, organizationID OrganizationIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDIdentitiesResponse, error) { + rsp, err := c.GetApiV1OrganizationsOrganizationIDIdentities(ctx, organizationID, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetApiV1OrganizationsOrganizationIDIdentitiesResponse(rsp) +} + +// GetApiV1OrganizationsOrganizationIDPhysicalnetworksWithResponse request returning *GetApiV1OrganizationsOrganizationIDPhysicalnetworksResponse +func (c *ClientWithResponses) GetApiV1OrganizationsOrganizationIDPhysicalnetworksWithResponse(ctx context.Context, organizationID OrganizationIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDPhysicalnetworksResponse, error) { + rsp, err := c.GetApiV1OrganizationsOrganizationIDPhysicalnetworks(ctx, organizationID, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetApiV1OrganizationsOrganizationIDPhysicalnetworksResponse(rsp) +} + +// PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesWithBodyWithResponse request with arbitrary body returning *PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse +func (c *ClientWithResponses) PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesWithBodyWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse, error) { + rsp, err := c.PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesWithBody(ctx, organizationID, projectID, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse(rsp) +} + +func (c *ClientWithResponses) PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, body PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse, error) { + rsp, err := c.PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentities(ctx, organizationID, projectID, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse(rsp) +} + +// DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDWithResponse request returning *DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse +func (c *ClientWithResponses) DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, reqEditors ...RequestEditorFn) (*DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse, error) { + rsp, err := c.DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityID(ctx, organizationID, projectID, identityID, reqEditors...) + if err != nil { + return nil, err + } + return ParseDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse(rsp) +} + +// GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDWithResponse request returning *GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse +func (c *ClientWithResponses) GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse, error) { + rsp, err := c.GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityID(ctx, organizationID, projectID, identityID, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse(rsp) +} + +// PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksWithBodyWithResponse request with arbitrary body returning *PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse +func (c *ClientWithResponses) PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksWithBodyWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse, error) { + rsp, err := c.PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksWithBody(ctx, organizationID, projectID, identityID, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse(rsp) +} + +func (c *ClientWithResponses) PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, body PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse, error) { + rsp, err := c.PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworks(ctx, organizationID, projectID, identityID, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse(rsp) +} + +// DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDWithResponse request returning *DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse +func (c *ClientWithResponses) DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, physicalNetworkID PhysicalNetworkIDParameter, reqEditors ...RequestEditorFn) (*DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse, error) { + rsp, err := c.DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkID(ctx, organizationID, projectID, identityID, physicalNetworkID, reqEditors...) + if err != nil { + return nil, err + } + return ParseDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse(rsp) +} + +// GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDWithResponse request returning *GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse +func (c *ClientWithResponses) GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, physicalNetworkID PhysicalNetworkIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse, error) { + rsp, err := c.GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkID(ctx, organizationID, projectID, identityID, physicalNetworkID, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse(rsp) +} + +// GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithResponse request returning *GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse +func (c *ClientWithResponses) GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse, error) { + rsp, err := c.GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotas(ctx, organizationID, projectID, identityID, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse(rsp) +} + +// PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithBodyWithResponse request with arbitrary body returning *PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse +func (c *ClientWithResponses) PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithBodyWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse, error) { + rsp, err := c.PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithBody(ctx, organizationID, projectID, identityID, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse(rsp) +} + +func (c *ClientWithResponses) PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, body PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasJSONRequestBody, reqEditors ...RequestEditorFn) (*PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse, error) { + rsp, err := c.PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotas(ctx, organizationID, projectID, identityID, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse(rsp) +} + +// PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsWithBodyWithResponse request with arbitrary body returning *PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsResponse +func (c *ClientWithResponses) PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsWithBodyWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsResponse, error) { + rsp, err := c.PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsWithBody(ctx, organizationID, projectID, identityID, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsResponse(rsp) +} + +func (c *ClientWithResponses) PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, body PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsResponse, error) { + rsp, err := c.PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroups(ctx, organizationID, projectID, identityID, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsResponse(rsp) +} + +// DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDWithResponse request returning *DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse +func (c *ClientWithResponses) DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, reqEditors ...RequestEditorFn) (*DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse, error) { + rsp, err := c.DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(ctx, organizationID, projectID, identityID, securityGroupID, reqEditors...) + if err != nil { + return nil, err + } + return ParseDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse(rsp) +} + +// GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDWithResponse request returning *GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse +func (c *ClientWithResponses) GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse, error) { + rsp, err := c.GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(ctx, organizationID, projectID, identityID, securityGroupID, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse(rsp) +} + +// PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDWithBodyWithResponse request with arbitrary body returning *PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse +func (c *ClientWithResponses) PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDWithBodyWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse, error) { + rsp, err := c.PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDWithBody(ctx, organizationID, projectID, identityID, securityGroupID, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse(rsp) +} + +func (c *ClientWithResponses) PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, body PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDJSONRequestBody, reqEditors ...RequestEditorFn) (*PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse, error) { + rsp, err := c.PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(ctx, organizationID, projectID, identityID, securityGroupID, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse(rsp) +} + +// GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesWithResponse request returning *GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse +func (c *ClientWithResponses) GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse, error) { + rsp, err := c.GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules(ctx, organizationID, projectID, identityID, securityGroupID, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse(rsp) +} + +// PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesWithBodyWithResponse request with arbitrary body returning *PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse +func (c *ClientWithResponses) PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesWithBodyWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse, error) { + rsp, err := c.PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesWithBody(ctx, organizationID, projectID, identityID, securityGroupID, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse(rsp) +} + +func (c *ClientWithResponses) PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, body PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse, error) { + rsp, err := c.PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules(ctx, organizationID, projectID, identityID, securityGroupID, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse(rsp) +} + +// DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDWithResponse request returning *DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDResponse +func (c *ClientWithResponses) DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, ruleID RuleIDParameter, reqEditors ...RequestEditorFn) (*DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDResponse, error) { + rsp, err := c.DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID(ctx, organizationID, projectID, identityID, securityGroupID, ruleID, reqEditors...) + if err != nil { + return nil, err + } + return ParseDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDResponse(rsp) +} + +// GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDWithResponse request returning *GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDResponse +func (c *ClientWithResponses) GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, ruleID RuleIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDResponse, error) { + rsp, err := c.GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID(ctx, organizationID, projectID, identityID, securityGroupID, ruleID, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDResponse(rsp) +} + +// GetApiV1OrganizationsOrganizationIDRegionsWithResponse request returning *GetApiV1OrganizationsOrganizationIDRegionsResponse +func (c *ClientWithResponses) GetApiV1OrganizationsOrganizationIDRegionsWithResponse(ctx context.Context, organizationID OrganizationIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDRegionsResponse, error) { + rsp, err := c.GetApiV1OrganizationsOrganizationIDRegions(ctx, organizationID, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetApiV1OrganizationsOrganizationIDRegionsResponse(rsp) +} + +// GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksWithResponse request returning *GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksResponse +func (c *ClientWithResponses) GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksWithResponse(ctx context.Context, organizationID OrganizationIDParameter, regionID RegionIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksResponse, error) { + rsp, err := c.GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworks(ctx, organizationID, regionID, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksResponse(rsp) +} + +// GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsWithResponse request returning *GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsResponse +func (c *ClientWithResponses) GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsWithResponse(ctx context.Context, organizationID OrganizationIDParameter, regionID RegionIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsResponse, error) { + rsp, err := c.GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavors(ctx, organizationID, regionID, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsResponse(rsp) +} + +// GetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesWithResponse request returning *GetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesResponse +func (c *ClientWithResponses) GetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesWithResponse(ctx context.Context, organizationID OrganizationIDParameter, regionID RegionIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesResponse, error) { + rsp, err := c.GetApiV1OrganizationsOrganizationIDRegionsRegionIDImages(ctx, organizationID, regionID, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesResponse(rsp) +} + +// GetApiV1OrganizationsOrganizationIDSecuritygroupsWithResponse request returning *GetApiV1OrganizationsOrganizationIDSecuritygroupsResponse +func (c *ClientWithResponses) GetApiV1OrganizationsOrganizationIDSecuritygroupsWithResponse(ctx context.Context, organizationID OrganizationIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDSecuritygroupsResponse, error) { + rsp, err := c.GetApiV1OrganizationsOrganizationIDSecuritygroups(ctx, organizationID, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetApiV1OrganizationsOrganizationIDSecuritygroupsResponse(rsp) +} + +// ParseGetApiV1OrganizationsOrganizationIDIdentitiesResponse parses an HTTP response from a GetApiV1OrganizationsOrganizationIDIdentitiesWithResponse call +func ParseGetApiV1OrganizationsOrganizationIDIdentitiesResponse(rsp *http.Response) (*GetApiV1OrganizationsOrganizationIDIdentitiesResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetApiV1OrganizationsOrganizationIDIdentitiesResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest IdentitiesResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest externalRef0.BadRequestResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest externalRef0.UnauthorizedResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest externalRef0.ForbiddenResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest externalRef0.InternalServerErrorResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParseGetApiV1OrganizationsOrganizationIDPhysicalnetworksResponse parses an HTTP response from a GetApiV1OrganizationsOrganizationIDPhysicalnetworksWithResponse call +func ParseGetApiV1OrganizationsOrganizationIDPhysicalnetworksResponse(rsp *http.Response) (*GetApiV1OrganizationsOrganizationIDPhysicalnetworksResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetApiV1OrganizationsOrganizationIDPhysicalnetworksResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest PhysicalNetworksResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest externalRef0.BadRequestResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest externalRef0.UnauthorizedResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest externalRef0.ForbiddenResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest externalRef0.InternalServerErrorResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse parses an HTTP response from a PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesWithResponse call +func ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse(rsp *http.Response) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest IdentityResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON201 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest externalRef0.BadRequestResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest externalRef0.UnauthorizedResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest externalRef0.ForbiddenResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest externalRef0.InternalServerErrorResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParseDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse parses an HTTP response from a DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDWithResponse call +func ParseDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse(rsp *http.Response) (*DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest externalRef0.BadRequestResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest externalRef0.UnauthorizedResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest externalRef0.ForbiddenResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest externalRef0.NotFoundResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest externalRef0.InternalServerErrorResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse parses an HTTP response from a GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDWithResponse call +func ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse(rsp *http.Response) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest IdentityResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest externalRef0.BadRequestResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest externalRef0.UnauthorizedResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest externalRef0.ForbiddenResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest externalRef0.InternalServerErrorResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse parses an HTTP response from a PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksWithResponse call +func ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse(rsp *http.Response) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest PhysicalNetworkResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON201 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest externalRef0.BadRequestResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest externalRef0.UnauthorizedResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest externalRef0.ForbiddenResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest externalRef0.InternalServerErrorResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + } - return ParsePutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse(rsp) -} -func (c *ClientWithResponses) PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithResponse(ctx context.Context, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, body PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasJSONRequestBody, reqEditors ...RequestEditorFn) (*PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse, error) { - rsp, err := c.PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotas(ctx, organizationID, projectID, identityID, body, reqEditors...) - if err != nil { - return nil, err - } - return ParsePutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse(rsp) + return response, nil } -// GetApiV1OrganizationsOrganizationIDRegionsWithResponse request returning *GetApiV1OrganizationsOrganizationIDRegionsResponse -func (c *ClientWithResponses) GetApiV1OrganizationsOrganizationIDRegionsWithResponse(ctx context.Context, organizationID OrganizationIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDRegionsResponse, error) { - rsp, err := c.GetApiV1OrganizationsOrganizationIDRegions(ctx, organizationID, reqEditors...) +// ParseDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse parses an HTTP response from a DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDWithResponse call +func ParseDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse(rsp *http.Response) (*DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseGetApiV1OrganizationsOrganizationIDRegionsResponse(rsp) -} -// GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksWithResponse request returning *GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksResponse -func (c *ClientWithResponses) GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksWithResponse(ctx context.Context, organizationID OrganizationIDParameter, regionID RegionIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksResponse, error) { - rsp, err := c.GetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworks(ctx, organizationID, regionID, reqEditors...) - if err != nil { - return nil, err + response := &DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse{ + Body: bodyBytes, + HTTPResponse: rsp, } - return ParseGetApiV1OrganizationsOrganizationIDRegionsRegionIDExternalnetworksResponse(rsp) -} -// GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsWithResponse request returning *GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsResponse -func (c *ClientWithResponses) GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsWithResponse(ctx context.Context, organizationID OrganizationIDParameter, regionID RegionIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsResponse, error) { - rsp, err := c.GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavors(ctx, organizationID, regionID, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsResponse(rsp) -} + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest externalRef0.BadRequestResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest externalRef0.UnauthorizedResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest externalRef0.ForbiddenResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest externalRef0.InternalServerErrorResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest -// GetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesWithResponse request returning *GetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesResponse -func (c *ClientWithResponses) GetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesWithResponse(ctx context.Context, organizationID OrganizationIDParameter, regionID RegionIDParameter, reqEditors ...RequestEditorFn) (*GetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesResponse, error) { - rsp, err := c.GetApiV1OrganizationsOrganizationIDRegionsRegionIDImages(ctx, organizationID, regionID, reqEditors...) - if err != nil { - return nil, err } - return ParseGetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesResponse(rsp) + + return response, nil } -// ParseGetApiV1OrganizationsOrganizationIDIdentitiesResponse parses an HTTP response from a GetApiV1OrganizationsOrganizationIDIdentitiesWithResponse call -func ParseGetApiV1OrganizationsOrganizationIDIdentitiesResponse(rsp *http.Response) (*GetApiV1OrganizationsOrganizationIDIdentitiesResponse, error) { +// ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse parses an HTTP response from a GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDWithResponse call +func ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse(rsp *http.Response) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetApiV1OrganizationsOrganizationIDIdentitiesResponse{ + response := &GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest IdentitiesResponse + var dest PhysicalNetworkResponse if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -1652,22 +3089,22 @@ func ParseGetApiV1OrganizationsOrganizationIDIdentitiesResponse(rsp *http.Respon return response, nil } -// ParseGetApiV1OrganizationsOrganizationIDPhysicalnetworksResponse parses an HTTP response from a GetApiV1OrganizationsOrganizationIDPhysicalnetworksWithResponse call -func ParseGetApiV1OrganizationsOrganizationIDPhysicalnetworksResponse(rsp *http.Response) (*GetApiV1OrganizationsOrganizationIDPhysicalnetworksResponse, error) { +// ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse parses an HTTP response from a GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithResponse call +func ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse(rsp *http.Response) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetApiV1OrganizationsOrganizationIDPhysicalnetworksResponse{ + response := &GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest PhysicalNetworksResponse + var dest QuotasResponse if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -1706,22 +3143,69 @@ func ParseGetApiV1OrganizationsOrganizationIDPhysicalnetworksResponse(rsp *http. return response, nil } -// ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse parses an HTTP response from a PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesWithResponse call -func ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse(rsp *http.Response) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse, error) { +// ParsePutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse parses an HTTP response from a PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithResponse call +func ParsePutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse(rsp *http.Response) (*PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesResponse{ + response := &PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest externalRef0.BadRequestResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest externalRef0.UnauthorizedResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest externalRef0.ForbiddenResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest externalRef0.InternalServerErrorResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsResponse parses an HTTP response from a PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsWithResponse call +func ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsResponse(rsp *http.Response) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest IdentityResponse + var dest SecurityGroupResponse if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -1760,15 +3244,15 @@ func ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesRespons return response, nil } -// ParseDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse parses an HTTP response from a DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDWithResponse call -func ParseDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse(rsp *http.Response) (*DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse, error) { +// ParseDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse parses an HTTP response from a DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDWithResponse call +func ParseDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse(rsp *http.Response) (*DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse{ + response := &DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -1795,13 +3279,6 @@ func ParseDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdent } response.JSON403 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest externalRef0.NotFoundResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest externalRef0.InternalServerErrorResponse if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -1814,22 +3291,22 @@ func ParseDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdent return response, nil } -// ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse parses an HTTP response from a GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDWithResponse call -func ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse(rsp *http.Response) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse, error) { +// ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse parses an HTTP response from a GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDWithResponse call +func ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse(rsp *http.Response) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDResponse{ + response := &GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest IdentityResponse + var dest SecurityGroupResponse if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -1868,27 +3345,20 @@ func ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentity return response, nil } -// ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse parses an HTTP response from a PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksWithResponse call -func ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse(rsp *http.Response) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse, error) { +// ParsePutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse parses an HTTP response from a PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDWithResponse call +func ParsePutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse(rsp *http.Response) (*PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksResponse{ + response := &PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest PhysicalNetworkResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest externalRef0.BadRequestResponse if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -1922,20 +3392,27 @@ func ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentit return response, nil } -// ParseDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse parses an HTTP response from a DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDWithResponse call -func ParseDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse(rsp *http.Response) (*DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse, error) { +// ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse parses an HTTP response from a GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesWithResponse call +func ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse(rsp *http.Response) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse{ + response := &GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest SecurityGroupRulesResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest externalRef0.BadRequestResponse if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -1969,26 +3446,26 @@ func ParseDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdent return response, nil } -// ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse parses an HTTP response from a GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDWithResponse call -func ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse(rsp *http.Response) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse, error) { +// ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse parses an HTTP response from a PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesWithResponse call +func ParsePostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse(rsp *http.Response) (*PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPhysicalnetworksPhysicalNetworkIDResponse{ + response := &PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest PhysicalNetworkResponse + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest SecurityGroupRuleResponse if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON200 = &dest + response.JSON201 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest externalRef0.BadRequestResponse @@ -2023,27 +3500,20 @@ func ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentity return response, nil } -// ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse parses an HTTP response from a GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithResponse call -func ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse(rsp *http.Response) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse, error) { +// ParseDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDResponse parses an HTTP response from a DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDWithResponse call +func ParseDeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDResponse(rsp *http.Response) (*DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse{ + response := &DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest QuotasResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest externalRef0.BadRequestResponse if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -2077,20 +3547,27 @@ func ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentity return response, nil } -// ParsePutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse parses an HTTP response from a PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasWithResponse call -func ParsePutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse(rsp *http.Response) (*PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse, error) { +// ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDResponse parses an HTTP response from a GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDWithResponse call +func ParseGetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDResponse(rsp *http.Response) (*GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasResponse{ + response := &GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleIDResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest SecurityGroupRuleResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest externalRef0.BadRequestResponse if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -2311,3 +3788,57 @@ func ParseGetApiV1OrganizationsOrganizationIDRegionsRegionIDImagesResponse(rsp * return response, nil } + +// ParseGetApiV1OrganizationsOrganizationIDSecuritygroupsResponse parses an HTTP response from a GetApiV1OrganizationsOrganizationIDSecuritygroupsWithResponse call +func ParseGetApiV1OrganizationsOrganizationIDSecuritygroupsResponse(rsp *http.Response) (*GetApiV1OrganizationsOrganizationIDSecuritygroupsResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetApiV1OrganizationsOrganizationIDSecuritygroupsResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest SecurityGroupsResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest externalRef0.BadRequestResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest externalRef0.UnauthorizedResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest externalRef0.ForbiddenResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest externalRef0.InternalServerErrorResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} diff --git a/pkg/openapi/router.go b/pkg/openapi/router.go index 78321dc..4505636 100644 --- a/pkg/openapi/router.go +++ b/pkg/openapi/router.go @@ -45,6 +45,30 @@ type ServerInterface interface { // (PUT /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/quotas) PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotas(w http.ResponseWriter, r *http.Request, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter) + // (POST /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups) + PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroups(w http.ResponseWriter, r *http.Request, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter) + + // (DELETE /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}) + DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(w http.ResponseWriter, r *http.Request, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter) + + // (GET /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}) + GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(w http.ResponseWriter, r *http.Request, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter) + + // (PUT /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}) + PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(w http.ResponseWriter, r *http.Request, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter) + + // (GET /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}/rules) + GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules(w http.ResponseWriter, r *http.Request, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter) + + // (POST /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}/rules) + PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules(w http.ResponseWriter, r *http.Request, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter) + + // (DELETE /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}/rules/{ruleID}) + DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID(w http.ResponseWriter, r *http.Request, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, ruleID RuleIDParameter) + + // (GET /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}/rules/{ruleID}) + GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID(w http.ResponseWriter, r *http.Request, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, ruleID RuleIDParameter) + // (GET /api/v1/organizations/{organizationID}/regions) GetApiV1OrganizationsOrganizationIDRegions(w http.ResponseWriter, r *http.Request, organizationID OrganizationIDParameter) @@ -56,6 +80,9 @@ type ServerInterface interface { // (GET /api/v1/organizations/{organizationID}/regions/{regionID}/images) GetApiV1OrganizationsOrganizationIDRegionsRegionIDImages(w http.ResponseWriter, r *http.Request, organizationID OrganizationIDParameter, regionID RegionIDParameter) + + // (GET /api/v1/organizations/{organizationID}/securitygroups) + GetApiV1OrganizationsOrganizationIDSecuritygroups(w http.ResponseWriter, r *http.Request, organizationID OrganizationIDParameter) } // Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. @@ -112,6 +139,46 @@ func (_ Unimplemented) PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdent w.WriteHeader(http.StatusNotImplemented) } +// (POST /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups) +func (_ Unimplemented) PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroups(w http.ResponseWriter, r *http.Request, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter) { + w.WriteHeader(http.StatusNotImplemented) +} + +// (DELETE /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}) +func (_ Unimplemented) DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(w http.ResponseWriter, r *http.Request, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter) { + w.WriteHeader(http.StatusNotImplemented) +} + +// (GET /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}) +func (_ Unimplemented) GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(w http.ResponseWriter, r *http.Request, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter) { + w.WriteHeader(http.StatusNotImplemented) +} + +// (PUT /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}) +func (_ Unimplemented) PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(w http.ResponseWriter, r *http.Request, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter) { + w.WriteHeader(http.StatusNotImplemented) +} + +// (GET /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}/rules) +func (_ Unimplemented) GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules(w http.ResponseWriter, r *http.Request, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter) { + w.WriteHeader(http.StatusNotImplemented) +} + +// (POST /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}/rules) +func (_ Unimplemented) PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules(w http.ResponseWriter, r *http.Request, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter) { + w.WriteHeader(http.StatusNotImplemented) +} + +// (DELETE /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}/rules/{ruleID}) +func (_ Unimplemented) DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID(w http.ResponseWriter, r *http.Request, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, ruleID RuleIDParameter) { + w.WriteHeader(http.StatusNotImplemented) +} + +// (GET /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}/rules/{ruleID}) +func (_ Unimplemented) GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID(w http.ResponseWriter, r *http.Request, organizationID OrganizationIDParameter, projectID ProjectIDParameter, identityID IdentityIDParameter, securityGroupID SecurityGroupIDParameter, ruleID RuleIDParameter) { + w.WriteHeader(http.StatusNotImplemented) +} + // (GET /api/v1/organizations/{organizationID}/regions) func (_ Unimplemented) GetApiV1OrganizationsOrganizationIDRegions(w http.ResponseWriter, r *http.Request, organizationID OrganizationIDParameter) { w.WriteHeader(http.StatusNotImplemented) @@ -132,6 +199,11 @@ func (_ Unimplemented) GetApiV1OrganizationsOrganizationIDRegionsRegionIDImages( w.WriteHeader(http.StatusNotImplemented) } +// (GET /api/v1/organizations/{organizationID}/securitygroups) +func (_ Unimplemented) GetApiV1OrganizationsOrganizationIDSecuritygroups(w http.ResponseWriter, r *http.Request, organizationID OrganizationIDParameter) { + w.WriteHeader(http.StatusNotImplemented) +} + // ServerInterfaceWrapper converts contexts to parameters. type ServerInterfaceWrapper struct { Handler ServerInterface @@ -604,6 +676,479 @@ func (siw *ServerInterfaceWrapper) PutApiV1OrganizationsOrganizationIDProjectsPr handler.ServeHTTP(w, r) } +// PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroups operation middleware +func (siw *ServerInterfaceWrapper) PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroups(w http.ResponseWriter, r *http.Request) { + + var err error + + // ------------- Path parameter "organizationID" ------------- + var organizationID OrganizationIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "organizationID", chi.URLParam(r, "organizationID"), &organizationID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "organizationID", Err: err}) + return + } + + // ------------- Path parameter "projectID" ------------- + var projectID ProjectIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "projectID", chi.URLParam(r, "projectID"), &projectID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "projectID", Err: err}) + return + } + + // ------------- Path parameter "identityID" ------------- + var identityID IdentityIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "identityID", chi.URLParam(r, "identityID"), &identityID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identityID", Err: err}) + return + } + + ctx := r.Context() + + ctx = context.WithValue(ctx, Oauth2AuthenticationScopes, []string{}) + + r = r.WithContext(ctx) + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroups(w, r, organizationID, projectID, identityID) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID operation middleware +func (siw *ServerInterfaceWrapper) DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(w http.ResponseWriter, r *http.Request) { + + var err error + + // ------------- Path parameter "organizationID" ------------- + var organizationID OrganizationIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "organizationID", chi.URLParam(r, "organizationID"), &organizationID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "organizationID", Err: err}) + return + } + + // ------------- Path parameter "projectID" ------------- + var projectID ProjectIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "projectID", chi.URLParam(r, "projectID"), &projectID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "projectID", Err: err}) + return + } + + // ------------- Path parameter "identityID" ------------- + var identityID IdentityIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "identityID", chi.URLParam(r, "identityID"), &identityID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identityID", Err: err}) + return + } + + // ------------- Path parameter "securityGroupID" ------------- + var securityGroupID SecurityGroupIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "securityGroupID", chi.URLParam(r, "securityGroupID"), &securityGroupID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "securityGroupID", Err: err}) + return + } + + ctx := r.Context() + + ctx = context.WithValue(ctx, Oauth2AuthenticationScopes, []string{}) + + r = r.WithContext(ctx) + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(w, r, organizationID, projectID, identityID, securityGroupID) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID operation middleware +func (siw *ServerInterfaceWrapper) GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(w http.ResponseWriter, r *http.Request) { + + var err error + + // ------------- Path parameter "organizationID" ------------- + var organizationID OrganizationIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "organizationID", chi.URLParam(r, "organizationID"), &organizationID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "organizationID", Err: err}) + return + } + + // ------------- Path parameter "projectID" ------------- + var projectID ProjectIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "projectID", chi.URLParam(r, "projectID"), &projectID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "projectID", Err: err}) + return + } + + // ------------- Path parameter "identityID" ------------- + var identityID IdentityIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "identityID", chi.URLParam(r, "identityID"), &identityID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identityID", Err: err}) + return + } + + // ------------- Path parameter "securityGroupID" ------------- + var securityGroupID SecurityGroupIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "securityGroupID", chi.URLParam(r, "securityGroupID"), &securityGroupID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "securityGroupID", Err: err}) + return + } + + ctx := r.Context() + + ctx = context.WithValue(ctx, Oauth2AuthenticationScopes, []string{}) + + r = r.WithContext(ctx) + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(w, r, organizationID, projectID, identityID, securityGroupID) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID operation middleware +func (siw *ServerInterfaceWrapper) PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(w http.ResponseWriter, r *http.Request) { + + var err error + + // ------------- Path parameter "organizationID" ------------- + var organizationID OrganizationIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "organizationID", chi.URLParam(r, "organizationID"), &organizationID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "organizationID", Err: err}) + return + } + + // ------------- Path parameter "projectID" ------------- + var projectID ProjectIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "projectID", chi.URLParam(r, "projectID"), &projectID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "projectID", Err: err}) + return + } + + // ------------- Path parameter "identityID" ------------- + var identityID IdentityIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "identityID", chi.URLParam(r, "identityID"), &identityID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identityID", Err: err}) + return + } + + // ------------- Path parameter "securityGroupID" ------------- + var securityGroupID SecurityGroupIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "securityGroupID", chi.URLParam(r, "securityGroupID"), &securityGroupID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "securityGroupID", Err: err}) + return + } + + ctx := r.Context() + + ctx = context.WithValue(ctx, Oauth2AuthenticationScopes, []string{}) + + r = r.WithContext(ctx) + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID(w, r, organizationID, projectID, identityID, securityGroupID) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules operation middleware +func (siw *ServerInterfaceWrapper) GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules(w http.ResponseWriter, r *http.Request) { + + var err error + + // ------------- Path parameter "organizationID" ------------- + var organizationID OrganizationIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "organizationID", chi.URLParam(r, "organizationID"), &organizationID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "organizationID", Err: err}) + return + } + + // ------------- Path parameter "projectID" ------------- + var projectID ProjectIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "projectID", chi.URLParam(r, "projectID"), &projectID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "projectID", Err: err}) + return + } + + // ------------- Path parameter "identityID" ------------- + var identityID IdentityIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "identityID", chi.URLParam(r, "identityID"), &identityID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identityID", Err: err}) + return + } + + // ------------- Path parameter "securityGroupID" ------------- + var securityGroupID SecurityGroupIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "securityGroupID", chi.URLParam(r, "securityGroupID"), &securityGroupID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "securityGroupID", Err: err}) + return + } + + ctx := r.Context() + + ctx = context.WithValue(ctx, Oauth2AuthenticationScopes, []string{}) + + r = r.WithContext(ctx) + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules(w, r, organizationID, projectID, identityID, securityGroupID) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules operation middleware +func (siw *ServerInterfaceWrapper) PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules(w http.ResponseWriter, r *http.Request) { + + var err error + + // ------------- Path parameter "organizationID" ------------- + var organizationID OrganizationIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "organizationID", chi.URLParam(r, "organizationID"), &organizationID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "organizationID", Err: err}) + return + } + + // ------------- Path parameter "projectID" ------------- + var projectID ProjectIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "projectID", chi.URLParam(r, "projectID"), &projectID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "projectID", Err: err}) + return + } + + // ------------- Path parameter "identityID" ------------- + var identityID IdentityIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "identityID", chi.URLParam(r, "identityID"), &identityID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identityID", Err: err}) + return + } + + // ------------- Path parameter "securityGroupID" ------------- + var securityGroupID SecurityGroupIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "securityGroupID", chi.URLParam(r, "securityGroupID"), &securityGroupID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "securityGroupID", Err: err}) + return + } + + ctx := r.Context() + + ctx = context.WithValue(ctx, Oauth2AuthenticationScopes, []string{}) + + r = r.WithContext(ctx) + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules(w, r, organizationID, projectID, identityID, securityGroupID) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID operation middleware +func (siw *ServerInterfaceWrapper) DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID(w http.ResponseWriter, r *http.Request) { + + var err error + + // ------------- Path parameter "organizationID" ------------- + var organizationID OrganizationIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "organizationID", chi.URLParam(r, "organizationID"), &organizationID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "organizationID", Err: err}) + return + } + + // ------------- Path parameter "projectID" ------------- + var projectID ProjectIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "projectID", chi.URLParam(r, "projectID"), &projectID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "projectID", Err: err}) + return + } + + // ------------- Path parameter "identityID" ------------- + var identityID IdentityIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "identityID", chi.URLParam(r, "identityID"), &identityID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identityID", Err: err}) + return + } + + // ------------- Path parameter "securityGroupID" ------------- + var securityGroupID SecurityGroupIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "securityGroupID", chi.URLParam(r, "securityGroupID"), &securityGroupID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "securityGroupID", Err: err}) + return + } + + // ------------- Path parameter "ruleID" ------------- + var ruleID RuleIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "ruleID", chi.URLParam(r, "ruleID"), &ruleID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "ruleID", Err: err}) + return + } + + ctx := r.Context() + + ctx = context.WithValue(ctx, Oauth2AuthenticationScopes, []string{}) + + r = r.WithContext(ctx) + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID(w, r, organizationID, projectID, identityID, securityGroupID, ruleID) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID operation middleware +func (siw *ServerInterfaceWrapper) GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID(w http.ResponseWriter, r *http.Request) { + + var err error + + // ------------- Path parameter "organizationID" ------------- + var organizationID OrganizationIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "organizationID", chi.URLParam(r, "organizationID"), &organizationID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "organizationID", Err: err}) + return + } + + // ------------- Path parameter "projectID" ------------- + var projectID ProjectIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "projectID", chi.URLParam(r, "projectID"), &projectID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "projectID", Err: err}) + return + } + + // ------------- Path parameter "identityID" ------------- + var identityID IdentityIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "identityID", chi.URLParam(r, "identityID"), &identityID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identityID", Err: err}) + return + } + + // ------------- Path parameter "securityGroupID" ------------- + var securityGroupID SecurityGroupIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "securityGroupID", chi.URLParam(r, "securityGroupID"), &securityGroupID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "securityGroupID", Err: err}) + return + } + + // ------------- Path parameter "ruleID" ------------- + var ruleID RuleIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "ruleID", chi.URLParam(r, "ruleID"), &ruleID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "ruleID", Err: err}) + return + } + + ctx := r.Context() + + ctx = context.WithValue(ctx, Oauth2AuthenticationScopes, []string{}) + + r = r.WithContext(ctx) + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID(w, r, organizationID, projectID, identityID, securityGroupID, ruleID) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + // GetApiV1OrganizationsOrganizationIDRegions operation middleware func (siw *ServerInterfaceWrapper) GetApiV1OrganizationsOrganizationIDRegions(w http.ResponseWriter, r *http.Request) { @@ -755,6 +1300,37 @@ func (siw *ServerInterfaceWrapper) GetApiV1OrganizationsOrganizationIDRegionsReg handler.ServeHTTP(w, r) } +// GetApiV1OrganizationsOrganizationIDSecuritygroups operation middleware +func (siw *ServerInterfaceWrapper) GetApiV1OrganizationsOrganizationIDSecuritygroups(w http.ResponseWriter, r *http.Request) { + + var err error + + // ------------- Path parameter "organizationID" ------------- + var organizationID OrganizationIDParameter + + err = runtime.BindStyledParameterWithOptions("simple", "organizationID", chi.URLParam(r, "organizationID"), &organizationID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "organizationID", Err: err}) + return + } + + ctx := r.Context() + + ctx = context.WithValue(ctx, Oauth2AuthenticationScopes, []string{}) + + r = r.WithContext(ctx) + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetApiV1OrganizationsOrganizationIDSecuritygroups(w, r, organizationID) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + type UnescapedCookieParamError struct { ParamName string Err error @@ -898,6 +1474,30 @@ func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handl r.Group(func(r chi.Router) { r.Put(options.BaseURL+"/api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/quotas", wrapper.PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotas) }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups", wrapper.PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroups) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}", wrapper.DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}", wrapper.GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}", wrapper.PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}/rules", wrapper.GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}/rules", wrapper.PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}/rules/{ruleID}", wrapper.DeleteApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}/rules/{ruleID}", wrapper.GetApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesRuleID) + }) r.Group(func(r chi.Router) { r.Get(options.BaseURL+"/api/v1/organizations/{organizationID}/regions", wrapper.GetApiV1OrganizationsOrganizationIDRegions) }) @@ -910,6 +1510,9 @@ func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handl r.Group(func(r chi.Router) { r.Get(options.BaseURL+"/api/v1/organizations/{organizationID}/regions/{regionID}/images", wrapper.GetApiV1OrganizationsOrganizationIDRegionsRegionIDImages) }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/api/v1/organizations/{organizationID}/securitygroups", wrapper.GetApiV1OrganizationsOrganizationIDSecuritygroups) + }) return r } diff --git a/pkg/openapi/schema.go b/pkg/openapi/schema.go index 452ec2f..8d5f477 100644 --- a/pkg/openapi/schema.go +++ b/pkg/openapi/schema.go @@ -19,112 +19,127 @@ import ( // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "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", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/pkg/openapi/server.spec.yaml b/pkg/openapi/server.spec.yaml index 8a52fa4..ad02e5b 100644 --- a/pkg/openapi/server.spec.yaml +++ b/pkg/openapi/server.spec.yaml @@ -308,6 +308,189 @@ paths: $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/forbiddenResponse' '500': $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/internalServerErrorResponse' + /api/v1/organizations/{organizationID}/securitygroups: + description: |- + Manages security groups. Security group acts as a virtual firewall for instances to control + inbound and outbound traffic. + parameters: + - $ref: '#/components/parameters/organizationIDParameter' + get: + description: List security groups. + security: + - oauth2Authentication: [] + responses: + '200': + $ref: '#/components/responses/securityGroupsResponse' + '400': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/badRequestResponse' + '401': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/unauthorizedResponse' + '403': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/forbiddenResponse' + '500': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/internalServerErrorResponse' + /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups: + description: |- + Manages security groups. Security group acts as a virtual firewall for instances to control + inbound and outbound traffic. + parameters: + - $ref: '#/components/parameters/organizationIDParameter' + - $ref: '#/components/parameters/projectIDParameter' + - $ref: '#/components/parameters/identityIDParameter' + post: + description: Create a new security group. + security: + - oauth2Authentication: [] + requestBody: + $ref: '#/components/requestBodies/securityGroupRequest' + responses: + '201': + $ref: '#/components/responses/securityGroupResponse' + '400': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/badRequestResponse' + '401': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/unauthorizedResponse' + '403': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/forbiddenResponse' + '500': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/internalServerErrorResponse' + /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}: + description: |- + Manages security groups. Security group acts as a virtual firewall for instances to control + inbound and outbound traffic. + parameters: + - $ref: '#/components/parameters/organizationIDParameter' + - $ref: '#/components/parameters/projectIDParameter' + - $ref: '#/components/parameters/identityIDParameter' + - $ref: '#/components/parameters/securityGroupIDParameter' + get: + description: Get a security group. + security: + - oauth2Authentication: [] + responses: + '200': + $ref: '#/components/responses/securityGroupResponse' + '400': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/badRequestResponse' + '401': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/unauthorizedResponse' + '403': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/forbiddenResponse' + '500': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/internalServerErrorResponse' + put: + description: Updates a security group. + security: + - oauth2Authentication: [] + requestBody: + $ref: '#/components/requestBodies/securityGroupRequest' + responses: + '202': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/acceptedResponse' + '400': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/badRequestResponse' + '401': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/unauthorizedResponse' + '403': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/forbiddenResponse' + '500': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/internalServerErrorResponse' + delete: + description: Delete a security group. + security: + - oauth2Authentication: [] + responses: + '202': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/acceptedResponse' + '400': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/badRequestResponse' + '401': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/unauthorizedResponse' + '403': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/forbiddenResponse' + '500': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/internalServerErrorResponse' + /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}/rules: + description: |- + Manages security groups rules. Security group acts as a virtual firewall for instances to control + inbound and outbound traffic. + parameters: + - $ref: '#/components/parameters/organizationIDParameter' + - $ref: '#/components/parameters/projectIDParameter' + - $ref: '#/components/parameters/identityIDParameter' + - $ref: '#/components/parameters/securityGroupIDParameter' + get: + description: List security groups rules. + security: + - oauth2Authentication: [] + responses: + '200': + $ref: '#/components/responses/securityGroupRulesResponse' + '400': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/badRequestResponse' + '401': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/unauthorizedResponse' + '403': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/forbiddenResponse' + '500': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/internalServerErrorResponse' + post: + description: Create a new security group rule. + security: + - oauth2Authentication: [] + requestBody: + $ref: '#/components/requestBodies/securityGroupRuleRequest' + responses: + '201': + $ref: '#/components/responses/securityGroupRuleResponse' + '400': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/badRequestResponse' + '401': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/unauthorizedResponse' + '403': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/forbiddenResponse' + '500': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/internalServerErrorResponse' + /api/v1/organizations/{organizationID}/projects/{projectID}/identities/{identityID}/securitygroups/{securityGroupID}/rules/{ruleID}: + description: |- + Manages security groups rules. Security group acts as a virtual firewall for instances to control + inbound and outbound traffic. + parameters: + - $ref: '#/components/parameters/organizationIDParameter' + - $ref: '#/components/parameters/projectIDParameter' + - $ref: '#/components/parameters/identityIDParameter' + - $ref: '#/components/parameters/securityGroupIDParameter' + - $ref: '#/components/parameters/ruleIDParameter' + get: + description: Get a security group rule. + security: + - oauth2Authentication: [] + responses: + '200': + $ref: '#/components/responses/securityGroupRuleResponse' + '400': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/badRequestResponse' + '401': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/unauthorizedResponse' + '403': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/forbiddenResponse' + '500': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/internalServerErrorResponse' + delete: + description: Delete a security group rule. + security: + - oauth2Authentication: [] + responses: + '202': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/acceptedResponse' + '400': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/badRequestResponse' + '401': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/unauthorizedResponse' + '403': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/forbiddenResponse' + '500': + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/responses/internalServerErrorResponse' components: parameters: organizationIDParameter: @@ -353,6 +536,20 @@ components: required: true schema: $ref: '#/components/schemas/kubernetesNameParameter' + securityGroupIDParameter: + name: securityGroupID + in: path + description: The security group identifier. + required: true + schema: + $ref: '#/components/schemas/kubernetesNameParameter' + ruleIDParameter: + name: ruleID + in: path + description: The security group rule identifier. + required: true + schema: + $ref: '#/components/schemas/kubernetesNameParameter' schemas: kubernetesNameParameter: description: A Kubernetes name. Must be a valid DNS containing only lower case characters, numbers or hyphens, start and end with a character or number, and be at most 63 characters in length. @@ -764,6 +961,148 @@ components: properties: flavors: $ref: '#/components/schemas/flavorQuotaList' + securityGroupRulePort: + description: The port definition to allow traffic. + type: object + properties: + number: + description: The port to allow. + type: integer + range: + $ref: '#/components/schemas/securityGroupRulePortRange' + securityGroupRulePortRange: + description: The port range to allow traffic. + type: object + required: + - start + - end + properties: + start: + description: The start of the port range. + type: integer + end: + description: The end of the port range. + type: integer + securityGroupRuleWriteSpec: + description: A security group rule's specification. + type: object + required: + - direction + - protocol + - port + - cidr + properties: + direction: + description: The direction of the rule. + type: string + enum: + - ingress + - egress + protocol: + description: The protocol to allow. + type: string + enum: + - tcp + - udp + port: + $ref: '#/components/schemas/securityGroupRulePort' + cidr: + $ref: '#/components/schemas/ipv4Address' + securityGroupRuleWrite: + description: A security group rule request. + type: object + required: + - metadata + - spec + properties: + metadata: + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/schemas/resourceWriteMetadata' + spec: + $ref: '#/components/schemas/securityGroupRuleWriteSpec' + securityGroupRuleReadSpec: + description: A security group rule's specification. + type: object + required: + - direction + - protocol + - port + - cidr + properties: + direction: + description: The direction of the rule. + type: string + enum: + - ingress + - egress + protocol: + description: The protocol to allow. + type: string + enum: + - tcp + - udp + port: + $ref: '#/components/schemas/securityGroupRulePort' + cidr: + $ref: '#/components/schemas/ipv4Address' + securityGroupRuleRead: + description: A security group rule. + type: object + required: + - metadata + - spec + properties: + metadata: + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/schemas/projectScopedResourceReadMetadata' + spec: + $ref: '#/components/schemas/securityGroupRuleReadSpec' + securityGroupRulesRead: + description: A list of security group rules. + type: array + items: + $ref: '#/components/schemas/securityGroupRuleRead' + securityGroupWriteSpec: + description: A security group's specification. + type: object + properties: + tags: + $ref: '#/components/schemas/tagList' + securityGroupReadSpec: + description: A security group's specification. + type: object + required: + - regionId + properties: + tags: + $ref: '#/components/schemas/tagList' + regionId: + description: The region an identity is provisioned in. + type: string + securityGroupWrite: + description: A security group request. + type: object + required: + - metadata + properties: + metadata: + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/schemas/resourceWriteMetadata' + spec: + $ref: '#/components/schemas/securityGroupWriteSpec' + securityGroupRead: + description: A security group. + type: object + required: + - metadata + - spec + properties: + metadata: + $ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/schemas/projectScopedResourceReadMetadata' + spec: + $ref: '#/components/schemas/securityGroupReadSpec' + securityGroupsRead: + description: A list of security groups. + type: array + items: + $ref: '#/components/schemas/securityGroupRead' requestBodies: identityRequest: description: A request for an identity. @@ -808,6 +1147,36 @@ components: flavors: - id: 9a8c6370-4065-4d4a-9da0-7678df40cd9d count: 8 + securityGroupRequest: + description: A request for a security group. + content: + application/json: + schema: + $ref: '#/components/schemas/securityGroupWrite' + example: + metadata: + name: security-group-name + description: A verbose description + spec: + tags: + - name: cluster-id + value: 9361402c-f998-49cc-ab21-9bb99afcfde8 + securityGroupRuleRequest: + description: A request for a security group rule. + content: + application/json: + schema: + $ref: '#/components/schemas/securityGroupRuleWrite' + example: + metadata: + name: security-group-rule-name + description: A verbose description + spec: + direction: ingress + protocol: tcp + port: + number: 80 + cidr: 172.16.0.0/12 responses: regionsResponse: description: A list of regions. @@ -985,6 +1354,100 @@ components: flavors: - id: 9a8c6370-4065-4d4a-9da0-7678df40cd9d count: 8 + securityGroupResponse: + description: A security group. + content: + application/json: + schema: + $ref: '#/components/schemas/securityGroupRead' + example: + metadata: + id: a64f9269-36e0-4312-b8d1-52d93d569b7b + name: unused + organizationId: 9a8c6370-4065-4d4a-9da0-7678df40cd9d + projectId: e36c058a-8eba-4f5b-91f4-f6ffb983795c + creationTime: 2024-05-31T14:11:00Z + createdBy: john.doe@acme.com + provisioningStatus: provisioned + spec: + regionId: d891dbf0-0a01-4efc-ae3a-5d77f6d3424b + securityGroupsResponse: + description: A list of security groups. + content: + application/json: + schema: + $ref: '#/components/schemas/securityGroupsRead' + example: + - metadata: + id: a64f9269-36e0-4312-b8d1-52d93d569b7b + name: unused + organizationId: 9a8c6370-4065-4d4a-9da0-7678df40cd9d + projectId: e36c058a-8eba-4f5b-91f4-f6ffb983795c + creationTime: 2024-05-31T14:11:00Z + createdBy: john.doe@acme.com + provisioningStatus: provisioned + spec: + regionId: d891dbf0-0a01-4efc-ae3a-5d77f6d3424b + securityGroupRuleResponse: + description: A security group rule. + content: + application/json: + schema: + $ref: '#/components/schemas/securityGroupRuleRead' + example: + metadata: + id: a64f9269-36e0-4312-b8d1-52d93d569b7b + name: sg-name + organizationId: 9a8c6370-4065-4d4a-9da0-7678df40cd9d + projectId: e36c058a-8eba-4f5b-91f4-f6ffb983795c + creationTime: 2024-05-31T14:11:00Z + createdBy: john.doe@acme.com + provisioningStatus: provisioned + spec: + direction: ingress + protocol: tcp + port: + range: + start: 1066 + end: 1999 + cidr: 172.16.0.0/12 + securityGroupRulesResponse: + description: A list of security group rules. + content: + application/json: + schema: + $ref: '#/components/schemas/securityGroupRulesRead' + example: + - metadata: + id: a64f9269-36e0-4312-b8d1-52d93d569b7b + name: sg-name + organizationId: 9a8c6370-4065-4d4a-9da0-7678df40cd9d + projectId: e36c058a-8eba-4f5b-91f4-f6ffb983795c + creationTime: 2024-05-31T14:11:00Z + createdBy: john.doe@acme.com + provisioningStatus: provisioned + spec: + direction: ingress + protocol: tcp + port: + range: + start: 1066 + end: 1999 + cidr: 172.16.0.0/12 + - metadata: + id: a64f9269-36e0-4312-b8d1-52d93d569b7d + name: sg-name + organizationId: 9a8c6370-4065-4d4a-9da0-7678df40cd9d + projectId: e36c058a-8eba-4f5b-91f4-f6ffb983795c + creationTime: 2024-05-31T14:11:00Z + createdBy: john.doe@acme.com + provisioningStatus: provisioned + spec: + direction: ingress + protocol: tcp + port: + number: 80 + cidr: 0.0.0.0/0 securitySchemes: oauth2Authentication: description: Operation requires OAuth2 bearer token authentication. diff --git a/pkg/openapi/types.go b/pkg/openapi/types.go index 3c5f44c..1147854 100644 --- a/pkg/openapi/types.go +++ b/pkg/openapi/types.go @@ -29,6 +29,30 @@ const ( Openstack RegionType = "openstack" ) +// Defines values for SecurityGroupRuleReadSpecDirection. +const ( + SecurityGroupRuleReadSpecDirectionEgress SecurityGroupRuleReadSpecDirection = "egress" + SecurityGroupRuleReadSpecDirectionIngress SecurityGroupRuleReadSpecDirection = "ingress" +) + +// Defines values for SecurityGroupRuleReadSpecProtocol. +const ( + SecurityGroupRuleReadSpecProtocolTcp SecurityGroupRuleReadSpecProtocol = "tcp" + SecurityGroupRuleReadSpecProtocolUdp SecurityGroupRuleReadSpecProtocol = "udp" +) + +// Defines values for SecurityGroupRuleWriteSpecDirection. +const ( + SecurityGroupRuleWriteSpecDirectionEgress SecurityGroupRuleWriteSpecDirection = "egress" + SecurityGroupRuleWriteSpecDirectionIngress SecurityGroupRuleWriteSpecDirection = "ingress" +) + +// Defines values for SecurityGroupRuleWriteSpecProtocol. +const ( + SecurityGroupRuleWriteSpecProtocolTcp SecurityGroupRuleWriteSpecProtocol = "tcp" + SecurityGroupRuleWriteSpecProtocolUdp SecurityGroupRuleWriteSpecProtocol = "udp" +) + // ExternalNetwork An Openstack external network. type ExternalNetwork struct { // Id The resource ID. @@ -341,6 +365,121 @@ type RegionType string // Regions A list of regions. type Regions = []RegionRead +// SecurityGroupRead A security group. +type SecurityGroupRead struct { + Metadata externalRef0.ProjectScopedResourceReadMetadata `json:"metadata"` + + // Spec A security group's specification. + Spec SecurityGroupReadSpec `json:"spec"` +} + +// SecurityGroupReadSpec A security group's specification. +type SecurityGroupReadSpec struct { + // RegionId The region an identity is provisioned in. + RegionId string `json:"regionId"` + + // Tags A list of tags. + Tags *TagList `json:"tags,omitempty"` +} + +// SecurityGroupRulePort The port definition to allow traffic. +type SecurityGroupRulePort struct { + // Number The port to allow. + Number *int `json:"number,omitempty"` + + // Range The port range to allow traffic. + Range *SecurityGroupRulePortRange `json:"range,omitempty"` +} + +// SecurityGroupRulePortRange The port range to allow traffic. +type SecurityGroupRulePortRange struct { + // End The end of the port range. + End int `json:"end"` + + // Start The start of the port range. + Start int `json:"start"` +} + +// SecurityGroupRuleRead A security group rule. +type SecurityGroupRuleRead struct { + Metadata externalRef0.ProjectScopedResourceReadMetadata `json:"metadata"` + + // Spec A security group rule's specification. + Spec SecurityGroupRuleReadSpec `json:"spec"` +} + +// SecurityGroupRuleReadSpec A security group rule's specification. +type SecurityGroupRuleReadSpec struct { + // Cidr An IPv4 address. + Cidr Ipv4Address `json:"cidr"` + + // Direction The direction of the rule. + Direction SecurityGroupRuleReadSpecDirection `json:"direction"` + + // Port The port definition to allow traffic. + Port SecurityGroupRulePort `json:"port"` + + // Protocol The protocol to allow. + Protocol SecurityGroupRuleReadSpecProtocol `json:"protocol"` +} + +// SecurityGroupRuleReadSpecDirection The direction of the rule. +type SecurityGroupRuleReadSpecDirection string + +// SecurityGroupRuleReadSpecProtocol The protocol to allow. +type SecurityGroupRuleReadSpecProtocol string + +// SecurityGroupRuleWrite A security group rule request. +type SecurityGroupRuleWrite struct { + // Metadata Resource metadata valid for all API resource reads and writes. + Metadata externalRef0.ResourceWriteMetadata `json:"metadata"` + + // Spec A security group rule's specification. + Spec SecurityGroupRuleWriteSpec `json:"spec"` +} + +// SecurityGroupRuleWriteSpec A security group rule's specification. +type SecurityGroupRuleWriteSpec struct { + // Cidr An IPv4 address. + Cidr Ipv4Address `json:"cidr"` + + // Direction The direction of the rule. + Direction SecurityGroupRuleWriteSpecDirection `json:"direction"` + + // Port The port definition to allow traffic. + Port SecurityGroupRulePort `json:"port"` + + // Protocol The protocol to allow. + Protocol SecurityGroupRuleWriteSpecProtocol `json:"protocol"` +} + +// SecurityGroupRuleWriteSpecDirection The direction of the rule. +type SecurityGroupRuleWriteSpecDirection string + +// SecurityGroupRuleWriteSpecProtocol The protocol to allow. +type SecurityGroupRuleWriteSpecProtocol string + +// SecurityGroupRulesRead A list of security group rules. +type SecurityGroupRulesRead = []SecurityGroupRuleRead + +// SecurityGroupWrite A security group request. +type SecurityGroupWrite struct { + // Metadata Resource metadata valid for all API resource reads and writes. + Metadata externalRef0.ResourceWriteMetadata `json:"metadata"` + + // Spec A security group's specification. + Spec *SecurityGroupWriteSpec `json:"spec,omitempty"` +} + +// SecurityGroupWriteSpec A security group's specification. +type SecurityGroupWriteSpec struct { + // Tags A list of tags. + Tags *TagList `json:"tags,omitempty"` +} + +// SecurityGroupsRead A list of security groups. +type SecurityGroupsRead = []SecurityGroupRead + // SoftwareVersions Image preinstalled version version metadata. type SoftwareVersions struct { // Kubernetes A semantic version. @@ -374,6 +513,12 @@ type ProjectIDParameter = KubernetesNameParameter // RegionIDParameter A Kubernetes name. Must be a valid DNS containing only lower case characters, numbers or hyphens, start and end with a character or number, and be at most 63 characters in length. type RegionIDParameter = KubernetesNameParameter +// RuleIDParameter A Kubernetes name. Must be a valid DNS containing only lower case characters, numbers or hyphens, start and end with a character or number, and be at most 63 characters in length. +type RuleIDParameter = KubernetesNameParameter + +// SecurityGroupIDParameter A Kubernetes name. Must be a valid DNS containing only lower case characters, numbers or hyphens, start and end with a character or number, and be at most 63 characters in length. +type SecurityGroupIDParameter = KubernetesNameParameter + // ExternalNetworksResponse A list of openstack external networks. type ExternalNetworksResponse = ExternalNetworks @@ -401,6 +546,18 @@ type QuotasResponse = QuotasSpec // RegionsResponse A list of regions. type RegionsResponse = Regions +// SecurityGroupResponse A security group. +type SecurityGroupResponse = SecurityGroupRead + +// SecurityGroupRuleResponse A security group rule. +type SecurityGroupRuleResponse = SecurityGroupRuleRead + +// SecurityGroupRulesResponse A list of security group rules. +type SecurityGroupRulesResponse = SecurityGroupRulesRead + +// SecurityGroupsResponse A list of security groups. +type SecurityGroupsResponse = SecurityGroupsRead + // IdentityRequest An identity request. type IdentityRequest = IdentityWrite @@ -410,6 +567,12 @@ type PhysicalNetworkRequest = PhysicalNetworkWrite // QuotasRequest defines model for quotasRequest. type QuotasRequest = QuotasSpec +// SecurityGroupRequest A security group request. +type SecurityGroupRequest = SecurityGroupWrite + +// SecurityGroupRuleRequest A security group rule request. +type SecurityGroupRuleRequest = SecurityGroupRuleWrite + // PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesJSONRequestBody defines body for PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentities for application/json ContentType. type PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesJSONRequestBody = IdentityWrite @@ -418,3 +581,12 @@ type PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDPh // PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasJSONRequestBody defines body for PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotas for application/json ContentType. type PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDQuotasJSONRequestBody = QuotasSpec + +// PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsJSONRequestBody defines body for PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroups for application/json ContentType. +type PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsJSONRequestBody = SecurityGroupWrite + +// PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDJSONRequestBody defines body for PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupID for application/json ContentType. +type PutApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDJSONRequestBody = SecurityGroupWrite + +// PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesJSONRequestBody defines body for PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRules for application/json ContentType. +type PostApiV1OrganizationsOrganizationIDProjectsProjectIDIdentitiesIdentityIDSecuritygroupsSecurityGroupIDRulesJSONRequestBody = SecurityGroupRuleWrite diff --git a/pkg/providers/interfaces.go b/pkg/providers/interfaces.go index 42fbbe4..1e831f2 100644 --- a/pkg/providers/interfaces.go +++ b/pkg/providers/interfaces.go @@ -43,4 +43,12 @@ type Provider interface { // ListExternalNetworks returns a list of external networks if the platform // supports such a concept. ListExternalNetworks(ctx context.Context) (ExternalNetworks, error) + // CreateSecurityGroup creates a new security group. + CreateSecurityGroup(ctx context.Context, identity *unikornv1.Identity, securityGroup *unikornv1.SecurityGroup) error + // DeleteSecurityGroup deletes a security group. + DeleteSecurityGroup(ctx context.Context, identity *unikornv1.Identity, securityGroup *unikornv1.SecurityGroup) error + // CreateSecurityGroupRule creates a new security group rule. + CreateSecurityGroupRule(ctx context.Context, identity *unikornv1.Identity, securityGroup *unikornv1.SecurityGroup, rule *unikornv1.SecurityGroupRule) error + // DeleteSecurityGroupRule deletes a security group rule. + DeleteSecurityGroupRule(ctx context.Context, identity *unikornv1.Identity, securityGroup *unikornv1.SecurityGroup, rule *unikornv1.SecurityGroupRule) error } diff --git a/pkg/providers/openstack/network.go b/pkg/providers/openstack/network.go index 48a416c..c315313 100644 --- a/pkg/providers/openstack/network.go +++ b/pkg/providers/openstack/network.go @@ -29,11 +29,14 @@ import ( "github.com/gophercloud/gophercloud/v2/openstack/networking/v2/extensions/external" "github.com/gophercloud/gophercloud/v2/openstack/networking/v2/extensions/layer3/routers" "github.com/gophercloud/gophercloud/v2/openstack/networking/v2/extensions/provider" + "github.com/gophercloud/gophercloud/v2/openstack/networking/v2/extensions/security/groups" + "github.com/gophercloud/gophercloud/v2/openstack/networking/v2/extensions/security/rules" "github.com/gophercloud/gophercloud/v2/openstack/networking/v2/networks" "github.com/gophercloud/gophercloud/v2/openstack/networking/v2/subnets" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/trace" + unikornv1core "github.com/unikorn-cloud/core/pkg/apis/unikorn/v1alpha1" "github.com/unikorn-cloud/core/pkg/util/cache" unikornv1 "github.com/unikorn-cloud/region/pkg/apis/unikorn/v1alpha1" "github.com/unikorn-cloud/region/pkg/constants" @@ -294,3 +297,69 @@ func (c *NetworkClient) RemoveRouterInterface(ctx context.Context, routerID, sub return routers.RemoveInterface(ctx, c.client, routerID, opts).Err } + +// CreateSecurityGroup creates a new security group. +func (c *NetworkClient) CreateSecurityGroup(ctx context.Context, name string) (*groups.SecGroup, error) { + tracer := otel.GetTracerProvider().Tracer(constants.Application) + + _, span := tracer.Start(ctx, "POST /network/v2.0/securitygroups", trace.WithSpanKind(trace.SpanKindClient)) + defer span.End() + + opts := &groups.CreateOpts{ + Name: name, + Description: "unikorn managed security group", + } + + securityGroup, err := groups.Create(ctx, c.client, opts).Extract() + if err != nil { + return nil, err + } + + return securityGroup, nil +} + +// DeleteSecurityGroup deletes a security group. +func (c *NetworkClient) DeleteSecurityGroup(ctx context.Context, securityGroupID string) error { + tracer := otel.GetTracerProvider().Tracer(constants.Application) + + _, span := tracer.Start(ctx, fmt.Sprintf("DELETE /network/v2.0/securitygroups/%s", securityGroupID), trace.WithSpanKind(trace.SpanKindClient)) + defer span.End() + + return groups.Delete(ctx, c.client, securityGroupID).Err +} + +// CreateSecurityGroupRule adds a security group rule to a security group. +func (c *NetworkClient) CreateSecurityGroupRule(ctx context.Context, securityGroupID string, direction rules.RuleDirection, protocol rules.RuleProtocol, portStart, portEnd int, cidr *unikornv1core.IPv4Prefix) (*rules.SecGroupRule, error) { + tracer := otel.GetTracerProvider().Tracer(constants.Application) + + _, span := tracer.Start(ctx, fmt.Sprintf("POST /network/v2.0/securitygroups/%s/rules", securityGroupID), trace.WithSpanKind(trace.SpanKindClient)) + defer span.End() + + opts := &rules.CreateOpts{ + Description: "unikorn managed security group rule", + Direction: direction, + EtherType: rules.EtherType4, + PortRangeMin: portStart, + PortRangeMax: portEnd, + Protocol: protocol, + SecGroupID: securityGroupID, + RemoteIPPrefix: cidr.String(), + } + + rule, err := rules.Create(ctx, c.client, opts).Extract() + if err != nil { + return nil, err + } + + return rule, nil +} + +// DeleteSecurityGroupRule deletes a security group rule from a security group. +func (c *NetworkClient) DeleteSecurityGroupRule(ctx context.Context, securityGroupID, ruleID string) error { + tracer := otel.GetTracerProvider().Tracer(constants.Application) + + _, span := tracer.Start(ctx, fmt.Sprintf("DELETE /network/v2.0/securitygroups/%s/rules/%s", securityGroupID, ruleID), trace.WithSpanKind(trace.SpanKindClient)) + defer span.End() + + return rules.Delete(ctx, c.client, ruleID).Err +} diff --git a/pkg/providers/openstack/provider.go b/pkg/providers/openstack/provider.go index 20aca23..76153c3 100644 --- a/pkg/providers/openstack/provider.go +++ b/pkg/providers/openstack/provider.go @@ -26,6 +26,7 @@ import ( "sync" "github.com/gophercloud/gophercloud/v2/openstack/identity/v3/roles" + "github.com/gophercloud/gophercloud/v2/openstack/networking/v2/extensions/security/rules" "github.com/gophercloud/utils/openstack/clientconfig" coreconstants "github.com/unikorn-cloud/core/pkg/constants" @@ -1144,3 +1145,353 @@ func (p *Provider) ListExternalNetworks(ctx context.Context) (providers.External return out, nil } + +func (p *Provider) GetOpenstackSecurityGroup(ctx context.Context, securityGroup *unikornv1.SecurityGroup) (*unikornv1.OpenstackSecurityGroup, error) { + var result unikornv1.OpenstackSecurityGroup + + if err := p.client.Get(ctx, client.ObjectKey{Namespace: securityGroup.Namespace, Name: securityGroup.Name}, &result); err != nil { + return nil, err + } + + return &result, nil +} + +func (p *Provider) GetOrCreateOpenstackSecurityGroup(ctx context.Context, identity *unikornv1.Identity, securityGroup *unikornv1.SecurityGroup) (*unikornv1.OpenstackSecurityGroup, bool, error) { + create := false + + openstackSecurityGroup, err := p.GetOpenstackSecurityGroup(ctx, securityGroup) + if err != nil { + if !kerrors.IsNotFound(err) { + return nil, false, err + } + + openstackSecurityGroup = &unikornv1.OpenstackSecurityGroup{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: securityGroup.Namespace, + Name: securityGroup.Name, + Labels: map[string]string{ + constants.IdentityLabel: identity.Name, + constants.SecurityGroupLabel: securityGroup.Name, + }, + Annotations: securityGroup.Annotations, + }, + } + + for k, v := range securityGroup.Labels { + openstackSecurityGroup.Labels[k] = v + } + + create = true + } + + return openstackSecurityGroup, create, nil +} + +func (p *Provider) createSecurityGroup(ctx context.Context, networkService *NetworkClient, securityGroup *unikornv1.OpenstackSecurityGroup) error { + if securityGroup.Spec.SecurityGroupID != nil { + return nil + } + + providerSecurityGroup, err := networkService.CreateSecurityGroup(ctx, securityGroup.Name) + if err != nil { + return err + } + + securityGroup.Spec.SecurityGroupID = &providerSecurityGroup.ID + + return nil +} + +// CreateSecurityGroup creates a new security group. +func (p *Provider) CreateSecurityGroup(ctx context.Context, identity *unikornv1.Identity, securityGroup *unikornv1.SecurityGroup) error { + openstackIdentity, err := p.GetOpenstackIdentity(ctx, identity) + if err != nil { + return err + } + + openstackSecurityGroup, create, err := p.GetOrCreateOpenstackSecurityGroup(ctx, identity, securityGroup) + if err != nil { + return err + } + + // Always attempt to record where we are up to for idempotency. + record := func() { + log := log.FromContext(ctx) + + if create { + if err := p.client.Create(ctx, openstackSecurityGroup); err != nil { + log.Error(err, "failed to create openstack security group") + } + + return + } + + if err := p.client.Update(ctx, openstackSecurityGroup); err != nil { + log.Error(err, "failed to update openstack security group") + } + } + + defer record() + + // Rescope to the project... + providerClient := NewPasswordProvider(p.region.Spec.Openstack.Endpoint, p.credentials.userID, p.credentials.password, *openstackIdentity.Spec.ProjectID) + + networkService, err := NewNetworkClient(ctx, providerClient, p.region.Spec.Openstack.Network) + if err != nil { + return err + } + + if err := p.createSecurityGroup(ctx, networkService, openstackSecurityGroup); err != nil { + return err + } + + return nil +} + +// DeleteSecurityGroup deletes a security group. +func (p *Provider) DeleteSecurityGroup(ctx context.Context, identity *unikornv1.Identity, securityGroup *unikornv1.SecurityGroup) error { + openstackIdentity, err := p.GetOpenstackIdentity(ctx, identity) + if err != nil { + return err + } + + openstackSecurityGroup, err := p.GetOpenstackSecurityGroup(ctx, securityGroup) + if err != nil { + if !kerrors.IsNotFound(err) { + return err + } + + return nil + } + + complete := false + + // Always attempt to record where we are up to for idempotency. + record := func() { + if complete { + return + } + + log := log.FromContext(ctx) + + if err := p.client.Update(ctx, openstackSecurityGroup); err != nil { + log.Error(err, "failed to update openstack security group") + } + } + + defer record() + + // Rescope to the project... + providerClient := NewPasswordProvider(p.region.Spec.Openstack.Endpoint, p.credentials.userID, p.credentials.password, *openstackIdentity.Spec.ProjectID) + + networkService, err := NewNetworkClient(ctx, providerClient, p.region.Spec.Openstack.Network) + if err != nil { + return err + } + + if openstackSecurityGroup.Spec.SecurityGroupID != nil { + if err := networkService.DeleteSecurityGroup(ctx, *openstackSecurityGroup.Spec.SecurityGroupID); err != nil { + return err + } + + openstackSecurityGroup.Spec.SecurityGroupID = nil + } + + if err := p.client.Delete(ctx, openstackSecurityGroup); err != nil { + return err + } + + complete = true + + return nil +} + +func (p *Provider) GetOpenstackSecurityGroupRule(ctx context.Context, securityGroupRule *unikornv1.SecurityGroupRule) (*unikornv1.OpenstackSecurityGroupRule, error) { + var result unikornv1.OpenstackSecurityGroupRule + + if err := p.client.Get(ctx, client.ObjectKey{Namespace: securityGroupRule.Namespace, Name: securityGroupRule.Name}, &result); err != nil { + return nil, err + } + + return &result, nil +} + +func (p *Provider) GetOrCreateOpenstackSecurityGroupRule(ctx context.Context, identity *unikornv1.Identity, securityGroup *unikornv1.SecurityGroup, rule *unikornv1.SecurityGroupRule) (*unikornv1.OpenstackSecurityGroupRule, bool, error) { + create := false + + openstackSecurityGroupRule, err := p.GetOpenstackSecurityGroupRule(ctx, rule) + if err != nil { + if !kerrors.IsNotFound(err) { + return nil, false, err + } + + openstackSecurityGroupRule = &unikornv1.OpenstackSecurityGroupRule{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: rule.Namespace, + Name: rule.Name, + Labels: map[string]string{ + constants.IdentityLabel: identity.Name, + constants.SecurityGroupLabel: securityGroup.Name, + }, + Annotations: rule.Annotations, + }, + } + + for k, v := range rule.Labels { + openstackSecurityGroupRule.Labels[k] = v + } + + create = true + } + + return openstackSecurityGroupRule, create, nil +} + +func (p *Provider) createSecurityGroupRule(ctx context.Context, networkService *NetworkClient, rule *unikornv1.SecurityGroupRule, openstackRule *unikornv1.OpenstackSecurityGroupRule, openstackSecurityGroup *unikornv1.OpenstackSecurityGroup) error { + if openstackRule.Spec.SecurityGroupRuleID != nil { + return nil + } + + // Helper function to map port range + mapPortRange := func() (int, int, error) { + if rule.Spec.Port.Number != nil { + return *rule.Spec.Port.Number, *rule.Spec.Port.Number, nil + } + if rule.Spec.Port.Range != nil { + return rule.Spec.Port.Range.Start, rule.Spec.Port.Range.End, nil + } + + return 0, 0, fmt.Errorf("%w: at least one of number or range must be defined for security rule %s", ErrKeyUndefined, rule.Name) + } + + direction := rules.RuleDirection(*rule.Spec.Direction) + protocol := rules.RuleProtocol(*rule.Spec.Protocol) + securityGroupId := *openstackSecurityGroup.Spec.SecurityGroupID + portStart, portEnd, err := mapPortRange() + if err != nil { + return err + } + + providerRule, err := networkService.CreateSecurityGroupRule(ctx, securityGroupId, direction, protocol, portStart, portEnd, rule.Spec.CIDR) + if err != nil { + return err + } + + openstackRule.Spec.SecurityGroupRuleID = &providerRule.ID + + return nil +} + +// CreateSecurityGroupRule creates a new security group rule. +func (p *Provider) CreateSecurityGroupRule(ctx context.Context, identity *unikornv1.Identity, securityGroup *unikornv1.SecurityGroup, rule *unikornv1.SecurityGroupRule) error { + openstackIdentity, err := p.GetOpenstackIdentity(ctx, identity) + if err != nil { + return err + } + + openstackSecurityGroupRule, create, err := p.GetOrCreateOpenstackSecurityGroupRule(ctx, identity, securityGroup, rule) + if err != nil { + return err + } + + // Always attempt to record where we are up to for idempotency. + record := func() { + log := log.FromContext(ctx) + + if create { + if err := p.client.Create(ctx, openstackSecurityGroupRule); err != nil { + log.Error(err, "failed to create openstack security group rule") + } + + return + } + + if err := p.client.Update(ctx, openstackSecurityGroupRule); err != nil { + log.Error(err, "failed to update openstack security group rule") + } + } + + defer record() + + // Rescope to the project... + providerClient := NewPasswordProvider(p.region.Spec.Openstack.Endpoint, p.credentials.userID, p.credentials.password, *openstackIdentity.Spec.ProjectID) + + networkService, err := NewNetworkClient(ctx, providerClient, p.region.Spec.Openstack.Network) + if err != nil { + return err + } + + openstackSecurityGroup, err := p.GetOpenstackSecurityGroup(ctx, securityGroup) + if err != nil { + return err + } + + if err := p.createSecurityGroupRule(ctx, networkService, rule, openstackSecurityGroupRule, openstackSecurityGroup); err != nil { + return err + } + + return nil +} + +// DeleteSecurityGroupRule deletes a security group rule. +func (p *Provider) DeleteSecurityGroupRule(ctx context.Context, identity *unikornv1.Identity, securityGroup *unikornv1.SecurityGroup, rule *unikornv1.SecurityGroupRule) error { + openstackIdentity, err := p.GetOpenstackIdentity(ctx, identity) + if err != nil { + return err + } + + openstackSecurityGroup, err := p.GetOpenstackSecurityGroup(ctx, securityGroup) + if err != nil { + return err + } + + openstackSecurityGroupRule, err := p.GetOpenstackSecurityGroupRule(ctx, rule) + if err != nil { + if !kerrors.IsNotFound(err) { + return err + } + + return nil + } + + complete := false + + // Always attempt to record where we are up to for idempotency. + record := func() { + if complete { + return + } + + log := log.FromContext(ctx) + + if err := p.client.Update(ctx, openstackSecurityGroupRule); err != nil { + log.Error(err, "failed to update openstack security group rule") + } + } + + defer record() + + // Rescope to the project... + providerClient := NewPasswordProvider(p.region.Spec.Openstack.Endpoint, p.credentials.userID, p.credentials.password, *openstackIdentity.Spec.ProjectID) + + networkService, err := NewNetworkClient(ctx, providerClient, p.region.Spec.Openstack.Network) + if err != nil { + return err + } + + if openstackSecurityGroupRule.Spec.SecurityGroupRuleID != nil { + if err := networkService.DeleteSecurityGroupRule(ctx, *openstackSecurityGroup.Spec.SecurityGroupID, *openstackSecurityGroupRule.Spec.SecurityGroupRuleID); err != nil { + return err + } + + openstackSecurityGroupRule.Spec.SecurityGroupRuleID = nil + } + + if err := p.client.Delete(ctx, openstackSecurityGroupRule); err != nil { + return err + } + + complete = true + + return nil +} diff --git a/pkg/provisioners/managers/identity/provisioner.go b/pkg/provisioners/managers/identity/provisioner.go index db0e7da..a8c67bf 100644 --- a/pkg/provisioners/managers/identity/provisioner.go +++ b/pkg/provisioners/managers/identity/provisioner.go @@ -77,7 +77,6 @@ func (p *Provisioner) Provision(ctx context.Context) error { // Deprovision implements the Provision interface. func (p *Provisioner) Deprovision(ctx context.Context) error { - log := log.FromContext(ctx) cli, err := coreclient.ProvisionerClientFromContext(ctx) if err != nil { @@ -94,6 +93,29 @@ func (p *Provisioner) Deprovision(ctx context.Context) error { // Block identity deletion until all owned resources are deleted, we cannot guarantee // the underlying cloud implementation will not just orphan them and leak resources. + if err := p.triggerSecurityGroupDeletion(ctx, cli, selector); err != nil { + return err + } + + if err := p.triggerPhysicalNetworkDeletion(ctx, cli, selector); err != nil { + return err + } + + provider, err := region.NewClient(cli, p.identity.Namespace).Provider(ctx, p.identity.Labels[constants.RegionLabel]) + if err != nil { + return err + } + + if err := provider.DeleteIdentity(ctx, p.identity); err != nil { + return err + } + + return nil +} + +func (p *Provisioner) triggerPhysicalNetworkDeletion(ctx context.Context, cli client.Client, selector labels.Selector) error { + log := log.FromContext(ctx) + var physicalNetworks unikornv1.PhysicalNetworkList if err := cli.List(ctx, &physicalNetworks, &client.ListOptions{Namespace: p.identity.Namespace, LabelSelector: selector}); err != nil { @@ -119,13 +141,35 @@ func (p *Provisioner) Deprovision(ctx context.Context) error { return provisioners.ErrYield } - provider, err := region.NewClient(cli, p.identity.Namespace).Provider(ctx, p.identity.Labels[constants.RegionLabel]) - if err != nil { + return nil +} + +func (p *Provisioner) triggerSecurityGroupDeletion(ctx context.Context, cli client.Client, selector labels.Selector) error { + log := log.FromContext(ctx) + + var securityGroups unikornv1.SecurityGroupList + + if err := cli.List(ctx, &securityGroups, &client.ListOptions{Namespace: p.identity.Namespace, LabelSelector: selector}); err != nil { return err } - if err := provider.DeleteIdentity(ctx, p.identity); err != nil { - return err + if len(securityGroups.Items) != 0 { + for i := range securityGroups.Items { + resource := &securityGroups.Items[i] + + if resource.DeletionTimestamp != nil { + log.Info("awaiting security group deletion", "security group", resource.Name) + continue + } + + log.Info("triggering security group deletion", "security group", resource.Name) + + if err := cli.Delete(ctx, resource); err != nil { + return err + } + } + + return provisioners.ErrYield } return nil diff --git a/pkg/provisioners/managers/security-group-rule/provisioner.go b/pkg/provisioners/managers/security-group-rule/provisioner.go new file mode 100644 index 0000000..a9526a0 --- /dev/null +++ b/pkg/provisioners/managers/security-group-rule/provisioner.go @@ -0,0 +1,170 @@ +/* +Copyright 2024 the Unikorn Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package securitygrouprule + +import ( + "context" + "errors" + "fmt" + + unikornv1core "github.com/unikorn-cloud/core/pkg/apis/unikorn/v1alpha1" + coreclient "github.com/unikorn-cloud/core/pkg/client" + coremanager "github.com/unikorn-cloud/core/pkg/manager" + "github.com/unikorn-cloud/core/pkg/provisioners" + unikornv1 "github.com/unikorn-cloud/region/pkg/apis/unikorn/v1alpha1" + "github.com/unikorn-cloud/region/pkg/constants" + "github.com/unikorn-cloud/region/pkg/handler/region" + + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/log" +) + +var ( + ErrResouceDependency = errors.New("resource dependency error") +) + +// Provisioner encapsulates control plane provisioning. +type Provisioner struct { + provisioners.Metadata + + // securitygrouprule is the security group we're provisioning. + securitygrouprule *unikornv1.SecurityGroupRule +} + +// New returns a new initialized provisioner object. +func New(_ coremanager.ControllerOptions) provisioners.ManagerProvisioner { + return &Provisioner{ + securitygrouprule: &unikornv1.SecurityGroupRule{}, + } +} + +// Ensure the ManagerProvisioner interface is implemented. +var _ provisioners.ManagerProvisioner = &Provisioner{} + +func (p *Provisioner) Object() unikornv1core.ManagableResourceInterface { + return p.securitygrouprule +} + +func (p *Provisioner) getIdentity(ctx context.Context, cli client.Client) (*unikornv1.Identity, error) { + identity := &unikornv1.Identity{} + + if err := cli.Get(ctx, client.ObjectKey{Namespace: p.securitygrouprule.Namespace, Name: p.securitygrouprule.Labels[constants.IdentityLabel]}, identity); err != nil { + return nil, err + } + + return identity, nil +} + +func (p *Provisioner) getSecurityGroup(ctx context.Context, cli client.Client) (*unikornv1.SecurityGroup, error) { + securitygroup := &unikornv1.SecurityGroup{} + + if err := cli.Get(ctx, client.ObjectKey{Namespace: p.securitygrouprule.Namespace, Name: p.securitygrouprule.Labels[constants.SecurityGroupLabel]}, securitygroup); err != nil { + return nil, err + } + + return securitygroup, nil +} + +func (p *Provisioner) validateResourceStatus(ctx context.Context, resource unikornv1core.ManagableResourceInterface) error { + log := log.FromContext(ctx) + + // Inhibit provisioning until resource is ready + status, err := resource.StatusConditionRead(unikornv1core.ConditionAvailable) + if err != nil { + log.Info("waiting for resource status update") + + return provisioners.ErrYield + } + + switch status.Reason { + case unikornv1core.ConditionReasonProvisioned: + break + case unikornv1core.ConditionReasonProvisioning: + return provisioners.ErrYield + default: + return fmt.Errorf("%w: resource in unexpected condition %v", ErrResouceDependency, status.Reason) + } + + return nil +} + +// Provision implements the Provision interface. +func (p *Provisioner) Provision(ctx context.Context) error { + + cli, err := coreclient.ProvisionerClientFromContext(ctx) + if err != nil { + return err + } + + provider, err := region.NewClient(cli, p.securitygrouprule.Namespace).Provider(ctx, p.securitygrouprule.Labels[constants.RegionLabel]) + if err != nil { + return err + } + + identity, err := p.getIdentity(ctx, cli) + if err != nil { + return err + } + + if err := p.validateResourceStatus(ctx, identity); err != nil { + return err + } + + securitygroup, err := p.getSecurityGroup(ctx, cli) + if err != nil { + return err + } + + if err := p.validateResourceStatus(ctx, securitygroup); err != nil { + return err + } + + if err := provider.CreateSecurityGroupRule(ctx, identity, securitygroup, p.securitygrouprule); err != nil { + return err + } + + return nil +} + +// Deprovision implements the Provision interface. +func (p *Provisioner) Deprovision(ctx context.Context) error { + cli, err := coreclient.ProvisionerClientFromContext(ctx) + if err != nil { + return err + } + + provider, err := region.NewClient(cli, p.securitygrouprule.Namespace).Provider(ctx, p.securitygrouprule.Labels[constants.RegionLabel]) + if err != nil { + return err + } + + identity, err := p.getIdentity(ctx, cli) + if err != nil { + return err + } + + securitygroup, err := p.getSecurityGroup(ctx, cli) + if err != nil { + return err + } + + if err := provider.DeleteSecurityGroupRule(ctx, identity, securitygroup, p.securitygrouprule); err != nil { + return err + } + + return nil +} diff --git a/pkg/provisioners/managers/security-group/provisioner.go b/pkg/provisioners/managers/security-group/provisioner.go new file mode 100644 index 0000000..743ff4e --- /dev/null +++ b/pkg/provisioners/managers/security-group/provisioner.go @@ -0,0 +1,183 @@ +/* +Copyright 2024 the Unikorn Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package securitygroup + +import ( + "context" + "errors" + "fmt" + + unikornv1core "github.com/unikorn-cloud/core/pkg/apis/unikorn/v1alpha1" + coreclient "github.com/unikorn-cloud/core/pkg/client" + coremanager "github.com/unikorn-cloud/core/pkg/manager" + "github.com/unikorn-cloud/core/pkg/provisioners" + unikornv1 "github.com/unikorn-cloud/region/pkg/apis/unikorn/v1alpha1" + "github.com/unikorn-cloud/region/pkg/constants" + "github.com/unikorn-cloud/region/pkg/handler/region" + + "k8s.io/apimachinery/pkg/labels" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/log" +) + +var ( + ErrResouceDependency = errors.New("resource dependency error") +) + +// Provisioner encapsulates control plane provisioning. +type Provisioner struct { + provisioners.Metadata + + // securitygroup is the security group we're provisioning. + securitygroup *unikornv1.SecurityGroup +} + +// New returns a new initialized provisioner object. +func New(_ coremanager.ControllerOptions) provisioners.ManagerProvisioner { + return &Provisioner{ + securitygroup: &unikornv1.SecurityGroup{}, + } +} + +// Ensure the ManagerProvisioner interface is implemented. +var _ provisioners.ManagerProvisioner = &Provisioner{} + +func (p *Provisioner) Object() unikornv1core.ManagableResourceInterface { + return p.securitygroup +} + +func (p *Provisioner) getIdentity(ctx context.Context, cli client.Client) (*unikornv1.Identity, error) { + identity := &unikornv1.Identity{} + + if err := cli.Get(ctx, client.ObjectKey{Namespace: p.securitygroup.Namespace, Name: p.securitygroup.Labels[constants.IdentityLabel]}, identity); err != nil { + return nil, err + } + + return identity, nil +} + +// Provision implements the Provision interface. +func (p *Provisioner) Provision(ctx context.Context) error { + log := log.FromContext(ctx) + + cli, err := coreclient.ProvisionerClientFromContext(ctx) + if err != nil { + return err + } + + provider, err := region.NewClient(cli, p.securitygroup.Namespace).Provider(ctx, p.securitygroup.Labels[constants.RegionLabel]) + if err != nil { + return err + } + + identity, err := p.getIdentity(ctx, cli) + if err != nil { + return err + } + + // Inhibit provisioning until the identity is ready, as we may need the identity information + // to create the security group e.g. the project ID in the case of OpenStack. + status, err := identity.StatusConditionRead(unikornv1core.ConditionAvailable) + if err != nil { + log.Info("waiting for identity status update") + + return provisioners.ErrYield + } + + switch status.Reason { + case unikornv1core.ConditionReasonProvisioned: + break + case unikornv1core.ConditionReasonProvisioning: + return provisioners.ErrYield + default: + return fmt.Errorf("%w: identity in unexpected condition %v", ErrResouceDependency, status.Reason) + } + + if err := provider.CreateSecurityGroup(ctx, identity, p.securitygroup); err != nil { + return err + } + + return nil +} + +// Deprovision implements the Provision interface. +func (p *Provisioner) Deprovision(ctx context.Context) error { + log := log.FromContext(ctx) + + cli, err := coreclient.ProvisionerClientFromContext(ctx) + if err != nil { + return err + } + + identity, err := p.getIdentity(ctx, cli) + if err != nil { + return err + } + + // Block security group deletion until all owned resources are deleted + rules, err := p.listSecurityGroupRules(ctx, cli, identity) + if err != nil { + return err + } + + if len(rules.Items) != 0 { + for i := range rules.Items { + resource := &rules.Items[i] + + if resource.DeletionTimestamp != nil { + log.Info("awaiting security group rule deletion", "security group rule", resource.Name) + continue + } + + log.Info("triggering security group rule deletion", "security group rule", resource.Name) + + if err := cli.Delete(ctx, resource); err != nil { + return err + } + } + + return provisioners.ErrYield + } + + provider, err := region.NewClient(cli, p.securitygroup.Namespace).Provider(ctx, p.securitygroup.Labels[constants.RegionLabel]) + if err != nil { + return err + } + + if err := provider.DeleteSecurityGroup(ctx, identity, p.securitygroup); err != nil { + return err + } + + return nil +} + +func (p *Provisioner) listSecurityGroupRules(ctx context.Context, cli client.Client, identity *unikornv1.Identity) (*unikornv1.SecurityGroupRuleList, error) { + var result unikornv1.SecurityGroupRuleList + + options := &client.ListOptions{ + LabelSelector: labels.SelectorFromSet(map[string]string{ + constants.IdentityLabel: identity.Name, + constants.SecurityGroupLabel: p.securitygroup.Name, + }), + } + + if err := cli.List(ctx, &result, options); err != nil { + return nil, err + } + + return &result, nil +}