Initial code for the a1 implementation for go 10/6810/1
authorsubhash kumar singh <subh.singh@samsung.com>
Thu, 30 Sep 2021 19:07:18 +0000 (19:07 +0000)
committersubhash kumar singh <subh.singh@samsung.com>
Fri, 1 Oct 2021 09:40:35 +0000 (15:10 +0530)
This patch sets up initial repo structure for a1 mediator in go.
Mainly this patch contains swagger file "api/swagger.yaml" to represent
a1 interface APIs.

Swagger tool is used to generate the models which are required for the
exposing the the APIs.

Current patch contains one API implemented for querying policy instance
with UT (pkg/restful pkg/resthooks).

Signed-off-by: subhash kumar singh <subh.singh@samsung.com>
Issue-ID: RIC-831
Change-Id: I41bafaf5553d4aae95d6a7ce3bca1b4745254638

60 files changed:
a1-go/api/swagger.yaml [new file with mode: 0644]
a1-go/cmd/a1.go [new file with mode: 0644]
a1-go/go.mod [new file with mode: 0644]
a1-go/pkg/models/policy_instance_id.go [new file with mode: 0644]
a1-go/pkg/models/policy_type_id.go [new file with mode: 0644]
a1-go/pkg/models/policy_type_schema.go [new file with mode: 0644]
a1-go/pkg/restapi/configure_a1.go [new file with mode: 0644]
a1-go/pkg/restapi/doc.go [new file with mode: 0644]
a1-go/pkg/restapi/embedded_spec.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_api.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_e_i_data_delivery/a1_controller_data_delivery.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_e_i_data_delivery/a1_controller_data_delivery_parameters.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_e_i_data_delivery/a1_controller_data_delivery_responses.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_e_i_data_delivery/a1_controller_data_delivery_urlbuilder.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_or_replace_policy_instance.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_or_replace_policy_instance_parameters.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_or_replace_policy_instance_responses.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_or_replace_policy_instance_urlbuilder.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_policy_type.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_policy_type_parameters.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_policy_type_responses.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_policy_type_urlbuilder.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_instance.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_instance_parameters.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_instance_responses.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_instance_urlbuilder.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_type.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_type_parameters.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_type_responses.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_type_urlbuilder.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_instances_for_type.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_instances_for_type_parameters.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_instances_for_type_responses.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_instances_for_type_urlbuilder.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_policy_types.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_policy_types_parameters.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_policy_types_responses.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_policy_types_urlbuilder.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_healthcheck.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_healthcheck_parameters.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_healthcheck_responses.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_healthcheck_urlbuilder.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance_parameters.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance_responses.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance_status.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance_status_parameters.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance_status_responses.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance_status_urlbuilder.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance_urlbuilder.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_type.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_type_parameters.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_type_responses.go [new file with mode: 0644]
a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_type_urlbuilder.go [new file with mode: 0644]
a1-go/pkg/restapi/server.go [new file with mode: 0644]
a1-go/pkg/restful/restful.go [new file with mode: 0644]
a1-go/pkg/restful/types.go [new file with mode: 0644]
a1-go/pkg/resthooks/resthooks.go [new file with mode: 0644]
a1-go/pkg/resthooks/resthooks_test.go [new file with mode: 0644]
a1-go/pkg/resthooks/types.go [new file with mode: 0644]

diff --git a/a1-go/api/swagger.yaml b/a1-go/api/swagger.yaml
new file mode 100644 (file)
index 0000000..b7ca526
--- /dev/null
@@ -0,0 +1,366 @@
+swagger: '2.0'
+info:
+  version: 2.1.0
+  title: RIC A1
+paths:
+  /a1-p/healthcheck:
+    get:
+      description: |
+        Perform a healthcheck on a1
+      tags:
+        - A1 Mediator
+      operationId: a1.controller.get_healthcheck
+      responses:
+        '200':
+          description: >
+            A1 is healthy. Anything other than a 200 should be considered a1 as
+            failing
+      parameters: []
+  /a1-p/policytypes:
+    get:
+      description: Get a list of all registered policy type ids
+      tags:
+        - A1 Mediator
+      operationId: a1.controller.get_all_policy_types
+      responses:
+        '200':
+          description: list of all registered policy type ids
+          examples:
+            application/json:
+              - 20000
+              - 20020
+          schema:
+            type: array
+            items:
+              $ref: '#/definitions/policy_type_id'
+        '503':
+          description: >-
+            Potentially transient backend database error. Client should attempt
+            to retry later.
+      parameters: []
+      produces:
+        - application/json
+  '/a1-p/policytypes/{policy_type_id}':
+    parameters:
+      - name: policy_type_id
+        in: path
+        required: true
+        minimum: 1
+        maximum: 2147483647
+        type: integer
+        description: >
+          represents a policy type identifier. Currently this is restricted to
+          an integer range.
+    get:
+      description: |
+        Get this policy type
+      tags:
+        - A1 Mediator
+      operationId: a1.controller.get_policy_type
+      responses:
+        '200':
+          description: policy type successfully found
+          schema:
+            $ref: '#/definitions/policy_type_schema'
+        '404':
+          description: |
+            policy type not found
+        '503':
+          description: >-
+            Potentially transient backend database error. Client should attempt
+            to retry later.
+      parameters: []
+      produces:
+        - application/json
+    delete:
+      description: >
+        Delete this policy type. Can only be performed if there are no instances
+        of this type
+      tags:
+        - A1 Mediator
+      operationId: a1.controller.delete_policy_type
+      responses:
+        '204':
+          description: |
+            policy type successfully deleted
+        '400':
+          description: >
+            Policy type cannot be deleted because there are instances All
+            instances must be removed before a policy type can be deleted
+        '404':
+          description: |
+            policy type not found
+        '503':
+          description: >-
+            Potentially transient backend database error. Client should attempt
+            to retry later.
+      parameters: []
+    put:
+      description: >
+        Create a new policy type . Replace is not currently allowed; to replace,
+        for now do a DELETE and then a PUT again.
+      tags:
+        - A1 Mediator
+      operationId: a1.controller.create_policy_type
+      responses:
+        '201':
+          description: policy type successfully created
+        '400':
+          description: 'illegal ID, or object already existed'
+        '503':
+          description: >-
+            Potentially transient backend database error. Client should attempt
+            to retry later.
+      parameters:
+        - name: body
+          in: body
+          schema:
+            $ref: '#/definitions/policy_type_schema'
+      consumes:
+        - application/json
+  '/a1-p/policytypes/{policy_type_id}/policies':
+    parameters:
+      - name: policy_type_id
+        in: path
+        required: true
+        minimum: 1
+        maximum: 2147483647
+        type: integer
+        description: >
+          represents a policy type identifier. Currently this is restricted to
+          an integer range.
+    get:
+      description: get a list of all policy instance ids for this policy type id
+      tags:
+        - A1 Mediator
+      operationId: a1.controller.get_all_instances_for_type
+      responses:
+        '200':
+          description: list of all policy instance ids for this policy type id
+          examples:
+            application/json:
+              - 3d2157af-6a8f-4a7c-810f-38c2f824bf12
+              - 06911bfc-c127-444a-8eb1-1bffad27cc3d
+          schema:
+            type: array
+            items:
+              $ref: '#/definitions/policy_instance_id'
+        '503':
+          description: >-
+            Potentially transient backend database error. Client should attempt
+            to retry later.
+      parameters: []
+      produces:
+        - application/json
+  '/a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id}':
+    parameters:
+      - name: policy_type_id
+        in: path
+        required: true
+        minimum: 1
+        maximum: 2147483647
+        type: integer
+        description: >
+          represents a policy type identifier. Currently this is restricted to
+          an integer range.
+      - name: policy_instance_id
+        in: path
+        required: true
+        type: string
+        description: >
+          represents a policy instance identifier. UUIDs are advisable but can
+          be any string
+    get:
+      description: |
+        Retrieve the policy instance
+      tags:
+        - A1 Mediator
+      operationId: a1.controller.get_policy_instance
+      responses:
+        '200':
+          description: >
+            The policy instance. the schema of this object is defined by the
+            create_schema field of the policy type
+          schema:
+            type: object
+        '404':
+          description: >
+            there is no policy instance with this policy_instance_id or there is
+            no policy type with this policy_type_id
+        '503':
+          description: >-
+            Potentially transient backend database error. Client should attempt
+            to retry later.
+      parameters: []
+      produces:
+        - application/json
+    delete:
+      description: |
+        Delete this policy instance
+      tags:
+        - A1 Mediator
+      operationId: a1.controller.delete_policy_instance
+      responses:
+        '202':
+          description: |
+            policy instance deletion initiated
+        '404':
+          description: >
+            there is no policy instance with this policy_instance_id or there is
+            no policy type with this policy_type_id
+        '503':
+          description: >-
+            Potentially transient backend database error. Client should attempt
+            to retry later.
+      parameters: []
+    put:
+      description: >
+        Create or replace a policy instance of type policy_type_id. The schema
+        of the PUT body is defined by the create_schema field of the policy
+        type.
+      tags:
+        - A1 Mediator
+      operationId: a1.controller.create_or_replace_policy_instance
+      responses:
+        '202':
+          description: |
+            Policy instance creation initiated
+        '400':
+          description: |
+            Bad PUT body for this policy instance
+        '404':
+          description: |
+            There is no policy type with this policy_type_id
+        '503':
+          description: >-
+            Potentially transient backend database error. Client should attempt
+            to retry later.
+      parameters:
+        - name: body
+          in: body
+          schema:
+            type: object
+            description: >
+              the schema of this object is defined by the create_schema field of
+              the policy type
+      consumes:
+        - application/json
+  '/a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id}/status':
+    parameters:
+      - name: policy_type_id
+        in: path
+        required: true
+        minimum: 1
+        maximum: 2147483647
+        type: integer
+        description: >
+          represents a policy type identifier. Currently this is restricted to
+          an integer range.
+      - name: policy_instance_id
+        in: path
+        required: true
+        type: string
+        description: >
+          represents a policy instance identifier. UUIDs are advisable but can
+          be any string
+    get:
+      description: >
+        Retrieve the policy instance status across all handlers of the policy If
+        this endpoint returns successfully (200), it is either IN EFFECT or NOT
+        IN EFFECT. IN EFFECT is returned if at least one policy handler in the
+        RIC is implementing the policy NOT IN EFFECT is returned otherwise If a
+        policy instance is successfully deleted, this endpoint will return a 404
+        (not a 200)
+      tags:
+        - A1 Mediator
+      operationId: a1.controller.get_policy_instance_status
+      responses:
+        '200':
+          description: |
+            successfully retrieved the status
+          schema:
+            type: object
+            properties:
+              instance_status:
+                type: string
+                enum:
+                  - IN EFFECT
+                  - NOT IN EFFECT
+              has_been_deleted:
+                type: boolean
+              created_at:
+                type: string
+                format: date-time
+        '404':
+          description: >
+            there is no policy instance with this policy_instance_id or there is
+            no policy type with this policy_type_id
+        '503':
+          description: >-
+            Potentially transient backend database error. Client should attempt
+            to retry later.
+      parameters: []
+      produces:
+        - application/json
+  /data-delivery:
+    post:
+      description: |
+        Deliver data produced by data producer.
+      tags:
+        - A1 EI Data Delivery
+      operationId: a1.controller.data_delivery
+      responses:
+        '200':
+          description: |
+            successfully delivered data from data producer
+        '404':
+          description: |
+            no job id defined for this data delivery
+      parameters:
+        - name: body
+          in: body
+          schema:
+            type: object
+            description: |
+              object to represent data object
+      consumes:
+        - application/json
+definitions:
+  policy_type_schema:
+    type: object
+    required:
+      - name
+      - description
+      - policy_type_id
+      - create_schema
+    additionalProperties: false
+    properties:
+      name:
+        type: string
+        description: name of the policy type
+      description:
+        type: string
+        description: description of the policy type
+      policy_type_id:
+        description: the integer of the policy type
+        type: integer
+      create_schema:
+        type: object
+        description: >
+          jsonschema (following http://json-schema.org/draft-07/schema) of the
+          CREATE payload to be sent to handlers of this policy
+  policy_type_id:
+    description: >
+      represents a policy type identifier. Currently this is restricted to an
+      integer range.
+    type: integer
+    minimum: 1
+    maximum: 2147483647
+  policy_instance_id:
+    description: >
+      represents a policy instance identifier. UUIDs are advisable but can be
+      any string
+    type: string
+    example: 3d2157af-6a8f-4a7c-810f-38c2f824bf12
+x-components: {}
+
diff --git a/a1-go/cmd/a1.go b/a1-go/cmd/a1.go
new file mode 100644 (file)
index 0000000..eaf8433
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+package main
+
+import (
+       "subh.com/a1-go/pkg/restful"
+)
+
+func main() {
+
+       // Development configuration
+       // following configuration is required if we would like to communicate with SDL
+       // os.Setenv("DBAAS_SERVICE_HOST", "xxxxx")
+       // os.Setenv("DBAAS_SERVICE_PORT", "xxxxx")
+
+       // start restful service to handle a1 api's
+       restful := restful.NewRestful()
+       restful.Run()
+}
diff --git a/a1-go/go.mod b/a1-go/go.mod
new file mode 100644 (file)
index 0000000..3659925
--- /dev/null
@@ -0,0 +1,39 @@
+//
+//==================================================================================
+//  Copyright (c) 2021 Samsung
+//
+//   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.
+//
+//   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+//   platform project (RICP).
+//==================================================================================
+//
+module subh.com/a1-go
+
+go 1.16
+
+replace gerrit.o-ran-sc.org/r/ric-plt/sdlgo => gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.7.0
+
+require (
+       gerrit.o-ran-sc.org/r/ric-plt/sdlgo v0.7.0
+       github.com/go-openapi/errors v0.19.9
+       github.com/go-openapi/loads v0.19.7
+       github.com/go-openapi/runtime v0.19.29
+       github.com/go-openapi/spec v0.19.15
+       github.com/go-openapi/strfmt v0.19.11
+       github.com/go-openapi/swag v0.19.12
+       github.com/go-openapi/validate v0.19.15
+       github.com/jessevdk/go-flags v1.5.0
+       github.com/stretchr/testify v1.6.1
+       golang.org/x/net v0.0.0-20201110031124-69a78807bb2b
+)
diff --git a/a1-go/pkg/models/policy_instance_id.go b/a1-go/pkg/models/policy_instance_id.go
new file mode 100644 (file)
index 0000000..111e02e
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package models
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "github.com/go-openapi/strfmt"
+)
+
+// PolicyInstanceID represents a policy instance identifier. UUIDs are advisable but can be any string
+//
+//
+// swagger:model policy_instance_id
+type PolicyInstanceID string
+
+// Validate validates this policy instance id
+func (m PolicyInstanceID) Validate(formats strfmt.Registry) error {
+       return nil
+}
diff --git a/a1-go/pkg/models/policy_type_id.go b/a1-go/pkg/models/policy_type_id.go
new file mode 100644 (file)
index 0000000..6e67d41
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package models
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/strfmt"
+       "github.com/go-openapi/validate"
+)
+
+// PolicyTypeID represents a policy type identifier. Currently this is restricted to an integer range.
+//
+//
+// swagger:model policy_type_id
+type PolicyTypeID int64
+
+// Validate validates this policy type id
+func (m PolicyTypeID) Validate(formats strfmt.Registry) error {
+       var res []error
+
+       if err := validate.MinimumInt("", "body", int64(m), 1, false); err != nil {
+               return err
+       }
+
+       if err := validate.MaximumInt("", "body", int64(m), 2.147483647e+09, false); err != nil {
+               return err
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
diff --git a/a1-go/pkg/models/policy_type_schema.go b/a1-go/pkg/models/policy_type_schema.go
new file mode 100644 (file)
index 0000000..1a23d80
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package models
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/strfmt"
+       "github.com/go-openapi/swag"
+       "github.com/go-openapi/validate"
+)
+
+// PolicyTypeSchema policy type schema
+//
+// swagger:model policy_type_schema
+type PolicyTypeSchema struct {
+
+       // jsonschema (following http://json-schema.org/draft-07/schema) of the CREATE payload to be sent to handlers of this policy
+       //
+       // Required: true
+       CreateSchema interface{} `json:"create_schema"`
+
+       // description of the policy type
+       // Required: true
+       Description *string `json:"description"`
+
+       // name of the policy type
+       // Required: true
+       Name *string `json:"name"`
+
+       // the integer of the policy type
+       // Required: true
+       PolicyTypeID *int64 `json:"policy_type_id"`
+}
+
+// Validate validates this policy type schema
+func (m *PolicyTypeSchema) Validate(formats strfmt.Registry) error {
+       var res []error
+
+       if err := m.validateCreateSchema(formats); err != nil {
+               res = append(res, err)
+       }
+
+       if err := m.validateDescription(formats); err != nil {
+               res = append(res, err)
+       }
+
+       if err := m.validateName(formats); err != nil {
+               res = append(res, err)
+       }
+
+       if err := m.validatePolicyTypeID(formats); err != nil {
+               res = append(res, err)
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
+
+func (m *PolicyTypeSchema) validateCreateSchema(formats strfmt.Registry) error {
+
+       if err := validate.Required("create_schema", "body", m.CreateSchema); err != nil {
+               return err
+       }
+
+       return nil
+}
+
+func (m *PolicyTypeSchema) validateDescription(formats strfmt.Registry) error {
+
+       if err := validate.Required("description", "body", m.Description); err != nil {
+               return err
+       }
+
+       return nil
+}
+
+func (m *PolicyTypeSchema) validateName(formats strfmt.Registry) error {
+
+       if err := validate.Required("name", "body", m.Name); err != nil {
+               return err
+       }
+
+       return nil
+}
+
+func (m *PolicyTypeSchema) validatePolicyTypeID(formats strfmt.Registry) error {
+
+       if err := validate.Required("policy_type_id", "body", m.PolicyTypeID); err != nil {
+               return err
+       }
+
+       return nil
+}
+
+// MarshalBinary interface implementation
+func (m *PolicyTypeSchema) MarshalBinary() ([]byte, error) {
+       if m == nil {
+               return nil, nil
+       }
+       return swag.WriteJSON(m)
+}
+
+// UnmarshalBinary interface implementation
+func (m *PolicyTypeSchema) UnmarshalBinary(b []byte) error {
+       var res PolicyTypeSchema
+       if err := swag.ReadJSON(b, &res); err != nil {
+               return err
+       }
+       *m = res
+       return nil
+}
diff --git a/a1-go/pkg/restapi/configure_a1.go b/a1-go/pkg/restapi/configure_a1.go
new file mode 100644 (file)
index 0000000..511268b
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// This file is safe to edit. Once it exists it will not be overwritten
+
+package restapi
+
+import (
+       "crypto/tls"
+       "net/http"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/runtime"
+       "github.com/go-openapi/runtime/middleware"
+
+       "subh.com/a1-go/pkg/restapi/operations"
+       "subh.com/a1-go/pkg/restapi/operations/a1_e_i_data_delivery"
+       "subh.com/a1-go/pkg/restapi/operations/a1_mediator"
+)
+
+//go:generate swagger generate server --target ../../pkg --name A1 --spec ../../api/swagger.yaml --exclude-main
+
+func configureFlags(api *operations.A1API) {
+       // api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }
+}
+
+func configureAPI(api *operations.A1API) http.Handler {
+       // configure the api here
+       api.ServeError = errors.ServeError
+
+       // Set your custom logger if needed. Default one is log.Printf
+       // Expected interface func(string, ...interface{})
+       //
+       // Example:
+       // api.Logger = log.Printf
+
+       api.JSONConsumer = runtime.JSONConsumer()
+
+       api.JSONProducer = runtime.JSONProducer()
+
+       if api.A1MediatorA1ControllerCreateOrReplacePolicyInstanceHandler == nil {
+               api.A1MediatorA1ControllerCreateOrReplacePolicyInstanceHandler = a1_mediator.A1ControllerCreateOrReplacePolicyInstanceHandlerFunc(func(params a1_mediator.A1ControllerCreateOrReplacePolicyInstanceParams) middleware.Responder {
+                       return middleware.NotImplemented("operation a1_mediator.A1ControllerCreateOrReplacePolicyInstance has not yet been implemented")
+               })
+       }
+       if api.A1MediatorA1ControllerCreatePolicyTypeHandler == nil {
+               api.A1MediatorA1ControllerCreatePolicyTypeHandler = a1_mediator.A1ControllerCreatePolicyTypeHandlerFunc(func(params a1_mediator.A1ControllerCreatePolicyTypeParams) middleware.Responder {
+                       return middleware.NotImplemented("operation a1_mediator.A1ControllerCreatePolicyType has not yet been implemented")
+               })
+       }
+       if api.A1eiDataDeliveryA1ControllerDataDeliveryHandler == nil {
+               api.A1eiDataDeliveryA1ControllerDataDeliveryHandler = a1_e_i_data_delivery.A1ControllerDataDeliveryHandlerFunc(func(params a1_e_i_data_delivery.A1ControllerDataDeliveryParams) middleware.Responder {
+                       return middleware.NotImplemented("operation a1_e_i_data_delivery.A1ControllerDataDelivery has not yet been implemented")
+               })
+       }
+       if api.A1MediatorA1ControllerDeletePolicyInstanceHandler == nil {
+               api.A1MediatorA1ControllerDeletePolicyInstanceHandler = a1_mediator.A1ControllerDeletePolicyInstanceHandlerFunc(func(params a1_mediator.A1ControllerDeletePolicyInstanceParams) middleware.Responder {
+                       return middleware.NotImplemented("operation a1_mediator.A1ControllerDeletePolicyInstance has not yet been implemented")
+               })
+       }
+       if api.A1MediatorA1ControllerDeletePolicyTypeHandler == nil {
+               api.A1MediatorA1ControllerDeletePolicyTypeHandler = a1_mediator.A1ControllerDeletePolicyTypeHandlerFunc(func(params a1_mediator.A1ControllerDeletePolicyTypeParams) middleware.Responder {
+                       return middleware.NotImplemented("operation a1_mediator.A1ControllerDeletePolicyType has not yet been implemented")
+               })
+       }
+       if api.A1MediatorA1ControllerGetAllInstancesForTypeHandler == nil {
+               api.A1MediatorA1ControllerGetAllInstancesForTypeHandler = a1_mediator.A1ControllerGetAllInstancesForTypeHandlerFunc(func(params a1_mediator.A1ControllerGetAllInstancesForTypeParams) middleware.Responder {
+                       return middleware.NotImplemented("operation a1_mediator.A1ControllerGetAllInstancesForType has not yet been implemented")
+               })
+       }
+       if api.A1MediatorA1ControllerGetAllPolicyTypesHandler == nil {
+               api.A1MediatorA1ControllerGetAllPolicyTypesHandler = a1_mediator.A1ControllerGetAllPolicyTypesHandlerFunc(func(params a1_mediator.A1ControllerGetAllPolicyTypesParams) middleware.Responder {
+                       return middleware.NotImplemented("operation a1_mediator.A1ControllerGetAllPolicyTypes has not yet been implemented")
+               })
+       }
+       if api.A1MediatorA1ControllerGetHealthcheckHandler == nil {
+               api.A1MediatorA1ControllerGetHealthcheckHandler = a1_mediator.A1ControllerGetHealthcheckHandlerFunc(func(params a1_mediator.A1ControllerGetHealthcheckParams) middleware.Responder {
+                       return middleware.NotImplemented("operation a1_mediator.A1ControllerGetHealthcheck has not yet been implemented")
+               })
+       }
+       if api.A1MediatorA1ControllerGetPolicyInstanceHandler == nil {
+               api.A1MediatorA1ControllerGetPolicyInstanceHandler = a1_mediator.A1ControllerGetPolicyInstanceHandlerFunc(func(params a1_mediator.A1ControllerGetPolicyInstanceParams) middleware.Responder {
+                       return middleware.NotImplemented("operation a1_mediator.A1ControllerGetPolicyInstance has not yet been implemented")
+               })
+       }
+       if api.A1MediatorA1ControllerGetPolicyInstanceStatusHandler == nil {
+               api.A1MediatorA1ControllerGetPolicyInstanceStatusHandler = a1_mediator.A1ControllerGetPolicyInstanceStatusHandlerFunc(func(params a1_mediator.A1ControllerGetPolicyInstanceStatusParams) middleware.Responder {
+                       return middleware.NotImplemented("operation a1_mediator.A1ControllerGetPolicyInstanceStatus has not yet been implemented")
+               })
+       }
+       if api.A1MediatorA1ControllerGetPolicyTypeHandler == nil {
+               api.A1MediatorA1ControllerGetPolicyTypeHandler = a1_mediator.A1ControllerGetPolicyTypeHandlerFunc(func(params a1_mediator.A1ControllerGetPolicyTypeParams) middleware.Responder {
+                       return middleware.NotImplemented("operation a1_mediator.A1ControllerGetPolicyType has not yet been implemented")
+               })
+       }
+
+       api.PreServerShutdown = func() {}
+
+       api.ServerShutdown = func() {}
+
+       return setupGlobalMiddleware(api.Serve(setupMiddlewares))
+}
+
+// The TLS configuration before HTTPS server starts.
+func configureTLS(tlsConfig *tls.Config) {
+       // Make all necessary changes to the TLS configuration here.
+}
+
+// As soon as server is initialized but not run yet, this function will be called.
+// If you need to modify a config, store server instance to stop it individually later, this is the place.
+// This function can be called multiple times, depending on the number of serving schemes.
+// scheme value will be set accordingly: "http", "https" or "unix"
+func configureServer(s *http.Server, scheme, addr string) {
+}
+
+// The middleware configuration is for the handler executors. These do not apply to the swagger.json document.
+// The middleware executes after routing but before authentication, binding and validation
+func setupMiddlewares(handler http.Handler) http.Handler {
+       return handler
+}
+
+// The middleware configuration happens before anything, this middleware also applies to serving the swagger.json document.
+// So this is a good place to plug in a panic handling middleware, logging and metrics
+func setupGlobalMiddleware(handler http.Handler) http.Handler {
+       return handler
+}
diff --git a/a1-go/pkg/restapi/doc.go b/a1-go/pkg/restapi/doc.go
new file mode 100644 (file)
index 0000000..42437b5
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+// Package restapi RIC A1
+//
+//  Schemes:
+//    http
+//  Host: localhost
+//  BasePath: /
+//  Version: 2.1.0
+//
+//  Consumes:
+//    - application/json
+//
+//  Produces:
+//    - application/json
+//
+// swagger:meta
+package restapi
diff --git a/a1-go/pkg/restapi/embedded_spec.go b/a1-go/pkg/restapi/embedded_spec.go
new file mode 100644 (file)
index 0000000..067d41d
--- /dev/null
@@ -0,0 +1,868 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package restapi
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "encoding/json"
+)
+
+var (
+       // SwaggerJSON embedded version of the swagger document used at generation time
+       SwaggerJSON json.RawMessage
+       // FlatSwaggerJSON embedded flattened version of the swagger document used at generation time
+       FlatSwaggerJSON json.RawMessage
+)
+
+func init() {
+       SwaggerJSON = json.RawMessage([]byte(`{
+  "swagger": "2.0",
+  "info": {
+    "title": "RIC A1",
+    "version": "2.1.0"
+  },
+  "paths": {
+    "/a1-p/healthcheck": {
+      "get": {
+        "description": "Perform a healthcheck on a1\n",
+        "tags": [
+          "A1 Mediator"
+        ],
+        "operationId": "a1.controller.get_healthcheck",
+        "responses": {
+          "200": {
+            "description": "A1 is healthy. Anything other than a 200 should be considered a1 as failing\n"
+          }
+        }
+      }
+    },
+    "/a1-p/policytypes": {
+      "get": {
+        "description": "Get a list of all registered policy type ids",
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "A1 Mediator"
+        ],
+        "operationId": "a1.controller.get_all_policy_types",
+        "responses": {
+          "200": {
+            "description": "list of all registered policy type ids",
+            "schema": {
+              "type": "array",
+              "items": {
+                "$ref": "#/definitions/policy_type_id"
+              }
+            },
+            "examples": {
+              "application/json": [
+                20000,
+                20020
+              ]
+            }
+          },
+          "503": {
+            "description": "Potentially transient backend database error. Client should attempt to retry later."
+          }
+        }
+      }
+    },
+    "/a1-p/policytypes/{policy_type_id}": {
+      "get": {
+        "description": "Get this policy type\n",
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "A1 Mediator"
+        ],
+        "operationId": "a1.controller.get_policy_type",
+        "responses": {
+          "200": {
+            "description": "policy type successfully found",
+            "schema": {
+              "$ref": "#/definitions/policy_type_schema"
+            }
+          },
+          "404": {
+            "description": "policy type not found\n"
+          },
+          "503": {
+            "description": "Potentially transient backend database error. Client should attempt to retry later."
+          }
+        }
+      },
+      "put": {
+        "description": "Create a new policy type . Replace is not currently allowed; to replace, for now do a DELETE and then a PUT again.\n",
+        "consumes": [
+          "application/json"
+        ],
+        "tags": [
+          "A1 Mediator"
+        ],
+        "operationId": "a1.controller.create_policy_type",
+        "parameters": [
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/policy_type_schema"
+            }
+          }
+        ],
+        "responses": {
+          "201": {
+            "description": "policy type successfully created"
+          },
+          "400": {
+            "description": "illegal ID, or object already existed"
+          },
+          "503": {
+            "description": "Potentially transient backend database error. Client should attempt to retry later."
+          }
+        }
+      },
+      "delete": {
+        "description": "Delete this policy type. Can only be performed if there are no instances of this type\n",
+        "tags": [
+          "A1 Mediator"
+        ],
+        "operationId": "a1.controller.delete_policy_type",
+        "responses": {
+          "204": {
+            "description": "policy type successfully deleted\n"
+          },
+          "400": {
+            "description": "Policy type cannot be deleted because there are instances All instances must be removed before a policy type can be deleted\n"
+          },
+          "404": {
+            "description": "policy type not found\n"
+          },
+          "503": {
+            "description": "Potentially transient backend database error. Client should attempt to retry later."
+          }
+        }
+      },
+      "parameters": [
+        {
+          "maximum": 2147483647,
+          "minimum": 1,
+          "type": "integer",
+          "description": "represents a policy type identifier. Currently this is restricted to an integer range.\n",
+          "name": "policy_type_id",
+          "in": "path",
+          "required": true
+        }
+      ]
+    },
+    "/a1-p/policytypes/{policy_type_id}/policies": {
+      "get": {
+        "description": "get a list of all policy instance ids for this policy type id",
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "A1 Mediator"
+        ],
+        "operationId": "a1.controller.get_all_instances_for_type",
+        "responses": {
+          "200": {
+            "description": "list of all policy instance ids for this policy type id",
+            "schema": {
+              "type": "array",
+              "items": {
+                "$ref": "#/definitions/policy_instance_id"
+              }
+            },
+            "examples": {
+              "application/json": [
+                "3d2157af-6a8f-4a7c-810f-38c2f824bf12",
+                "06911bfc-c127-444a-8eb1-1bffad27cc3d"
+              ]
+            }
+          },
+          "503": {
+            "description": "Potentially transient backend database error. Client should attempt to retry later."
+          }
+        }
+      },
+      "parameters": [
+        {
+          "maximum": 2147483647,
+          "minimum": 1,
+          "type": "integer",
+          "description": "represents a policy type identifier. Currently this is restricted to an integer range.\n",
+          "name": "policy_type_id",
+          "in": "path",
+          "required": true
+        }
+      ]
+    },
+    "/a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id}": {
+      "get": {
+        "description": "Retrieve the policy instance\n",
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "A1 Mediator"
+        ],
+        "operationId": "a1.controller.get_policy_instance",
+        "responses": {
+          "200": {
+            "description": "The policy instance. the schema of this object is defined by the create_schema field of the policy type\n",
+            "schema": {
+              "type": "object"
+            }
+          },
+          "404": {
+            "description": "there is no policy instance with this policy_instance_id or there is no policy type with this policy_type_id\n"
+          },
+          "503": {
+            "description": "Potentially transient backend database error. Client should attempt to retry later."
+          }
+        }
+      },
+      "put": {
+        "description": "Create or replace a policy instance of type policy_type_id. The schema of the PUT body is defined by the create_schema field of the policy type.\n",
+        "consumes": [
+          "application/json"
+        ],
+        "tags": [
+          "A1 Mediator"
+        ],
+        "operationId": "a1.controller.create_or_replace_policy_instance",
+        "parameters": [
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "description": "the schema of this object is defined by the create_schema field of the policy type\n",
+              "type": "object"
+            }
+          }
+        ],
+        "responses": {
+          "202": {
+            "description": "Policy instance creation initiated\n"
+          },
+          "400": {
+            "description": "Bad PUT body for this policy instance\n"
+          },
+          "404": {
+            "description": "There is no policy type with this policy_type_id\n"
+          },
+          "503": {
+            "description": "Potentially transient backend database error. Client should attempt to retry later."
+          }
+        }
+      },
+      "delete": {
+        "description": "Delete this policy instance\n",
+        "tags": [
+          "A1 Mediator"
+        ],
+        "operationId": "a1.controller.delete_policy_instance",
+        "responses": {
+          "202": {
+            "description": "policy instance deletion initiated\n"
+          },
+          "404": {
+            "description": "there is no policy instance with this policy_instance_id or there is no policy type with this policy_type_id\n"
+          },
+          "503": {
+            "description": "Potentially transient backend database error. Client should attempt to retry later."
+          }
+        }
+      },
+      "parameters": [
+        {
+          "maximum": 2147483647,
+          "minimum": 1,
+          "type": "integer",
+          "description": "represents a policy type identifier. Currently this is restricted to an integer range.\n",
+          "name": "policy_type_id",
+          "in": "path",
+          "required": true
+        },
+        {
+          "type": "string",
+          "description": "represents a policy instance identifier. UUIDs are advisable but can be any string\n",
+          "name": "policy_instance_id",
+          "in": "path",
+          "required": true
+        }
+      ]
+    },
+    "/a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id}/status": {
+      "get": {
+        "description": "Retrieve the policy instance status across all handlers of the policy If this endpoint returns successfully (200), it is either IN EFFECT or NOT IN EFFECT. IN EFFECT is returned if at least one policy handler in the RIC is implementing the policy NOT IN EFFECT is returned otherwise If a policy instance is successfully deleted, this endpoint will return a 404 (not a 200)\n",
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "A1 Mediator"
+        ],
+        "operationId": "a1.controller.get_policy_instance_status",
+        "responses": {
+          "200": {
+            "description": "successfully retrieved the status\n",
+            "schema": {
+              "type": "object",
+              "properties": {
+                "created_at": {
+                  "type": "string",
+                  "format": "date-time"
+                },
+                "has_been_deleted": {
+                  "type": "boolean"
+                },
+                "instance_status": {
+                  "type": "string",
+                  "enum": [
+                    "IN EFFECT",
+                    "NOT IN EFFECT"
+                  ]
+                }
+              }
+            }
+          },
+          "404": {
+            "description": "there is no policy instance with this policy_instance_id or there is no policy type with this policy_type_id\n"
+          },
+          "503": {
+            "description": "Potentially transient backend database error. Client should attempt to retry later."
+          }
+        }
+      },
+      "parameters": [
+        {
+          "maximum": 2147483647,
+          "minimum": 1,
+          "type": "integer",
+          "description": "represents a policy type identifier. Currently this is restricted to an integer range.\n",
+          "name": "policy_type_id",
+          "in": "path",
+          "required": true
+        },
+        {
+          "type": "string",
+          "description": "represents a policy instance identifier. UUIDs are advisable but can be any string\n",
+          "name": "policy_instance_id",
+          "in": "path",
+          "required": true
+        }
+      ]
+    },
+    "/data-delivery": {
+      "post": {
+        "description": "Deliver data produced by data producer.\n",
+        "consumes": [
+          "application/json"
+        ],
+        "tags": [
+          "A1 EI Data Delivery"
+        ],
+        "operationId": "a1.controller.data_delivery",
+        "parameters": [
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "description": "object to represent data object\n",
+              "type": "object"
+            }
+          }
+        ],
+        "responses": {
+          "200": {
+            "description": "successfully delivered data from data producer\n"
+          },
+          "404": {
+            "description": "no job id defined for this data delivery\n"
+          }
+        }
+      }
+    }
+  },
+  "definitions": {
+    "policy_instance_id": {
+      "description": "represents a policy instance identifier. UUIDs are advisable but can be any string\n",
+      "type": "string",
+      "example": "3d2157af-6a8f-4a7c-810f-38c2f824bf12"
+    },
+    "policy_type_id": {
+      "description": "represents a policy type identifier. Currently this is restricted to an integer range.\n",
+      "type": "integer",
+      "maximum": 2147483647,
+      "minimum": 1
+    },
+    "policy_type_schema": {
+      "type": "object",
+      "required": [
+        "name",
+        "description",
+        "policy_type_id",
+        "create_schema"
+      ],
+      "properties": {
+        "create_schema": {
+          "description": "jsonschema (following http://json-schema.org/draft-07/schema) of the CREATE payload to be sent to handlers of this policy\n",
+          "type": "object"
+        },
+        "description": {
+          "description": "description of the policy type",
+          "type": "string"
+        },
+        "name": {
+          "description": "name of the policy type",
+          "type": "string"
+        },
+        "policy_type_id": {
+          "description": "the integer of the policy type",
+          "type": "integer"
+        }
+      },
+      "additionalProperties": false
+    }
+  },
+  "x-components": {}
+}`))
+       FlatSwaggerJSON = json.RawMessage([]byte(`{
+  "swagger": "2.0",
+  "info": {
+    "title": "RIC A1",
+    "version": "2.1.0"
+  },
+  "paths": {
+    "/a1-p/healthcheck": {
+      "get": {
+        "description": "Perform a healthcheck on a1\n",
+        "tags": [
+          "A1 Mediator"
+        ],
+        "operationId": "a1.controller.get_healthcheck",
+        "responses": {
+          "200": {
+            "description": "A1 is healthy. Anything other than a 200 should be considered a1 as failing\n"
+          }
+        }
+      }
+    },
+    "/a1-p/policytypes": {
+      "get": {
+        "description": "Get a list of all registered policy type ids",
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "A1 Mediator"
+        ],
+        "operationId": "a1.controller.get_all_policy_types",
+        "responses": {
+          "200": {
+            "description": "list of all registered policy type ids",
+            "schema": {
+              "type": "array",
+              "items": {
+                "$ref": "#/definitions/policy_type_id"
+              }
+            },
+            "examples": {
+              "application/json": [
+                20000,
+                20020
+              ]
+            }
+          },
+          "503": {
+            "description": "Potentially transient backend database error. Client should attempt to retry later."
+          }
+        }
+      }
+    },
+    "/a1-p/policytypes/{policy_type_id}": {
+      "get": {
+        "description": "Get this policy type\n",
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "A1 Mediator"
+        ],
+        "operationId": "a1.controller.get_policy_type",
+        "responses": {
+          "200": {
+            "description": "policy type successfully found",
+            "schema": {
+              "$ref": "#/definitions/policy_type_schema"
+            }
+          },
+          "404": {
+            "description": "policy type not found\n"
+          },
+          "503": {
+            "description": "Potentially transient backend database error. Client should attempt to retry later."
+          }
+        }
+      },
+      "put": {
+        "description": "Create a new policy type . Replace is not currently allowed; to replace, for now do a DELETE and then a PUT again.\n",
+        "consumes": [
+          "application/json"
+        ],
+        "tags": [
+          "A1 Mediator"
+        ],
+        "operationId": "a1.controller.create_policy_type",
+        "parameters": [
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/policy_type_schema"
+            }
+          }
+        ],
+        "responses": {
+          "201": {
+            "description": "policy type successfully created"
+          },
+          "400": {
+            "description": "illegal ID, or object already existed"
+          },
+          "503": {
+            "description": "Potentially transient backend database error. Client should attempt to retry later."
+          }
+        }
+      },
+      "delete": {
+        "description": "Delete this policy type. Can only be performed if there are no instances of this type\n",
+        "tags": [
+          "A1 Mediator"
+        ],
+        "operationId": "a1.controller.delete_policy_type",
+        "responses": {
+          "204": {
+            "description": "policy type successfully deleted\n"
+          },
+          "400": {
+            "description": "Policy type cannot be deleted because there are instances All instances must be removed before a policy type can be deleted\n"
+          },
+          "404": {
+            "description": "policy type not found\n"
+          },
+          "503": {
+            "description": "Potentially transient backend database error. Client should attempt to retry later."
+          }
+        }
+      },
+      "parameters": [
+        {
+          "maximum": 2147483647,
+          "minimum": 1,
+          "type": "integer",
+          "description": "represents a policy type identifier. Currently this is restricted to an integer range.\n",
+          "name": "policy_type_id",
+          "in": "path",
+          "required": true
+        }
+      ]
+    },
+    "/a1-p/policytypes/{policy_type_id}/policies": {
+      "get": {
+        "description": "get a list of all policy instance ids for this policy type id",
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "A1 Mediator"
+        ],
+        "operationId": "a1.controller.get_all_instances_for_type",
+        "responses": {
+          "200": {
+            "description": "list of all policy instance ids for this policy type id",
+            "schema": {
+              "type": "array",
+              "items": {
+                "$ref": "#/definitions/policy_instance_id"
+              }
+            },
+            "examples": {
+              "application/json": [
+                "3d2157af-6a8f-4a7c-810f-38c2f824bf12",
+                "06911bfc-c127-444a-8eb1-1bffad27cc3d"
+              ]
+            }
+          },
+          "503": {
+            "description": "Potentially transient backend database error. Client should attempt to retry later."
+          }
+        }
+      },
+      "parameters": [
+        {
+          "maximum": 2147483647,
+          "minimum": 1,
+          "type": "integer",
+          "description": "represents a policy type identifier. Currently this is restricted to an integer range.\n",
+          "name": "policy_type_id",
+          "in": "path",
+          "required": true
+        }
+      ]
+    },
+    "/a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id}": {
+      "get": {
+        "description": "Retrieve the policy instance\n",
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "A1 Mediator"
+        ],
+        "operationId": "a1.controller.get_policy_instance",
+        "responses": {
+          "200": {
+            "description": "The policy instance. the schema of this object is defined by the create_schema field of the policy type\n",
+            "schema": {
+              "type": "object"
+            }
+          },
+          "404": {
+            "description": "there is no policy instance with this policy_instance_id or there is no policy type with this policy_type_id\n"
+          },
+          "503": {
+            "description": "Potentially transient backend database error. Client should attempt to retry later."
+          }
+        }
+      },
+      "put": {
+        "description": "Create or replace a policy instance of type policy_type_id. The schema of the PUT body is defined by the create_schema field of the policy type.\n",
+        "consumes": [
+          "application/json"
+        ],
+        "tags": [
+          "A1 Mediator"
+        ],
+        "operationId": "a1.controller.create_or_replace_policy_instance",
+        "parameters": [
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "description": "the schema of this object is defined by the create_schema field of the policy type\n",
+              "type": "object"
+            }
+          }
+        ],
+        "responses": {
+          "202": {
+            "description": "Policy instance creation initiated\n"
+          },
+          "400": {
+            "description": "Bad PUT body for this policy instance\n"
+          },
+          "404": {
+            "description": "There is no policy type with this policy_type_id\n"
+          },
+          "503": {
+            "description": "Potentially transient backend database error. Client should attempt to retry later."
+          }
+        }
+      },
+      "delete": {
+        "description": "Delete this policy instance\n",
+        "tags": [
+          "A1 Mediator"
+        ],
+        "operationId": "a1.controller.delete_policy_instance",
+        "responses": {
+          "202": {
+            "description": "policy instance deletion initiated\n"
+          },
+          "404": {
+            "description": "there is no policy instance with this policy_instance_id or there is no policy type with this policy_type_id\n"
+          },
+          "503": {
+            "description": "Potentially transient backend database error. Client should attempt to retry later."
+          }
+        }
+      },
+      "parameters": [
+        {
+          "maximum": 2147483647,
+          "minimum": 1,
+          "type": "integer",
+          "description": "represents a policy type identifier. Currently this is restricted to an integer range.\n",
+          "name": "policy_type_id",
+          "in": "path",
+          "required": true
+        },
+        {
+          "type": "string",
+          "description": "represents a policy instance identifier. UUIDs are advisable but can be any string\n",
+          "name": "policy_instance_id",
+          "in": "path",
+          "required": true
+        }
+      ]
+    },
+    "/a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id}/status": {
+      "get": {
+        "description": "Retrieve the policy instance status across all handlers of the policy If this endpoint returns successfully (200), it is either IN EFFECT or NOT IN EFFECT. IN EFFECT is returned if at least one policy handler in the RIC is implementing the policy NOT IN EFFECT is returned otherwise If a policy instance is successfully deleted, this endpoint will return a 404 (not a 200)\n",
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "A1 Mediator"
+        ],
+        "operationId": "a1.controller.get_policy_instance_status",
+        "responses": {
+          "200": {
+            "description": "successfully retrieved the status\n",
+            "schema": {
+              "type": "object",
+              "properties": {
+                "created_at": {
+                  "type": "string",
+                  "format": "date-time"
+                },
+                "has_been_deleted": {
+                  "type": "boolean"
+                },
+                "instance_status": {
+                  "type": "string",
+                  "enum": [
+                    "IN EFFECT",
+                    "NOT IN EFFECT"
+                  ]
+                }
+              }
+            }
+          },
+          "404": {
+            "description": "there is no policy instance with this policy_instance_id or there is no policy type with this policy_type_id\n"
+          },
+          "503": {
+            "description": "Potentially transient backend database error. Client should attempt to retry later."
+          }
+        }
+      },
+      "parameters": [
+        {
+          "maximum": 2147483647,
+          "minimum": 1,
+          "type": "integer",
+          "description": "represents a policy type identifier. Currently this is restricted to an integer range.\n",
+          "name": "policy_type_id",
+          "in": "path",
+          "required": true
+        },
+        {
+          "type": "string",
+          "description": "represents a policy instance identifier. UUIDs are advisable but can be any string\n",
+          "name": "policy_instance_id",
+          "in": "path",
+          "required": true
+        }
+      ]
+    },
+    "/data-delivery": {
+      "post": {
+        "description": "Deliver data produced by data producer.\n",
+        "consumes": [
+          "application/json"
+        ],
+        "tags": [
+          "A1 EI Data Delivery"
+        ],
+        "operationId": "a1.controller.data_delivery",
+        "parameters": [
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "description": "object to represent data object\n",
+              "type": "object"
+            }
+          }
+        ],
+        "responses": {
+          "200": {
+            "description": "successfully delivered data from data producer\n"
+          },
+          "404": {
+            "description": "no job id defined for this data delivery\n"
+          }
+        }
+      }
+    }
+  },
+  "definitions": {
+    "policy_instance_id": {
+      "description": "represents a policy instance identifier. UUIDs are advisable but can be any string\n",
+      "type": "string",
+      "example": "3d2157af-6a8f-4a7c-810f-38c2f824bf12"
+    },
+    "policy_type_id": {
+      "description": "represents a policy type identifier. Currently this is restricted to an integer range.\n",
+      "type": "integer",
+      "maximum": 2147483647,
+      "minimum": 1
+    },
+    "policy_type_schema": {
+      "type": "object",
+      "required": [
+        "name",
+        "description",
+        "policy_type_id",
+        "create_schema"
+      ],
+      "properties": {
+        "create_schema": {
+          "description": "jsonschema (following http://json-schema.org/draft-07/schema) of the CREATE payload to be sent to handlers of this policy\n",
+          "type": "object"
+        },
+        "description": {
+          "description": "description of the policy type",
+          "type": "string"
+        },
+        "name": {
+          "description": "name of the policy type",
+          "type": "string"
+        },
+        "policy_type_id": {
+          "description": "the integer of the policy type",
+          "type": "integer"
+        }
+      },
+      "additionalProperties": false
+    }
+  },
+  "x-components": {}
+}`))
+}
diff --git a/a1-go/pkg/restapi/operations/a1_api.go b/a1-go/pkg/restapi/operations/a1_api.go
new file mode 100644 (file)
index 0000000..dbe49c1
--- /dev/null
@@ -0,0 +1,426 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package operations
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "fmt"
+       "net/http"
+       "strings"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/loads"
+       "github.com/go-openapi/runtime"
+       "github.com/go-openapi/runtime/middleware"
+       "github.com/go-openapi/runtime/security"
+       "github.com/go-openapi/spec"
+       "github.com/go-openapi/strfmt"
+       "github.com/go-openapi/swag"
+
+       "subh.com/a1-go/pkg/restapi/operations/a1_e_i_data_delivery"
+       "subh.com/a1-go/pkg/restapi/operations/a1_mediator"
+)
+
+// NewA1API creates a new A1 instance
+func NewA1API(spec *loads.Document) *A1API {
+       return &A1API{
+               handlers:            make(map[string]map[string]http.Handler),
+               formats:             strfmt.Default,
+               defaultConsumes:     "application/json",
+               defaultProduces:     "application/json",
+               customConsumers:     make(map[string]runtime.Consumer),
+               customProducers:     make(map[string]runtime.Producer),
+               PreServerShutdown:   func() {},
+               ServerShutdown:      func() {},
+               spec:                spec,
+               ServeError:          errors.ServeError,
+               BasicAuthenticator:  security.BasicAuth,
+               APIKeyAuthenticator: security.APIKeyAuth,
+               BearerAuthenticator: security.BearerAuth,
+
+               JSONConsumer: runtime.JSONConsumer(),
+
+               JSONProducer: runtime.JSONProducer(),
+
+               A1MediatorA1ControllerCreateOrReplacePolicyInstanceHandler: a1_mediator.A1ControllerCreateOrReplacePolicyInstanceHandlerFunc(func(params a1_mediator.A1ControllerCreateOrReplacePolicyInstanceParams) middleware.Responder {
+                       return middleware.NotImplemented("operation a1_mediator.A1ControllerCreateOrReplacePolicyInstance has not yet been implemented")
+               }),
+               A1MediatorA1ControllerCreatePolicyTypeHandler: a1_mediator.A1ControllerCreatePolicyTypeHandlerFunc(func(params a1_mediator.A1ControllerCreatePolicyTypeParams) middleware.Responder {
+                       return middleware.NotImplemented("operation a1_mediator.A1ControllerCreatePolicyType has not yet been implemented")
+               }),
+               A1eiDataDeliveryA1ControllerDataDeliveryHandler: a1_e_i_data_delivery.A1ControllerDataDeliveryHandlerFunc(func(params a1_e_i_data_delivery.A1ControllerDataDeliveryParams) middleware.Responder {
+                       return middleware.NotImplemented("operation a1_e_i_data_delivery.A1ControllerDataDelivery has not yet been implemented")
+               }),
+               A1MediatorA1ControllerDeletePolicyInstanceHandler: a1_mediator.A1ControllerDeletePolicyInstanceHandlerFunc(func(params a1_mediator.A1ControllerDeletePolicyInstanceParams) middleware.Responder {
+                       return middleware.NotImplemented("operation a1_mediator.A1ControllerDeletePolicyInstance has not yet been implemented")
+               }),
+               A1MediatorA1ControllerDeletePolicyTypeHandler: a1_mediator.A1ControllerDeletePolicyTypeHandlerFunc(func(params a1_mediator.A1ControllerDeletePolicyTypeParams) middleware.Responder {
+                       return middleware.NotImplemented("operation a1_mediator.A1ControllerDeletePolicyType has not yet been implemented")
+               }),
+               A1MediatorA1ControllerGetAllInstancesForTypeHandler: a1_mediator.A1ControllerGetAllInstancesForTypeHandlerFunc(func(params a1_mediator.A1ControllerGetAllInstancesForTypeParams) middleware.Responder {
+                       return middleware.NotImplemented("operation a1_mediator.A1ControllerGetAllInstancesForType has not yet been implemented")
+               }),
+               A1MediatorA1ControllerGetAllPolicyTypesHandler: a1_mediator.A1ControllerGetAllPolicyTypesHandlerFunc(func(params a1_mediator.A1ControllerGetAllPolicyTypesParams) middleware.Responder {
+                       return middleware.NotImplemented("operation a1_mediator.A1ControllerGetAllPolicyTypes has not yet been implemented")
+               }),
+               A1MediatorA1ControllerGetHealthcheckHandler: a1_mediator.A1ControllerGetHealthcheckHandlerFunc(func(params a1_mediator.A1ControllerGetHealthcheckParams) middleware.Responder {
+                       return middleware.NotImplemented("operation a1_mediator.A1ControllerGetHealthcheck has not yet been implemented")
+               }),
+               A1MediatorA1ControllerGetPolicyInstanceHandler: a1_mediator.A1ControllerGetPolicyInstanceHandlerFunc(func(params a1_mediator.A1ControllerGetPolicyInstanceParams) middleware.Responder {
+                       return middleware.NotImplemented("operation a1_mediator.A1ControllerGetPolicyInstance has not yet been implemented")
+               }),
+               A1MediatorA1ControllerGetPolicyInstanceStatusHandler: a1_mediator.A1ControllerGetPolicyInstanceStatusHandlerFunc(func(params a1_mediator.A1ControllerGetPolicyInstanceStatusParams) middleware.Responder {
+                       return middleware.NotImplemented("operation a1_mediator.A1ControllerGetPolicyInstanceStatus has not yet been implemented")
+               }),
+               A1MediatorA1ControllerGetPolicyTypeHandler: a1_mediator.A1ControllerGetPolicyTypeHandlerFunc(func(params a1_mediator.A1ControllerGetPolicyTypeParams) middleware.Responder {
+                       return middleware.NotImplemented("operation a1_mediator.A1ControllerGetPolicyType has not yet been implemented")
+               }),
+       }
+}
+
+/*A1API the a1 API */
+type A1API struct {
+       spec            *loads.Document
+       context         *middleware.Context
+       handlers        map[string]map[string]http.Handler
+       formats         strfmt.Registry
+       customConsumers map[string]runtime.Consumer
+       customProducers map[string]runtime.Producer
+       defaultConsumes string
+       defaultProduces string
+       Middleware      func(middleware.Builder) http.Handler
+
+       // BasicAuthenticator generates a runtime.Authenticator from the supplied basic auth function.
+       // It has a default implementation in the security package, however you can replace it for your particular usage.
+       BasicAuthenticator func(security.UserPassAuthentication) runtime.Authenticator
+       // APIKeyAuthenticator generates a runtime.Authenticator from the supplied token auth function.
+       // It has a default implementation in the security package, however you can replace it for your particular usage.
+       APIKeyAuthenticator func(string, string, security.TokenAuthentication) runtime.Authenticator
+       // BearerAuthenticator generates a runtime.Authenticator from the supplied bearer token auth function.
+       // It has a default implementation in the security package, however you can replace it for your particular usage.
+       BearerAuthenticator func(string, security.ScopedTokenAuthentication) runtime.Authenticator
+
+       // JSONConsumer registers a consumer for the following mime types:
+       //   - application/json
+       JSONConsumer runtime.Consumer
+
+       // JSONProducer registers a producer for the following mime types:
+       //   - application/json
+       JSONProducer runtime.Producer
+
+       // A1MediatorA1ControllerCreateOrReplacePolicyInstanceHandler sets the operation handler for the a1 controller create or replace policy instance operation
+       A1MediatorA1ControllerCreateOrReplacePolicyInstanceHandler a1_mediator.A1ControllerCreateOrReplacePolicyInstanceHandler
+       // A1MediatorA1ControllerCreatePolicyTypeHandler sets the operation handler for the a1 controller create policy type operation
+       A1MediatorA1ControllerCreatePolicyTypeHandler a1_mediator.A1ControllerCreatePolicyTypeHandler
+       // A1eiDataDeliveryA1ControllerDataDeliveryHandler sets the operation handler for the a1 controller data delivery operation
+       A1eiDataDeliveryA1ControllerDataDeliveryHandler a1_e_i_data_delivery.A1ControllerDataDeliveryHandler
+       // A1MediatorA1ControllerDeletePolicyInstanceHandler sets the operation handler for the a1 controller delete policy instance operation
+       A1MediatorA1ControllerDeletePolicyInstanceHandler a1_mediator.A1ControllerDeletePolicyInstanceHandler
+       // A1MediatorA1ControllerDeletePolicyTypeHandler sets the operation handler for the a1 controller delete policy type operation
+       A1MediatorA1ControllerDeletePolicyTypeHandler a1_mediator.A1ControllerDeletePolicyTypeHandler
+       // A1MediatorA1ControllerGetAllInstancesForTypeHandler sets the operation handler for the a1 controller get all instances for type operation
+       A1MediatorA1ControllerGetAllInstancesForTypeHandler a1_mediator.A1ControllerGetAllInstancesForTypeHandler
+       // A1MediatorA1ControllerGetAllPolicyTypesHandler sets the operation handler for the a1 controller get all policy types operation
+       A1MediatorA1ControllerGetAllPolicyTypesHandler a1_mediator.A1ControllerGetAllPolicyTypesHandler
+       // A1MediatorA1ControllerGetHealthcheckHandler sets the operation handler for the a1 controller get healthcheck operation
+       A1MediatorA1ControllerGetHealthcheckHandler a1_mediator.A1ControllerGetHealthcheckHandler
+       // A1MediatorA1ControllerGetPolicyInstanceHandler sets the operation handler for the a1 controller get policy instance operation
+       A1MediatorA1ControllerGetPolicyInstanceHandler a1_mediator.A1ControllerGetPolicyInstanceHandler
+       // A1MediatorA1ControllerGetPolicyInstanceStatusHandler sets the operation handler for the a1 controller get policy instance status operation
+       A1MediatorA1ControllerGetPolicyInstanceStatusHandler a1_mediator.A1ControllerGetPolicyInstanceStatusHandler
+       // A1MediatorA1ControllerGetPolicyTypeHandler sets the operation handler for the a1 controller get policy type operation
+       A1MediatorA1ControllerGetPolicyTypeHandler a1_mediator.A1ControllerGetPolicyTypeHandler
+       // ServeError is called when an error is received, there is a default handler
+       // but you can set your own with this
+       ServeError func(http.ResponseWriter, *http.Request, error)
+
+       // PreServerShutdown is called before the HTTP(S) server is shutdown
+       // This allows for custom functions to get executed before the HTTP(S) server stops accepting traffic
+       PreServerShutdown func()
+
+       // ServerShutdown is called when the HTTP(S) server is shut down and done
+       // handling all active connections and does not accept connections any more
+       ServerShutdown func()
+
+       // Custom command line argument groups with their descriptions
+       CommandLineOptionsGroups []swag.CommandLineOptionsGroup
+
+       // User defined logger function.
+       Logger func(string, ...interface{})
+}
+
+// SetDefaultProduces sets the default produces media type
+func (o *A1API) SetDefaultProduces(mediaType string) {
+       o.defaultProduces = mediaType
+}
+
+// SetDefaultConsumes returns the default consumes media type
+func (o *A1API) SetDefaultConsumes(mediaType string) {
+       o.defaultConsumes = mediaType
+}
+
+// SetSpec sets a spec that will be served for the clients.
+func (o *A1API) SetSpec(spec *loads.Document) {
+       o.spec = spec
+}
+
+// DefaultProduces returns the default produces media type
+func (o *A1API) DefaultProduces() string {
+       return o.defaultProduces
+}
+
+// DefaultConsumes returns the default consumes media type
+func (o *A1API) DefaultConsumes() string {
+       return o.defaultConsumes
+}
+
+// Formats returns the registered string formats
+func (o *A1API) Formats() strfmt.Registry {
+       return o.formats
+}
+
+// RegisterFormat registers a custom format validator
+func (o *A1API) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator) {
+       o.formats.Add(name, format, validator)
+}
+
+// Validate validates the registrations in the A1API
+func (o *A1API) Validate() error {
+       var unregistered []string
+
+       if o.JSONConsumer == nil {
+               unregistered = append(unregistered, "JSONConsumer")
+       }
+
+       if o.JSONProducer == nil {
+               unregistered = append(unregistered, "JSONProducer")
+       }
+
+       if o.A1MediatorA1ControllerCreateOrReplacePolicyInstanceHandler == nil {
+               unregistered = append(unregistered, "a1_mediator.A1ControllerCreateOrReplacePolicyInstanceHandler")
+       }
+       if o.A1MediatorA1ControllerCreatePolicyTypeHandler == nil {
+               unregistered = append(unregistered, "a1_mediator.A1ControllerCreatePolicyTypeHandler")
+       }
+       if o.A1eiDataDeliveryA1ControllerDataDeliveryHandler == nil {
+               unregistered = append(unregistered, "a1_e_i_data_delivery.A1ControllerDataDeliveryHandler")
+       }
+       if o.A1MediatorA1ControllerDeletePolicyInstanceHandler == nil {
+               unregistered = append(unregistered, "a1_mediator.A1ControllerDeletePolicyInstanceHandler")
+       }
+       if o.A1MediatorA1ControllerDeletePolicyTypeHandler == nil {
+               unregistered = append(unregistered, "a1_mediator.A1ControllerDeletePolicyTypeHandler")
+       }
+       if o.A1MediatorA1ControllerGetAllInstancesForTypeHandler == nil {
+               unregistered = append(unregistered, "a1_mediator.A1ControllerGetAllInstancesForTypeHandler")
+       }
+       if o.A1MediatorA1ControllerGetAllPolicyTypesHandler == nil {
+               unregistered = append(unregistered, "a1_mediator.A1ControllerGetAllPolicyTypesHandler")
+       }
+       if o.A1MediatorA1ControllerGetHealthcheckHandler == nil {
+               unregistered = append(unregistered, "a1_mediator.A1ControllerGetHealthcheckHandler")
+       }
+       if o.A1MediatorA1ControllerGetPolicyInstanceHandler == nil {
+               unregistered = append(unregistered, "a1_mediator.A1ControllerGetPolicyInstanceHandler")
+       }
+       if o.A1MediatorA1ControllerGetPolicyInstanceStatusHandler == nil {
+               unregistered = append(unregistered, "a1_mediator.A1ControllerGetPolicyInstanceStatusHandler")
+       }
+       if o.A1MediatorA1ControllerGetPolicyTypeHandler == nil {
+               unregistered = append(unregistered, "a1_mediator.A1ControllerGetPolicyTypeHandler")
+       }
+
+       if len(unregistered) > 0 {
+               return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", "))
+       }
+
+       return nil
+}
+
+// ServeErrorFor gets a error handler for a given operation id
+func (o *A1API) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error) {
+       return o.ServeError
+}
+
+// AuthenticatorsFor gets the authenticators for the specified security schemes
+func (o *A1API) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator {
+       return nil
+}
+
+// Authorizer returns the registered authorizer
+func (o *A1API) Authorizer() runtime.Authorizer {
+       return nil
+}
+
+// ConsumersFor gets the consumers for the specified media types.
+// MIME type parameters are ignored here.
+func (o *A1API) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer {
+       result := make(map[string]runtime.Consumer, len(mediaTypes))
+       for _, mt := range mediaTypes {
+               switch mt {
+               case "application/json":
+                       result["application/json"] = o.JSONConsumer
+               }
+
+               if c, ok := o.customConsumers[mt]; ok {
+                       result[mt] = c
+               }
+       }
+       return result
+}
+
+// ProducersFor gets the producers for the specified media types.
+// MIME type parameters are ignored here.
+func (o *A1API) ProducersFor(mediaTypes []string) map[string]runtime.Producer {
+       result := make(map[string]runtime.Producer, len(mediaTypes))
+       for _, mt := range mediaTypes {
+               switch mt {
+               case "application/json":
+                       result["application/json"] = o.JSONProducer
+               }
+
+               if p, ok := o.customProducers[mt]; ok {
+                       result[mt] = p
+               }
+       }
+       return result
+}
+
+// HandlerFor gets a http.Handler for the provided operation method and path
+func (o *A1API) HandlerFor(method, path string) (http.Handler, bool) {
+       if o.handlers == nil {
+               return nil, false
+       }
+       um := strings.ToUpper(method)
+       if _, ok := o.handlers[um]; !ok {
+               return nil, false
+       }
+       if path == "/" {
+               path = ""
+       }
+       h, ok := o.handlers[um][path]
+       return h, ok
+}
+
+// Context returns the middleware context for the a1 API
+func (o *A1API) Context() *middleware.Context {
+       if o.context == nil {
+               o.context = middleware.NewRoutableContext(o.spec, o, nil)
+       }
+
+       return o.context
+}
+
+func (o *A1API) initHandlerCache() {
+       o.Context() // don't care about the result, just that the initialization happened
+       if o.handlers == nil {
+               o.handlers = make(map[string]map[string]http.Handler)
+       }
+
+       if o.handlers["PUT"] == nil {
+               o.handlers["PUT"] = make(map[string]http.Handler)
+       }
+       o.handlers["PUT"]["/a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id}"] = a1_mediator.NewA1ControllerCreateOrReplacePolicyInstance(o.context, o.A1MediatorA1ControllerCreateOrReplacePolicyInstanceHandler)
+       if o.handlers["PUT"] == nil {
+               o.handlers["PUT"] = make(map[string]http.Handler)
+       }
+       o.handlers["PUT"]["/a1-p/policytypes/{policy_type_id}"] = a1_mediator.NewA1ControllerCreatePolicyType(o.context, o.A1MediatorA1ControllerCreatePolicyTypeHandler)
+       if o.handlers["POST"] == nil {
+               o.handlers["POST"] = make(map[string]http.Handler)
+       }
+       o.handlers["POST"]["/data-delivery"] = a1_e_i_data_delivery.NewA1ControllerDataDelivery(o.context, o.A1eiDataDeliveryA1ControllerDataDeliveryHandler)
+       if o.handlers["DELETE"] == nil {
+               o.handlers["DELETE"] = make(map[string]http.Handler)
+       }
+       o.handlers["DELETE"]["/a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id}"] = a1_mediator.NewA1ControllerDeletePolicyInstance(o.context, o.A1MediatorA1ControllerDeletePolicyInstanceHandler)
+       if o.handlers["DELETE"] == nil {
+               o.handlers["DELETE"] = make(map[string]http.Handler)
+       }
+       o.handlers["DELETE"]["/a1-p/policytypes/{policy_type_id}"] = a1_mediator.NewA1ControllerDeletePolicyType(o.context, o.A1MediatorA1ControllerDeletePolicyTypeHandler)
+       if o.handlers["GET"] == nil {
+               o.handlers["GET"] = make(map[string]http.Handler)
+       }
+       o.handlers["GET"]["/a1-p/policytypes/{policy_type_id}/policies"] = a1_mediator.NewA1ControllerGetAllInstancesForType(o.context, o.A1MediatorA1ControllerGetAllInstancesForTypeHandler)
+       if o.handlers["GET"] == nil {
+               o.handlers["GET"] = make(map[string]http.Handler)
+       }
+       o.handlers["GET"]["/a1-p/policytypes"] = a1_mediator.NewA1ControllerGetAllPolicyTypes(o.context, o.A1MediatorA1ControllerGetAllPolicyTypesHandler)
+       if o.handlers["GET"] == nil {
+               o.handlers["GET"] = make(map[string]http.Handler)
+       }
+       o.handlers["GET"]["/a1-p/healthcheck"] = a1_mediator.NewA1ControllerGetHealthcheck(o.context, o.A1MediatorA1ControllerGetHealthcheckHandler)
+       if o.handlers["GET"] == nil {
+               o.handlers["GET"] = make(map[string]http.Handler)
+       }
+       o.handlers["GET"]["/a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id}"] = a1_mediator.NewA1ControllerGetPolicyInstance(o.context, o.A1MediatorA1ControllerGetPolicyInstanceHandler)
+       if o.handlers["GET"] == nil {
+               o.handlers["GET"] = make(map[string]http.Handler)
+       }
+       o.handlers["GET"]["/a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id}/status"] = a1_mediator.NewA1ControllerGetPolicyInstanceStatus(o.context, o.A1MediatorA1ControllerGetPolicyInstanceStatusHandler)
+       if o.handlers["GET"] == nil {
+               o.handlers["GET"] = make(map[string]http.Handler)
+       }
+       o.handlers["GET"]["/a1-p/policytypes/{policy_type_id}"] = a1_mediator.NewA1ControllerGetPolicyType(o.context, o.A1MediatorA1ControllerGetPolicyTypeHandler)
+}
+
+// Serve creates a http handler to serve the API over HTTP
+// can be used directly in http.ListenAndServe(":8000", api.Serve(nil))
+func (o *A1API) Serve(builder middleware.Builder) http.Handler {
+       o.Init()
+
+       if o.Middleware != nil {
+               return o.Middleware(builder)
+       }
+       return o.context.APIHandler(builder)
+}
+
+// Init allows you to just initialize the handler cache, you can then recompose the middleware as you see fit
+func (o *A1API) Init() {
+       if len(o.handlers) == 0 {
+               o.initHandlerCache()
+       }
+}
+
+// RegisterConsumer allows you to add (or override) a consumer for a media type.
+func (o *A1API) RegisterConsumer(mediaType string, consumer runtime.Consumer) {
+       o.customConsumers[mediaType] = consumer
+}
+
+// RegisterProducer allows you to add (or override) a producer for a media type.
+func (o *A1API) RegisterProducer(mediaType string, producer runtime.Producer) {
+       o.customProducers[mediaType] = producer
+}
+
+// AddMiddlewareFor adds a http middleware to existing handler
+func (o *A1API) AddMiddlewareFor(method, path string, builder middleware.Builder) {
+       um := strings.ToUpper(method)
+       if path == "/" {
+               path = ""
+       }
+       o.Init()
+       if h, ok := o.handlers[um][path]; ok {
+               o.handlers[method][path] = builder(h)
+       }
+}
diff --git a/a1-go/pkg/restapi/operations/a1_e_i_data_delivery/a1_controller_data_delivery.go b/a1-go/pkg/restapi/operations/a1_e_i_data_delivery/a1_controller_data_delivery.go
new file mode 100644 (file)
index 0000000..f2617d2
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_e_i_data_delivery
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/runtime/middleware"
+)
+
+// A1ControllerDataDeliveryHandlerFunc turns a function with the right signature into a a1 controller data delivery handler
+type A1ControllerDataDeliveryHandlerFunc func(A1ControllerDataDeliveryParams) middleware.Responder
+
+// Handle executing the request and returning a response
+func (fn A1ControllerDataDeliveryHandlerFunc) Handle(params A1ControllerDataDeliveryParams) middleware.Responder {
+       return fn(params)
+}
+
+// A1ControllerDataDeliveryHandler interface for that can handle valid a1 controller data delivery params
+type A1ControllerDataDeliveryHandler interface {
+       Handle(A1ControllerDataDeliveryParams) middleware.Responder
+}
+
+// NewA1ControllerDataDelivery creates a new http.Handler for the a1 controller data delivery operation
+func NewA1ControllerDataDelivery(ctx *middleware.Context, handler A1ControllerDataDeliveryHandler) *A1ControllerDataDelivery {
+       return &A1ControllerDataDelivery{Context: ctx, Handler: handler}
+}
+
+/*A1ControllerDataDelivery swagger:route POST /data-delivery A1 EI Data Delivery a1ControllerDataDelivery
+
+Deliver data produced by data producer.
+
+
+*/
+type A1ControllerDataDelivery struct {
+       Context *middleware.Context
+       Handler A1ControllerDataDeliveryHandler
+}
+
+func (o *A1ControllerDataDelivery) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
+       route, rCtx, _ := o.Context.RouteInfo(r)
+       if rCtx != nil {
+               r = rCtx
+       }
+       var Params = NewA1ControllerDataDeliveryParams()
+
+       if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
+               o.Context.Respond(rw, r, route.Produces, route, err)
+               return
+       }
+
+       res := o.Handler.Handle(Params) // actually handle the request
+
+       o.Context.Respond(rw, r, route.Produces, route, res)
+
+}
diff --git a/a1-go/pkg/restapi/operations/a1_e_i_data_delivery/a1_controller_data_delivery_parameters.go b/a1-go/pkg/restapi/operations/a1_e_i_data_delivery/a1_controller_data_delivery_parameters.go
new file mode 100644 (file)
index 0000000..c7c1e21
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_e_i_data_delivery
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/runtime"
+       "github.com/go-openapi/runtime/middleware"
+)
+
+// NewA1ControllerDataDeliveryParams creates a new A1ControllerDataDeliveryParams object
+// no default values defined in spec.
+func NewA1ControllerDataDeliveryParams() A1ControllerDataDeliveryParams {
+
+       return A1ControllerDataDeliveryParams{}
+}
+
+// A1ControllerDataDeliveryParams contains all the bound params for the a1 controller data delivery operation
+// typically these are obtained from a http.Request
+//
+// swagger:parameters a1.controller.data_delivery
+type A1ControllerDataDeliveryParams struct {
+
+       // HTTP Request Object
+       HTTPRequest *http.Request `json:"-"`
+
+       /*
+         In: body
+       */
+       Body interface{}
+}
+
+// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
+// for simple values it will use straight method calls.
+//
+// To ensure default values, the struct must have been initialized with NewA1ControllerDataDeliveryParams() beforehand.
+func (o *A1ControllerDataDeliveryParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
+       var res []error
+
+       o.HTTPRequest = r
+
+       if runtime.HasBody(r) {
+               defer r.Body.Close()
+               var body interface{}
+               if err := route.Consumer.Consume(r.Body, &body); err != nil {
+                       res = append(res, errors.NewParseError("body", "body", "", err))
+               } else {
+                       // no validation on generic interface
+                       o.Body = body
+               }
+       }
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
diff --git a/a1-go/pkg/restapi/operations/a1_e_i_data_delivery/a1_controller_data_delivery_responses.go b/a1-go/pkg/restapi/operations/a1_e_i_data_delivery/a1_controller_data_delivery_responses.go
new file mode 100644 (file)
index 0000000..471398d
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_e_i_data_delivery
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/runtime"
+)
+
+// A1ControllerDataDeliveryOKCode is the HTTP code returned for type A1ControllerDataDeliveryOK
+const A1ControllerDataDeliveryOKCode int = 200
+
+/*A1ControllerDataDeliveryOK successfully delivered data from data producer
+
+
+swagger:response a1ControllerDataDeliveryOK
+*/
+type A1ControllerDataDeliveryOK struct {
+}
+
+// NewA1ControllerDataDeliveryOK creates A1ControllerDataDeliveryOK with default headers values
+func NewA1ControllerDataDeliveryOK() *A1ControllerDataDeliveryOK {
+
+       return &A1ControllerDataDeliveryOK{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerDataDeliveryOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(200)
+}
+
+// A1ControllerDataDeliveryNotFoundCode is the HTTP code returned for type A1ControllerDataDeliveryNotFound
+const A1ControllerDataDeliveryNotFoundCode int = 404
+
+/*A1ControllerDataDeliveryNotFound no job id defined for this data delivery
+
+
+swagger:response a1ControllerDataDeliveryNotFound
+*/
+type A1ControllerDataDeliveryNotFound struct {
+}
+
+// NewA1ControllerDataDeliveryNotFound creates A1ControllerDataDeliveryNotFound with default headers values
+func NewA1ControllerDataDeliveryNotFound() *A1ControllerDataDeliveryNotFound {
+
+       return &A1ControllerDataDeliveryNotFound{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerDataDeliveryNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(404)
+}
diff --git a/a1-go/pkg/restapi/operations/a1_e_i_data_delivery/a1_controller_data_delivery_urlbuilder.go b/a1-go/pkg/restapi/operations/a1_e_i_data_delivery/a1_controller_data_delivery_urlbuilder.go
new file mode 100644 (file)
index 0000000..793e5fe
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_e_i_data_delivery
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "errors"
+       "net/url"
+       golangswaggerpaths "path"
+)
+
+// A1ControllerDataDeliveryURL generates an URL for the a1 controller data delivery operation
+type A1ControllerDataDeliveryURL struct {
+       _basePath string
+}
+
+// WithBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *A1ControllerDataDeliveryURL) WithBasePath(bp string) *A1ControllerDataDeliveryURL {
+       o.SetBasePath(bp)
+       return o
+}
+
+// SetBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *A1ControllerDataDeliveryURL) SetBasePath(bp string) {
+       o._basePath = bp
+}
+
+// Build a url path and query string
+func (o *A1ControllerDataDeliveryURL) Build() (*url.URL, error) {
+       var _result url.URL
+
+       var _path = "/data-delivery"
+
+       _basePath := o._basePath
+       _result.Path = golangswaggerpaths.Join(_basePath, _path)
+
+       return &_result, nil
+}
+
+// Must is a helper function to panic when the url builder returns an error
+func (o *A1ControllerDataDeliveryURL) Must(u *url.URL, err error) *url.URL {
+       if err != nil {
+               panic(err)
+       }
+       if u == nil {
+               panic("url can't be nil")
+       }
+       return u
+}
+
+// String returns the string representation of the path with query string
+func (o *A1ControllerDataDeliveryURL) String() string {
+       return o.Must(o.Build()).String()
+}
+
+// BuildFull builds a full url with scheme, host, path and query string
+func (o *A1ControllerDataDeliveryURL) BuildFull(scheme, host string) (*url.URL, error) {
+       if scheme == "" {
+               return nil, errors.New("scheme is required for a full url on A1ControllerDataDeliveryURL")
+       }
+       if host == "" {
+               return nil, errors.New("host is required for a full url on A1ControllerDataDeliveryURL")
+       }
+
+       base, err := o.Build()
+       if err != nil {
+               return nil, err
+       }
+
+       base.Scheme = scheme
+       base.Host = host
+       return base, nil
+}
+
+// StringFull returns the string representation of a complete url
+func (o *A1ControllerDataDeliveryURL) StringFull(scheme, host string) string {
+       return o.Must(o.BuildFull(scheme, host)).String()
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_or_replace_policy_instance.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_or_replace_policy_instance.go
new file mode 100644 (file)
index 0000000..23e1f04
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/runtime/middleware"
+)
+
+// A1ControllerCreateOrReplacePolicyInstanceHandlerFunc turns a function with the right signature into a a1 controller create or replace policy instance handler
+type A1ControllerCreateOrReplacePolicyInstanceHandlerFunc func(A1ControllerCreateOrReplacePolicyInstanceParams) middleware.Responder
+
+// Handle executing the request and returning a response
+func (fn A1ControllerCreateOrReplacePolicyInstanceHandlerFunc) Handle(params A1ControllerCreateOrReplacePolicyInstanceParams) middleware.Responder {
+       return fn(params)
+}
+
+// A1ControllerCreateOrReplacePolicyInstanceHandler interface for that can handle valid a1 controller create or replace policy instance params
+type A1ControllerCreateOrReplacePolicyInstanceHandler interface {
+       Handle(A1ControllerCreateOrReplacePolicyInstanceParams) middleware.Responder
+}
+
+// NewA1ControllerCreateOrReplacePolicyInstance creates a new http.Handler for the a1 controller create or replace policy instance operation
+func NewA1ControllerCreateOrReplacePolicyInstance(ctx *middleware.Context, handler A1ControllerCreateOrReplacePolicyInstanceHandler) *A1ControllerCreateOrReplacePolicyInstance {
+       return &A1ControllerCreateOrReplacePolicyInstance{Context: ctx, Handler: handler}
+}
+
+/*A1ControllerCreateOrReplacePolicyInstance swagger:route PUT /a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id} A1 Mediator a1ControllerCreateOrReplacePolicyInstance
+
+Create or replace a policy instance of type policy_type_id. The schema of the PUT body is defined by the create_schema field of the policy type.
+
+
+*/
+type A1ControllerCreateOrReplacePolicyInstance struct {
+       Context *middleware.Context
+       Handler A1ControllerCreateOrReplacePolicyInstanceHandler
+}
+
+func (o *A1ControllerCreateOrReplacePolicyInstance) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
+       route, rCtx, _ := o.Context.RouteInfo(r)
+       if rCtx != nil {
+               r = rCtx
+       }
+       var Params = NewA1ControllerCreateOrReplacePolicyInstanceParams()
+
+       if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
+               o.Context.Respond(rw, r, route.Produces, route, err)
+               return
+       }
+
+       res := o.Handler.Handle(Params) // actually handle the request
+
+       o.Context.Respond(rw, r, route.Produces, route, res)
+
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_or_replace_policy_instance_parameters.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_or_replace_policy_instance_parameters.go
new file mode 100644 (file)
index 0000000..e9b8498
--- /dev/null
@@ -0,0 +1,160 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/runtime"
+       "github.com/go-openapi/runtime/middleware"
+       "github.com/go-openapi/strfmt"
+       "github.com/go-openapi/swag"
+       "github.com/go-openapi/validate"
+)
+
+// NewA1ControllerCreateOrReplacePolicyInstanceParams creates a new A1ControllerCreateOrReplacePolicyInstanceParams object
+// no default values defined in spec.
+func NewA1ControllerCreateOrReplacePolicyInstanceParams() A1ControllerCreateOrReplacePolicyInstanceParams {
+
+       return A1ControllerCreateOrReplacePolicyInstanceParams{}
+}
+
+// A1ControllerCreateOrReplacePolicyInstanceParams contains all the bound params for the a1 controller create or replace policy instance operation
+// typically these are obtained from a http.Request
+//
+// swagger:parameters a1.controller.create_or_replace_policy_instance
+type A1ControllerCreateOrReplacePolicyInstanceParams struct {
+
+       // HTTP Request Object
+       HTTPRequest *http.Request `json:"-"`
+
+       /*
+         In: body
+       */
+       Body interface{}
+       /*represents a policy instance identifier. UUIDs are advisable but can be any string
+
+         Required: true
+         In: path
+       */
+       PolicyInstanceID string
+       /*represents a policy type identifier. Currently this is restricted to an integer range.
+
+         Required: true
+         Maximum: 2.147483647e+09
+         Minimum: 1
+         In: path
+       */
+       PolicyTypeID int64
+}
+
+// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
+// for simple values it will use straight method calls.
+//
+// To ensure default values, the struct must have been initialized with NewA1ControllerCreateOrReplacePolicyInstanceParams() beforehand.
+func (o *A1ControllerCreateOrReplacePolicyInstanceParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
+       var res []error
+
+       o.HTTPRequest = r
+
+       if runtime.HasBody(r) {
+               defer r.Body.Close()
+               var body interface{}
+               if err := route.Consumer.Consume(r.Body, &body); err != nil {
+                       res = append(res, errors.NewParseError("body", "body", "", err))
+               } else {
+                       // no validation on generic interface
+                       o.Body = body
+               }
+       }
+       rPolicyInstanceID, rhkPolicyInstanceID, _ := route.Params.GetOK("policy_instance_id")
+       if err := o.bindPolicyInstanceID(rPolicyInstanceID, rhkPolicyInstanceID, route.Formats); err != nil {
+               res = append(res, err)
+       }
+
+       rPolicyTypeID, rhkPolicyTypeID, _ := route.Params.GetOK("policy_type_id")
+       if err := o.bindPolicyTypeID(rPolicyTypeID, rhkPolicyTypeID, route.Formats); err != nil {
+               res = append(res, err)
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
+
+// bindPolicyInstanceID binds and validates parameter PolicyInstanceID from path.
+func (o *A1ControllerCreateOrReplacePolicyInstanceParams) bindPolicyInstanceID(rawData []string, hasKey bool, formats strfmt.Registry) error {
+       var raw string
+       if len(rawData) > 0 {
+               raw = rawData[len(rawData)-1]
+       }
+
+       // Required: true
+       // Parameter is provided by construction from the route
+
+       o.PolicyInstanceID = raw
+
+       return nil
+}
+
+// bindPolicyTypeID binds and validates parameter PolicyTypeID from path.
+func (o *A1ControllerCreateOrReplacePolicyInstanceParams) bindPolicyTypeID(rawData []string, hasKey bool, formats strfmt.Registry) error {
+       var raw string
+       if len(rawData) > 0 {
+               raw = rawData[len(rawData)-1]
+       }
+
+       // Required: true
+       // Parameter is provided by construction from the route
+
+       value, err := swag.ConvertInt64(raw)
+       if err != nil {
+               return errors.InvalidType("policy_type_id", "path", "int64", raw)
+       }
+       o.PolicyTypeID = value
+
+       if err := o.validatePolicyTypeID(formats); err != nil {
+               return err
+       }
+
+       return nil
+}
+
+// validatePolicyTypeID carries on validations for parameter PolicyTypeID
+func (o *A1ControllerCreateOrReplacePolicyInstanceParams) validatePolicyTypeID(formats strfmt.Registry) error {
+
+       if err := validate.MinimumInt("policy_type_id", "path", int64(o.PolicyTypeID), 1, false); err != nil {
+               return err
+       }
+
+       if err := validate.MaximumInt("policy_type_id", "path", int64(o.PolicyTypeID), 2.147483647e+09, false); err != nil {
+               return err
+       }
+
+       return nil
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_or_replace_policy_instance_responses.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_or_replace_policy_instance_responses.go
new file mode 100644 (file)
index 0000000..1856ac3
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/runtime"
+)
+
+// A1ControllerCreateOrReplacePolicyInstanceAcceptedCode is the HTTP code returned for type A1ControllerCreateOrReplacePolicyInstanceAccepted
+const A1ControllerCreateOrReplacePolicyInstanceAcceptedCode int = 202
+
+/*A1ControllerCreateOrReplacePolicyInstanceAccepted Policy instance creation initiated
+
+
+swagger:response a1ControllerCreateOrReplacePolicyInstanceAccepted
+*/
+type A1ControllerCreateOrReplacePolicyInstanceAccepted struct {
+}
+
+// NewA1ControllerCreateOrReplacePolicyInstanceAccepted creates A1ControllerCreateOrReplacePolicyInstanceAccepted with default headers values
+func NewA1ControllerCreateOrReplacePolicyInstanceAccepted() *A1ControllerCreateOrReplacePolicyInstanceAccepted {
+
+       return &A1ControllerCreateOrReplacePolicyInstanceAccepted{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerCreateOrReplacePolicyInstanceAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(202)
+}
+
+// A1ControllerCreateOrReplacePolicyInstanceBadRequestCode is the HTTP code returned for type A1ControllerCreateOrReplacePolicyInstanceBadRequest
+const A1ControllerCreateOrReplacePolicyInstanceBadRequestCode int = 400
+
+/*A1ControllerCreateOrReplacePolicyInstanceBadRequest Bad PUT body for this policy instance
+
+
+swagger:response a1ControllerCreateOrReplacePolicyInstanceBadRequest
+*/
+type A1ControllerCreateOrReplacePolicyInstanceBadRequest struct {
+}
+
+// NewA1ControllerCreateOrReplacePolicyInstanceBadRequest creates A1ControllerCreateOrReplacePolicyInstanceBadRequest with default headers values
+func NewA1ControllerCreateOrReplacePolicyInstanceBadRequest() *A1ControllerCreateOrReplacePolicyInstanceBadRequest {
+
+       return &A1ControllerCreateOrReplacePolicyInstanceBadRequest{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerCreateOrReplacePolicyInstanceBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(400)
+}
+
+// A1ControllerCreateOrReplacePolicyInstanceNotFoundCode is the HTTP code returned for type A1ControllerCreateOrReplacePolicyInstanceNotFound
+const A1ControllerCreateOrReplacePolicyInstanceNotFoundCode int = 404
+
+/*A1ControllerCreateOrReplacePolicyInstanceNotFound There is no policy type with this policy_type_id
+
+
+swagger:response a1ControllerCreateOrReplacePolicyInstanceNotFound
+*/
+type A1ControllerCreateOrReplacePolicyInstanceNotFound struct {
+}
+
+// NewA1ControllerCreateOrReplacePolicyInstanceNotFound creates A1ControllerCreateOrReplacePolicyInstanceNotFound with default headers values
+func NewA1ControllerCreateOrReplacePolicyInstanceNotFound() *A1ControllerCreateOrReplacePolicyInstanceNotFound {
+
+       return &A1ControllerCreateOrReplacePolicyInstanceNotFound{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerCreateOrReplacePolicyInstanceNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(404)
+}
+
+// A1ControllerCreateOrReplacePolicyInstanceServiceUnavailableCode is the HTTP code returned for type A1ControllerCreateOrReplacePolicyInstanceServiceUnavailable
+const A1ControllerCreateOrReplacePolicyInstanceServiceUnavailableCode int = 503
+
+/*A1ControllerCreateOrReplacePolicyInstanceServiceUnavailable Potentially transient backend database error. Client should attempt to retry later.
+
+swagger:response a1ControllerCreateOrReplacePolicyInstanceServiceUnavailable
+*/
+type A1ControllerCreateOrReplacePolicyInstanceServiceUnavailable struct {
+}
+
+// NewA1ControllerCreateOrReplacePolicyInstanceServiceUnavailable creates A1ControllerCreateOrReplacePolicyInstanceServiceUnavailable with default headers values
+func NewA1ControllerCreateOrReplacePolicyInstanceServiceUnavailable() *A1ControllerCreateOrReplacePolicyInstanceServiceUnavailable {
+
+       return &A1ControllerCreateOrReplacePolicyInstanceServiceUnavailable{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerCreateOrReplacePolicyInstanceServiceUnavailable) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(503)
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_or_replace_policy_instance_urlbuilder.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_or_replace_policy_instance_urlbuilder.go
new file mode 100644 (file)
index 0000000..4c28a69
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "errors"
+       "net/url"
+       golangswaggerpaths "path"
+       "strings"
+
+       "github.com/go-openapi/swag"
+)
+
+// A1ControllerCreateOrReplacePolicyInstanceURL generates an URL for the a1 controller create or replace policy instance operation
+type A1ControllerCreateOrReplacePolicyInstanceURL struct {
+       PolicyInstanceID string
+       PolicyTypeID     int64
+
+       _basePath string
+       // avoid unkeyed usage
+       _ struct{}
+}
+
+// WithBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *A1ControllerCreateOrReplacePolicyInstanceURL) WithBasePath(bp string) *A1ControllerCreateOrReplacePolicyInstanceURL {
+       o.SetBasePath(bp)
+       return o
+}
+
+// SetBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *A1ControllerCreateOrReplacePolicyInstanceURL) SetBasePath(bp string) {
+       o._basePath = bp
+}
+
+// Build a url path and query string
+func (o *A1ControllerCreateOrReplacePolicyInstanceURL) Build() (*url.URL, error) {
+       var _result url.URL
+
+       var _path = "/a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id}"
+
+       policyInstanceID := o.PolicyInstanceID
+       if policyInstanceID != "" {
+               _path = strings.Replace(_path, "{policy_instance_id}", policyInstanceID, -1)
+       } else {
+               return nil, errors.New("policyInstanceId is required on A1ControllerCreateOrReplacePolicyInstanceURL")
+       }
+
+       policyTypeID := swag.FormatInt64(o.PolicyTypeID)
+       if policyTypeID != "" {
+               _path = strings.Replace(_path, "{policy_type_id}", policyTypeID, -1)
+       } else {
+               return nil, errors.New("policyTypeId is required on A1ControllerCreateOrReplacePolicyInstanceURL")
+       }
+
+       _basePath := o._basePath
+       _result.Path = golangswaggerpaths.Join(_basePath, _path)
+
+       return &_result, nil
+}
+
+// Must is a helper function to panic when the url builder returns an error
+func (o *A1ControllerCreateOrReplacePolicyInstanceURL) Must(u *url.URL, err error) *url.URL {
+       if err != nil {
+               panic(err)
+       }
+       if u == nil {
+               panic("url can't be nil")
+       }
+       return u
+}
+
+// String returns the string representation of the path with query string
+func (o *A1ControllerCreateOrReplacePolicyInstanceURL) String() string {
+       return o.Must(o.Build()).String()
+}
+
+// BuildFull builds a full url with scheme, host, path and query string
+func (o *A1ControllerCreateOrReplacePolicyInstanceURL) BuildFull(scheme, host string) (*url.URL, error) {
+       if scheme == "" {
+               return nil, errors.New("scheme is required for a full url on A1ControllerCreateOrReplacePolicyInstanceURL")
+       }
+       if host == "" {
+               return nil, errors.New("host is required for a full url on A1ControllerCreateOrReplacePolicyInstanceURL")
+       }
+
+       base, err := o.Build()
+       if err != nil {
+               return nil, err
+       }
+
+       base.Scheme = scheme
+       base.Host = host
+       return base, nil
+}
+
+// StringFull returns the string representation of a complete url
+func (o *A1ControllerCreateOrReplacePolicyInstanceURL) StringFull(scheme, host string) string {
+       return o.Must(o.BuildFull(scheme, host)).String()
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_policy_type.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_policy_type.go
new file mode 100644 (file)
index 0000000..28aef97
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/runtime/middleware"
+)
+
+// A1ControllerCreatePolicyTypeHandlerFunc turns a function with the right signature into a a1 controller create policy type handler
+type A1ControllerCreatePolicyTypeHandlerFunc func(A1ControllerCreatePolicyTypeParams) middleware.Responder
+
+// Handle executing the request and returning a response
+func (fn A1ControllerCreatePolicyTypeHandlerFunc) Handle(params A1ControllerCreatePolicyTypeParams) middleware.Responder {
+       return fn(params)
+}
+
+// A1ControllerCreatePolicyTypeHandler interface for that can handle valid a1 controller create policy type params
+type A1ControllerCreatePolicyTypeHandler interface {
+       Handle(A1ControllerCreatePolicyTypeParams) middleware.Responder
+}
+
+// NewA1ControllerCreatePolicyType creates a new http.Handler for the a1 controller create policy type operation
+func NewA1ControllerCreatePolicyType(ctx *middleware.Context, handler A1ControllerCreatePolicyTypeHandler) *A1ControllerCreatePolicyType {
+       return &A1ControllerCreatePolicyType{Context: ctx, Handler: handler}
+}
+
+/*A1ControllerCreatePolicyType swagger:route PUT /a1-p/policytypes/{policy_type_id} A1 Mediator a1ControllerCreatePolicyType
+
+Create a new policy type . Replace is not currently allowed; to replace, for now do a DELETE and then a PUT again.
+
+
+*/
+type A1ControllerCreatePolicyType struct {
+       Context *middleware.Context
+       Handler A1ControllerCreatePolicyTypeHandler
+}
+
+func (o *A1ControllerCreatePolicyType) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
+       route, rCtx, _ := o.Context.RouteInfo(r)
+       if rCtx != nil {
+               r = rCtx
+       }
+       var Params = NewA1ControllerCreatePolicyTypeParams()
+
+       if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
+               o.Context.Respond(rw, r, route.Produces, route, err)
+               return
+       }
+
+       res := o.Handler.Handle(Params) // actually handle the request
+
+       o.Context.Respond(rw, r, route.Produces, route, res)
+
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_policy_type_parameters.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_policy_type_parameters.go
new file mode 100644 (file)
index 0000000..b7e6a92
--- /dev/null
@@ -0,0 +1,142 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/runtime"
+       "github.com/go-openapi/runtime/middleware"
+       "github.com/go-openapi/strfmt"
+       "github.com/go-openapi/swag"
+       "github.com/go-openapi/validate"
+
+       "subh.com/a1-go/pkg/models"
+)
+
+// NewA1ControllerCreatePolicyTypeParams creates a new A1ControllerCreatePolicyTypeParams object
+// no default values defined in spec.
+func NewA1ControllerCreatePolicyTypeParams() A1ControllerCreatePolicyTypeParams {
+
+       return A1ControllerCreatePolicyTypeParams{}
+}
+
+// A1ControllerCreatePolicyTypeParams contains all the bound params for the a1 controller create policy type operation
+// typically these are obtained from a http.Request
+//
+// swagger:parameters a1.controller.create_policy_type
+type A1ControllerCreatePolicyTypeParams struct {
+
+       // HTTP Request Object
+       HTTPRequest *http.Request `json:"-"`
+
+       /*
+         In: body
+       */
+       Body *models.PolicyTypeSchema
+       /*represents a policy type identifier. Currently this is restricted to an integer range.
+
+         Required: true
+         Maximum: 2.147483647e+09
+         Minimum: 1
+         In: path
+       */
+       PolicyTypeID int64
+}
+
+// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
+// for simple values it will use straight method calls.
+//
+// To ensure default values, the struct must have been initialized with NewA1ControllerCreatePolicyTypeParams() beforehand.
+func (o *A1ControllerCreatePolicyTypeParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
+       var res []error
+
+       o.HTTPRequest = r
+
+       if runtime.HasBody(r) {
+               defer r.Body.Close()
+               var body models.PolicyTypeSchema
+               if err := route.Consumer.Consume(r.Body, &body); err != nil {
+                       res = append(res, errors.NewParseError("body", "body", "", err))
+               } else {
+                       // validate body object
+                       if err := body.Validate(route.Formats); err != nil {
+                               res = append(res, err)
+                       }
+
+                       if len(res) == 0 {
+                               o.Body = &body
+                       }
+               }
+       }
+       rPolicyTypeID, rhkPolicyTypeID, _ := route.Params.GetOK("policy_type_id")
+       if err := o.bindPolicyTypeID(rPolicyTypeID, rhkPolicyTypeID, route.Formats); err != nil {
+               res = append(res, err)
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
+
+// bindPolicyTypeID binds and validates parameter PolicyTypeID from path.
+func (o *A1ControllerCreatePolicyTypeParams) bindPolicyTypeID(rawData []string, hasKey bool, formats strfmt.Registry) error {
+       var raw string
+       if len(rawData) > 0 {
+               raw = rawData[len(rawData)-1]
+       }
+
+       // Required: true
+       // Parameter is provided by construction from the route
+
+       value, err := swag.ConvertInt64(raw)
+       if err != nil {
+               return errors.InvalidType("policy_type_id", "path", "int64", raw)
+       }
+       o.PolicyTypeID = value
+
+       if err := o.validatePolicyTypeID(formats); err != nil {
+               return err
+       }
+
+       return nil
+}
+
+// validatePolicyTypeID carries on validations for parameter PolicyTypeID
+func (o *A1ControllerCreatePolicyTypeParams) validatePolicyTypeID(formats strfmt.Registry) error {
+
+       if err := validate.MinimumInt("policy_type_id", "path", int64(o.PolicyTypeID), 1, false); err != nil {
+               return err
+       }
+
+       if err := validate.MaximumInt("policy_type_id", "path", int64(o.PolicyTypeID), 2.147483647e+09, false); err != nil {
+               return err
+       }
+
+       return nil
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_policy_type_responses.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_policy_type_responses.go
new file mode 100644 (file)
index 0000000..624001d
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/runtime"
+)
+
+// A1ControllerCreatePolicyTypeCreatedCode is the HTTP code returned for type A1ControllerCreatePolicyTypeCreated
+const A1ControllerCreatePolicyTypeCreatedCode int = 201
+
+/*A1ControllerCreatePolicyTypeCreated policy type successfully created
+
+swagger:response a1ControllerCreatePolicyTypeCreated
+*/
+type A1ControllerCreatePolicyTypeCreated struct {
+}
+
+// NewA1ControllerCreatePolicyTypeCreated creates A1ControllerCreatePolicyTypeCreated with default headers values
+func NewA1ControllerCreatePolicyTypeCreated() *A1ControllerCreatePolicyTypeCreated {
+
+       return &A1ControllerCreatePolicyTypeCreated{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerCreatePolicyTypeCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(201)
+}
+
+// A1ControllerCreatePolicyTypeBadRequestCode is the HTTP code returned for type A1ControllerCreatePolicyTypeBadRequest
+const A1ControllerCreatePolicyTypeBadRequestCode int = 400
+
+/*A1ControllerCreatePolicyTypeBadRequest illegal ID, or object already existed
+
+swagger:response a1ControllerCreatePolicyTypeBadRequest
+*/
+type A1ControllerCreatePolicyTypeBadRequest struct {
+}
+
+// NewA1ControllerCreatePolicyTypeBadRequest creates A1ControllerCreatePolicyTypeBadRequest with default headers values
+func NewA1ControllerCreatePolicyTypeBadRequest() *A1ControllerCreatePolicyTypeBadRequest {
+
+       return &A1ControllerCreatePolicyTypeBadRequest{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerCreatePolicyTypeBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(400)
+}
+
+// A1ControllerCreatePolicyTypeServiceUnavailableCode is the HTTP code returned for type A1ControllerCreatePolicyTypeServiceUnavailable
+const A1ControllerCreatePolicyTypeServiceUnavailableCode int = 503
+
+/*A1ControllerCreatePolicyTypeServiceUnavailable Potentially transient backend database error. Client should attempt to retry later.
+
+swagger:response a1ControllerCreatePolicyTypeServiceUnavailable
+*/
+type A1ControllerCreatePolicyTypeServiceUnavailable struct {
+}
+
+// NewA1ControllerCreatePolicyTypeServiceUnavailable creates A1ControllerCreatePolicyTypeServiceUnavailable with default headers values
+func NewA1ControllerCreatePolicyTypeServiceUnavailable() *A1ControllerCreatePolicyTypeServiceUnavailable {
+
+       return &A1ControllerCreatePolicyTypeServiceUnavailable{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerCreatePolicyTypeServiceUnavailable) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(503)
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_policy_type_urlbuilder.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_create_policy_type_urlbuilder.go
new file mode 100644 (file)
index 0000000..5825707
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "errors"
+       "net/url"
+       golangswaggerpaths "path"
+       "strings"
+
+       "github.com/go-openapi/swag"
+)
+
+// A1ControllerCreatePolicyTypeURL generates an URL for the a1 controller create policy type operation
+type A1ControllerCreatePolicyTypeURL struct {
+       PolicyTypeID int64
+
+       _basePath string
+       // avoid unkeyed usage
+       _ struct{}
+}
+
+// WithBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *A1ControllerCreatePolicyTypeURL) WithBasePath(bp string) *A1ControllerCreatePolicyTypeURL {
+       o.SetBasePath(bp)
+       return o
+}
+
+// SetBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *A1ControllerCreatePolicyTypeURL) SetBasePath(bp string) {
+       o._basePath = bp
+}
+
+// Build a url path and query string
+func (o *A1ControllerCreatePolicyTypeURL) Build() (*url.URL, error) {
+       var _result url.URL
+
+       var _path = "/a1-p/policytypes/{policy_type_id}"
+
+       policyTypeID := swag.FormatInt64(o.PolicyTypeID)
+       if policyTypeID != "" {
+               _path = strings.Replace(_path, "{policy_type_id}", policyTypeID, -1)
+       } else {
+               return nil, errors.New("policyTypeId is required on A1ControllerCreatePolicyTypeURL")
+       }
+
+       _basePath := o._basePath
+       _result.Path = golangswaggerpaths.Join(_basePath, _path)
+
+       return &_result, nil
+}
+
+// Must is a helper function to panic when the url builder returns an error
+func (o *A1ControllerCreatePolicyTypeURL) Must(u *url.URL, err error) *url.URL {
+       if err != nil {
+               panic(err)
+       }
+       if u == nil {
+               panic("url can't be nil")
+       }
+       return u
+}
+
+// String returns the string representation of the path with query string
+func (o *A1ControllerCreatePolicyTypeURL) String() string {
+       return o.Must(o.Build()).String()
+}
+
+// BuildFull builds a full url with scheme, host, path and query string
+func (o *A1ControllerCreatePolicyTypeURL) BuildFull(scheme, host string) (*url.URL, error) {
+       if scheme == "" {
+               return nil, errors.New("scheme is required for a full url on A1ControllerCreatePolicyTypeURL")
+       }
+       if host == "" {
+               return nil, errors.New("host is required for a full url on A1ControllerCreatePolicyTypeURL")
+       }
+
+       base, err := o.Build()
+       if err != nil {
+               return nil, err
+       }
+
+       base.Scheme = scheme
+       base.Host = host
+       return base, nil
+}
+
+// StringFull returns the string representation of a complete url
+func (o *A1ControllerCreatePolicyTypeURL) StringFull(scheme, host string) string {
+       return o.Must(o.BuildFull(scheme, host)).String()
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_instance.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_instance.go
new file mode 100644 (file)
index 0000000..f75ceee
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/runtime/middleware"
+)
+
+// A1ControllerDeletePolicyInstanceHandlerFunc turns a function with the right signature into a a1 controller delete policy instance handler
+type A1ControllerDeletePolicyInstanceHandlerFunc func(A1ControllerDeletePolicyInstanceParams) middleware.Responder
+
+// Handle executing the request and returning a response
+func (fn A1ControllerDeletePolicyInstanceHandlerFunc) Handle(params A1ControllerDeletePolicyInstanceParams) middleware.Responder {
+       return fn(params)
+}
+
+// A1ControllerDeletePolicyInstanceHandler interface for that can handle valid a1 controller delete policy instance params
+type A1ControllerDeletePolicyInstanceHandler interface {
+       Handle(A1ControllerDeletePolicyInstanceParams) middleware.Responder
+}
+
+// NewA1ControllerDeletePolicyInstance creates a new http.Handler for the a1 controller delete policy instance operation
+func NewA1ControllerDeletePolicyInstance(ctx *middleware.Context, handler A1ControllerDeletePolicyInstanceHandler) *A1ControllerDeletePolicyInstance {
+       return &A1ControllerDeletePolicyInstance{Context: ctx, Handler: handler}
+}
+
+/*A1ControllerDeletePolicyInstance swagger:route DELETE /a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id} A1 Mediator a1ControllerDeletePolicyInstance
+
+Delete this policy instance
+
+
+*/
+type A1ControllerDeletePolicyInstance struct {
+       Context *middleware.Context
+       Handler A1ControllerDeletePolicyInstanceHandler
+}
+
+func (o *A1ControllerDeletePolicyInstance) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
+       route, rCtx, _ := o.Context.RouteInfo(r)
+       if rCtx != nil {
+               r = rCtx
+       }
+       var Params = NewA1ControllerDeletePolicyInstanceParams()
+
+       if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
+               o.Context.Respond(rw, r, route.Produces, route, err)
+               return
+       }
+
+       res := o.Handler.Handle(Params) // actually handle the request
+
+       o.Context.Respond(rw, r, route.Produces, route, res)
+
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_instance_parameters.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_instance_parameters.go
new file mode 100644 (file)
index 0000000..b1afbec
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/runtime/middleware"
+       "github.com/go-openapi/strfmt"
+       "github.com/go-openapi/swag"
+       "github.com/go-openapi/validate"
+)
+
+// NewA1ControllerDeletePolicyInstanceParams creates a new A1ControllerDeletePolicyInstanceParams object
+// no default values defined in spec.
+func NewA1ControllerDeletePolicyInstanceParams() A1ControllerDeletePolicyInstanceParams {
+
+       return A1ControllerDeletePolicyInstanceParams{}
+}
+
+// A1ControllerDeletePolicyInstanceParams contains all the bound params for the a1 controller delete policy instance operation
+// typically these are obtained from a http.Request
+//
+// swagger:parameters a1.controller.delete_policy_instance
+type A1ControllerDeletePolicyInstanceParams struct {
+
+       // HTTP Request Object
+       HTTPRequest *http.Request `json:"-"`
+
+       /*represents a policy instance identifier. UUIDs are advisable but can be any string
+
+         Required: true
+         In: path
+       */
+       PolicyInstanceID string
+       /*represents a policy type identifier. Currently this is restricted to an integer range.
+
+         Required: true
+         Maximum: 2.147483647e+09
+         Minimum: 1
+         In: path
+       */
+       PolicyTypeID int64
+}
+
+// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
+// for simple values it will use straight method calls.
+//
+// To ensure default values, the struct must have been initialized with NewA1ControllerDeletePolicyInstanceParams() beforehand.
+func (o *A1ControllerDeletePolicyInstanceParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
+       var res []error
+
+       o.HTTPRequest = r
+
+       rPolicyInstanceID, rhkPolicyInstanceID, _ := route.Params.GetOK("policy_instance_id")
+       if err := o.bindPolicyInstanceID(rPolicyInstanceID, rhkPolicyInstanceID, route.Formats); err != nil {
+               res = append(res, err)
+       }
+
+       rPolicyTypeID, rhkPolicyTypeID, _ := route.Params.GetOK("policy_type_id")
+       if err := o.bindPolicyTypeID(rPolicyTypeID, rhkPolicyTypeID, route.Formats); err != nil {
+               res = append(res, err)
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
+
+// bindPolicyInstanceID binds and validates parameter PolicyInstanceID from path.
+func (o *A1ControllerDeletePolicyInstanceParams) bindPolicyInstanceID(rawData []string, hasKey bool, formats strfmt.Registry) error {
+       var raw string
+       if len(rawData) > 0 {
+               raw = rawData[len(rawData)-1]
+       }
+
+       // Required: true
+       // Parameter is provided by construction from the route
+
+       o.PolicyInstanceID = raw
+
+       return nil
+}
+
+// bindPolicyTypeID binds and validates parameter PolicyTypeID from path.
+func (o *A1ControllerDeletePolicyInstanceParams) bindPolicyTypeID(rawData []string, hasKey bool, formats strfmt.Registry) error {
+       var raw string
+       if len(rawData) > 0 {
+               raw = rawData[len(rawData)-1]
+       }
+
+       // Required: true
+       // Parameter is provided by construction from the route
+
+       value, err := swag.ConvertInt64(raw)
+       if err != nil {
+               return errors.InvalidType("policy_type_id", "path", "int64", raw)
+       }
+       o.PolicyTypeID = value
+
+       if err := o.validatePolicyTypeID(formats); err != nil {
+               return err
+       }
+
+       return nil
+}
+
+// validatePolicyTypeID carries on validations for parameter PolicyTypeID
+func (o *A1ControllerDeletePolicyInstanceParams) validatePolicyTypeID(formats strfmt.Registry) error {
+
+       if err := validate.MinimumInt("policy_type_id", "path", int64(o.PolicyTypeID), 1, false); err != nil {
+               return err
+       }
+
+       if err := validate.MaximumInt("policy_type_id", "path", int64(o.PolicyTypeID), 2.147483647e+09, false); err != nil {
+               return err
+       }
+
+       return nil
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_instance_responses.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_instance_responses.go
new file mode 100644 (file)
index 0000000..2225de8
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/runtime"
+)
+
+// A1ControllerDeletePolicyInstanceAcceptedCode is the HTTP code returned for type A1ControllerDeletePolicyInstanceAccepted
+const A1ControllerDeletePolicyInstanceAcceptedCode int = 202
+
+/*A1ControllerDeletePolicyInstanceAccepted policy instance deletion initiated
+
+
+swagger:response a1ControllerDeletePolicyInstanceAccepted
+*/
+type A1ControllerDeletePolicyInstanceAccepted struct {
+}
+
+// NewA1ControllerDeletePolicyInstanceAccepted creates A1ControllerDeletePolicyInstanceAccepted with default headers values
+func NewA1ControllerDeletePolicyInstanceAccepted() *A1ControllerDeletePolicyInstanceAccepted {
+
+       return &A1ControllerDeletePolicyInstanceAccepted{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerDeletePolicyInstanceAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(202)
+}
+
+// A1ControllerDeletePolicyInstanceNotFoundCode is the HTTP code returned for type A1ControllerDeletePolicyInstanceNotFound
+const A1ControllerDeletePolicyInstanceNotFoundCode int = 404
+
+/*A1ControllerDeletePolicyInstanceNotFound there is no policy instance with this policy_instance_id or there is no policy type with this policy_type_id
+
+
+swagger:response a1ControllerDeletePolicyInstanceNotFound
+*/
+type A1ControllerDeletePolicyInstanceNotFound struct {
+}
+
+// NewA1ControllerDeletePolicyInstanceNotFound creates A1ControllerDeletePolicyInstanceNotFound with default headers values
+func NewA1ControllerDeletePolicyInstanceNotFound() *A1ControllerDeletePolicyInstanceNotFound {
+
+       return &A1ControllerDeletePolicyInstanceNotFound{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerDeletePolicyInstanceNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(404)
+}
+
+// A1ControllerDeletePolicyInstanceServiceUnavailableCode is the HTTP code returned for type A1ControllerDeletePolicyInstanceServiceUnavailable
+const A1ControllerDeletePolicyInstanceServiceUnavailableCode int = 503
+
+/*A1ControllerDeletePolicyInstanceServiceUnavailable Potentially transient backend database error. Client should attempt to retry later.
+
+swagger:response a1ControllerDeletePolicyInstanceServiceUnavailable
+*/
+type A1ControllerDeletePolicyInstanceServiceUnavailable struct {
+}
+
+// NewA1ControllerDeletePolicyInstanceServiceUnavailable creates A1ControllerDeletePolicyInstanceServiceUnavailable with default headers values
+func NewA1ControllerDeletePolicyInstanceServiceUnavailable() *A1ControllerDeletePolicyInstanceServiceUnavailable {
+
+       return &A1ControllerDeletePolicyInstanceServiceUnavailable{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerDeletePolicyInstanceServiceUnavailable) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(503)
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_instance_urlbuilder.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_instance_urlbuilder.go
new file mode 100644 (file)
index 0000000..145fe1e
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "errors"
+       "net/url"
+       golangswaggerpaths "path"
+       "strings"
+
+       "github.com/go-openapi/swag"
+)
+
+// A1ControllerDeletePolicyInstanceURL generates an URL for the a1 controller delete policy instance operation
+type A1ControllerDeletePolicyInstanceURL struct {
+       PolicyInstanceID string
+       PolicyTypeID     int64
+
+       _basePath string
+       // avoid unkeyed usage
+       _ struct{}
+}
+
+// WithBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *A1ControllerDeletePolicyInstanceURL) WithBasePath(bp string) *A1ControllerDeletePolicyInstanceURL {
+       o.SetBasePath(bp)
+       return o
+}
+
+// SetBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *A1ControllerDeletePolicyInstanceURL) SetBasePath(bp string) {
+       o._basePath = bp
+}
+
+// Build a url path and query string
+func (o *A1ControllerDeletePolicyInstanceURL) Build() (*url.URL, error) {
+       var _result url.URL
+
+       var _path = "/a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id}"
+
+       policyInstanceID := o.PolicyInstanceID
+       if policyInstanceID != "" {
+               _path = strings.Replace(_path, "{policy_instance_id}", policyInstanceID, -1)
+       } else {
+               return nil, errors.New("policyInstanceId is required on A1ControllerDeletePolicyInstanceURL")
+       }
+
+       policyTypeID := swag.FormatInt64(o.PolicyTypeID)
+       if policyTypeID != "" {
+               _path = strings.Replace(_path, "{policy_type_id}", policyTypeID, -1)
+       } else {
+               return nil, errors.New("policyTypeId is required on A1ControllerDeletePolicyInstanceURL")
+       }
+
+       _basePath := o._basePath
+       _result.Path = golangswaggerpaths.Join(_basePath, _path)
+
+       return &_result, nil
+}
+
+// Must is a helper function to panic when the url builder returns an error
+func (o *A1ControllerDeletePolicyInstanceURL) Must(u *url.URL, err error) *url.URL {
+       if err != nil {
+               panic(err)
+       }
+       if u == nil {
+               panic("url can't be nil")
+       }
+       return u
+}
+
+// String returns the string representation of the path with query string
+func (o *A1ControllerDeletePolicyInstanceURL) String() string {
+       return o.Must(o.Build()).String()
+}
+
+// BuildFull builds a full url with scheme, host, path and query string
+func (o *A1ControllerDeletePolicyInstanceURL) BuildFull(scheme, host string) (*url.URL, error) {
+       if scheme == "" {
+               return nil, errors.New("scheme is required for a full url on A1ControllerDeletePolicyInstanceURL")
+       }
+       if host == "" {
+               return nil, errors.New("host is required for a full url on A1ControllerDeletePolicyInstanceURL")
+       }
+
+       base, err := o.Build()
+       if err != nil {
+               return nil, err
+       }
+
+       base.Scheme = scheme
+       base.Host = host
+       return base, nil
+}
+
+// StringFull returns the string representation of a complete url
+func (o *A1ControllerDeletePolicyInstanceURL) StringFull(scheme, host string) string {
+       return o.Must(o.BuildFull(scheme, host)).String()
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_type.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_type.go
new file mode 100644 (file)
index 0000000..c01e905
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/runtime/middleware"
+)
+
+// A1ControllerDeletePolicyTypeHandlerFunc turns a function with the right signature into a a1 controller delete policy type handler
+type A1ControllerDeletePolicyTypeHandlerFunc func(A1ControllerDeletePolicyTypeParams) middleware.Responder
+
+// Handle executing the request and returning a response
+func (fn A1ControllerDeletePolicyTypeHandlerFunc) Handle(params A1ControllerDeletePolicyTypeParams) middleware.Responder {
+       return fn(params)
+}
+
+// A1ControllerDeletePolicyTypeHandler interface for that can handle valid a1 controller delete policy type params
+type A1ControllerDeletePolicyTypeHandler interface {
+       Handle(A1ControllerDeletePolicyTypeParams) middleware.Responder
+}
+
+// NewA1ControllerDeletePolicyType creates a new http.Handler for the a1 controller delete policy type operation
+func NewA1ControllerDeletePolicyType(ctx *middleware.Context, handler A1ControllerDeletePolicyTypeHandler) *A1ControllerDeletePolicyType {
+       return &A1ControllerDeletePolicyType{Context: ctx, Handler: handler}
+}
+
+/*A1ControllerDeletePolicyType swagger:route DELETE /a1-p/policytypes/{policy_type_id} A1 Mediator a1ControllerDeletePolicyType
+
+Delete this policy type. Can only be performed if there are no instances of this type
+
+
+*/
+type A1ControllerDeletePolicyType struct {
+       Context *middleware.Context
+       Handler A1ControllerDeletePolicyTypeHandler
+}
+
+func (o *A1ControllerDeletePolicyType) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
+       route, rCtx, _ := o.Context.RouteInfo(r)
+       if rCtx != nil {
+               r = rCtx
+       }
+       var Params = NewA1ControllerDeletePolicyTypeParams()
+
+       if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
+               o.Context.Respond(rw, r, route.Produces, route, err)
+               return
+       }
+
+       res := o.Handler.Handle(Params) // actually handle the request
+
+       o.Context.Respond(rw, r, route.Produces, route, res)
+
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_type_parameters.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_type_parameters.go
new file mode 100644 (file)
index 0000000..5916580
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/runtime/middleware"
+       "github.com/go-openapi/strfmt"
+       "github.com/go-openapi/swag"
+       "github.com/go-openapi/validate"
+)
+
+// NewA1ControllerDeletePolicyTypeParams creates a new A1ControllerDeletePolicyTypeParams object
+// no default values defined in spec.
+func NewA1ControllerDeletePolicyTypeParams() A1ControllerDeletePolicyTypeParams {
+
+       return A1ControllerDeletePolicyTypeParams{}
+}
+
+// A1ControllerDeletePolicyTypeParams contains all the bound params for the a1 controller delete policy type operation
+// typically these are obtained from a http.Request
+//
+// swagger:parameters a1.controller.delete_policy_type
+type A1ControllerDeletePolicyTypeParams struct {
+
+       // HTTP Request Object
+       HTTPRequest *http.Request `json:"-"`
+
+       /*represents a policy type identifier. Currently this is restricted to an integer range.
+
+         Required: true
+         Maximum: 2.147483647e+09
+         Minimum: 1
+         In: path
+       */
+       PolicyTypeID int64
+}
+
+// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
+// for simple values it will use straight method calls.
+//
+// To ensure default values, the struct must have been initialized with NewA1ControllerDeletePolicyTypeParams() beforehand.
+func (o *A1ControllerDeletePolicyTypeParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
+       var res []error
+
+       o.HTTPRequest = r
+
+       rPolicyTypeID, rhkPolicyTypeID, _ := route.Params.GetOK("policy_type_id")
+       if err := o.bindPolicyTypeID(rPolicyTypeID, rhkPolicyTypeID, route.Formats); err != nil {
+               res = append(res, err)
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
+
+// bindPolicyTypeID binds and validates parameter PolicyTypeID from path.
+func (o *A1ControllerDeletePolicyTypeParams) bindPolicyTypeID(rawData []string, hasKey bool, formats strfmt.Registry) error {
+       var raw string
+       if len(rawData) > 0 {
+               raw = rawData[len(rawData)-1]
+       }
+
+       // Required: true
+       // Parameter is provided by construction from the route
+
+       value, err := swag.ConvertInt64(raw)
+       if err != nil {
+               return errors.InvalidType("policy_type_id", "path", "int64", raw)
+       }
+       o.PolicyTypeID = value
+
+       if err := o.validatePolicyTypeID(formats); err != nil {
+               return err
+       }
+
+       return nil
+}
+
+// validatePolicyTypeID carries on validations for parameter PolicyTypeID
+func (o *A1ControllerDeletePolicyTypeParams) validatePolicyTypeID(formats strfmt.Registry) error {
+
+       if err := validate.MinimumInt("policy_type_id", "path", int64(o.PolicyTypeID), 1, false); err != nil {
+               return err
+       }
+
+       if err := validate.MaximumInt("policy_type_id", "path", int64(o.PolicyTypeID), 2.147483647e+09, false); err != nil {
+               return err
+       }
+
+       return nil
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_type_responses.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_type_responses.go
new file mode 100644 (file)
index 0000000..3e20573
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/runtime"
+)
+
+// A1ControllerDeletePolicyTypeNoContentCode is the HTTP code returned for type A1ControllerDeletePolicyTypeNoContent
+const A1ControllerDeletePolicyTypeNoContentCode int = 204
+
+/*A1ControllerDeletePolicyTypeNoContent policy type successfully deleted
+
+
+swagger:response a1ControllerDeletePolicyTypeNoContent
+*/
+type A1ControllerDeletePolicyTypeNoContent struct {
+}
+
+// NewA1ControllerDeletePolicyTypeNoContent creates A1ControllerDeletePolicyTypeNoContent with default headers values
+func NewA1ControllerDeletePolicyTypeNoContent() *A1ControllerDeletePolicyTypeNoContent {
+
+       return &A1ControllerDeletePolicyTypeNoContent{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerDeletePolicyTypeNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(204)
+}
+
+// A1ControllerDeletePolicyTypeBadRequestCode is the HTTP code returned for type A1ControllerDeletePolicyTypeBadRequest
+const A1ControllerDeletePolicyTypeBadRequestCode int = 400
+
+/*A1ControllerDeletePolicyTypeBadRequest Policy type cannot be deleted because there are instances All instances must be removed before a policy type can be deleted
+
+
+swagger:response a1ControllerDeletePolicyTypeBadRequest
+*/
+type A1ControllerDeletePolicyTypeBadRequest struct {
+}
+
+// NewA1ControllerDeletePolicyTypeBadRequest creates A1ControllerDeletePolicyTypeBadRequest with default headers values
+func NewA1ControllerDeletePolicyTypeBadRequest() *A1ControllerDeletePolicyTypeBadRequest {
+
+       return &A1ControllerDeletePolicyTypeBadRequest{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerDeletePolicyTypeBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(400)
+}
+
+// A1ControllerDeletePolicyTypeNotFoundCode is the HTTP code returned for type A1ControllerDeletePolicyTypeNotFound
+const A1ControllerDeletePolicyTypeNotFoundCode int = 404
+
+/*A1ControllerDeletePolicyTypeNotFound policy type not found
+
+
+swagger:response a1ControllerDeletePolicyTypeNotFound
+*/
+type A1ControllerDeletePolicyTypeNotFound struct {
+}
+
+// NewA1ControllerDeletePolicyTypeNotFound creates A1ControllerDeletePolicyTypeNotFound with default headers values
+func NewA1ControllerDeletePolicyTypeNotFound() *A1ControllerDeletePolicyTypeNotFound {
+
+       return &A1ControllerDeletePolicyTypeNotFound{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerDeletePolicyTypeNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(404)
+}
+
+// A1ControllerDeletePolicyTypeServiceUnavailableCode is the HTTP code returned for type A1ControllerDeletePolicyTypeServiceUnavailable
+const A1ControllerDeletePolicyTypeServiceUnavailableCode int = 503
+
+/*A1ControllerDeletePolicyTypeServiceUnavailable Potentially transient backend database error. Client should attempt to retry later.
+
+swagger:response a1ControllerDeletePolicyTypeServiceUnavailable
+*/
+type A1ControllerDeletePolicyTypeServiceUnavailable struct {
+}
+
+// NewA1ControllerDeletePolicyTypeServiceUnavailable creates A1ControllerDeletePolicyTypeServiceUnavailable with default headers values
+func NewA1ControllerDeletePolicyTypeServiceUnavailable() *A1ControllerDeletePolicyTypeServiceUnavailable {
+
+       return &A1ControllerDeletePolicyTypeServiceUnavailable{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerDeletePolicyTypeServiceUnavailable) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(503)
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_type_urlbuilder.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_delete_policy_type_urlbuilder.go
new file mode 100644 (file)
index 0000000..322d4ac
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "errors"
+       "net/url"
+       golangswaggerpaths "path"
+       "strings"
+
+       "github.com/go-openapi/swag"
+)
+
+// A1ControllerDeletePolicyTypeURL generates an URL for the a1 controller delete policy type operation
+type A1ControllerDeletePolicyTypeURL struct {
+       PolicyTypeID int64
+
+       _basePath string
+       // avoid unkeyed usage
+       _ struct{}
+}
+
+// WithBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *A1ControllerDeletePolicyTypeURL) WithBasePath(bp string) *A1ControllerDeletePolicyTypeURL {
+       o.SetBasePath(bp)
+       return o
+}
+
+// SetBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *A1ControllerDeletePolicyTypeURL) SetBasePath(bp string) {
+       o._basePath = bp
+}
+
+// Build a url path and query string
+func (o *A1ControllerDeletePolicyTypeURL) Build() (*url.URL, error) {
+       var _result url.URL
+
+       var _path = "/a1-p/policytypes/{policy_type_id}"
+
+       policyTypeID := swag.FormatInt64(o.PolicyTypeID)
+       if policyTypeID != "" {
+               _path = strings.Replace(_path, "{policy_type_id}", policyTypeID, -1)
+       } else {
+               return nil, errors.New("policyTypeId is required on A1ControllerDeletePolicyTypeURL")
+       }
+
+       _basePath := o._basePath
+       _result.Path = golangswaggerpaths.Join(_basePath, _path)
+
+       return &_result, nil
+}
+
+// Must is a helper function to panic when the url builder returns an error
+func (o *A1ControllerDeletePolicyTypeURL) Must(u *url.URL, err error) *url.URL {
+       if err != nil {
+               panic(err)
+       }
+       if u == nil {
+               panic("url can't be nil")
+       }
+       return u
+}
+
+// String returns the string representation of the path with query string
+func (o *A1ControllerDeletePolicyTypeURL) String() string {
+       return o.Must(o.Build()).String()
+}
+
+// BuildFull builds a full url with scheme, host, path and query string
+func (o *A1ControllerDeletePolicyTypeURL) BuildFull(scheme, host string) (*url.URL, error) {
+       if scheme == "" {
+               return nil, errors.New("scheme is required for a full url on A1ControllerDeletePolicyTypeURL")
+       }
+       if host == "" {
+               return nil, errors.New("host is required for a full url on A1ControllerDeletePolicyTypeURL")
+       }
+
+       base, err := o.Build()
+       if err != nil {
+               return nil, err
+       }
+
+       base.Scheme = scheme
+       base.Host = host
+       return base, nil
+}
+
+// StringFull returns the string representation of a complete url
+func (o *A1ControllerDeletePolicyTypeURL) StringFull(scheme, host string) string {
+       return o.Must(o.BuildFull(scheme, host)).String()
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_instances_for_type.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_instances_for_type.go
new file mode 100644 (file)
index 0000000..4080233
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/runtime/middleware"
+)
+
+// A1ControllerGetAllInstancesForTypeHandlerFunc turns a function with the right signature into a a1 controller get all instances for type handler
+type A1ControllerGetAllInstancesForTypeHandlerFunc func(A1ControllerGetAllInstancesForTypeParams) middleware.Responder
+
+// Handle executing the request and returning a response
+func (fn A1ControllerGetAllInstancesForTypeHandlerFunc) Handle(params A1ControllerGetAllInstancesForTypeParams) middleware.Responder {
+       return fn(params)
+}
+
+// A1ControllerGetAllInstancesForTypeHandler interface for that can handle valid a1 controller get all instances for type params
+type A1ControllerGetAllInstancesForTypeHandler interface {
+       Handle(A1ControllerGetAllInstancesForTypeParams) middleware.Responder
+}
+
+// NewA1ControllerGetAllInstancesForType creates a new http.Handler for the a1 controller get all instances for type operation
+func NewA1ControllerGetAllInstancesForType(ctx *middleware.Context, handler A1ControllerGetAllInstancesForTypeHandler) *A1ControllerGetAllInstancesForType {
+       return &A1ControllerGetAllInstancesForType{Context: ctx, Handler: handler}
+}
+
+/*A1ControllerGetAllInstancesForType swagger:route GET /a1-p/policytypes/{policy_type_id}/policies A1 Mediator a1ControllerGetAllInstancesForType
+
+get a list of all policy instance ids for this policy type id
+
+*/
+type A1ControllerGetAllInstancesForType struct {
+       Context *middleware.Context
+       Handler A1ControllerGetAllInstancesForTypeHandler
+}
+
+func (o *A1ControllerGetAllInstancesForType) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
+       route, rCtx, _ := o.Context.RouteInfo(r)
+       if rCtx != nil {
+               r = rCtx
+       }
+       var Params = NewA1ControllerGetAllInstancesForTypeParams()
+
+       if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
+               o.Context.Respond(rw, r, route.Produces, route, err)
+               return
+       }
+
+       res := o.Handler.Handle(Params) // actually handle the request
+
+       o.Context.Respond(rw, r, route.Produces, route, res)
+
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_instances_for_type_parameters.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_instances_for_type_parameters.go
new file mode 100644 (file)
index 0000000..6a4e4b6
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/runtime/middleware"
+       "github.com/go-openapi/strfmt"
+       "github.com/go-openapi/swag"
+       "github.com/go-openapi/validate"
+)
+
+// NewA1ControllerGetAllInstancesForTypeParams creates a new A1ControllerGetAllInstancesForTypeParams object
+// no default values defined in spec.
+func NewA1ControllerGetAllInstancesForTypeParams() A1ControllerGetAllInstancesForTypeParams {
+
+       return A1ControllerGetAllInstancesForTypeParams{}
+}
+
+// A1ControllerGetAllInstancesForTypeParams contains all the bound params for the a1 controller get all instances for type operation
+// typically these are obtained from a http.Request
+//
+// swagger:parameters a1.controller.get_all_instances_for_type
+type A1ControllerGetAllInstancesForTypeParams struct {
+
+       // HTTP Request Object
+       HTTPRequest *http.Request `json:"-"`
+
+       /*represents a policy type identifier. Currently this is restricted to an integer range.
+
+         Required: true
+         Maximum: 2.147483647e+09
+         Minimum: 1
+         In: path
+       */
+       PolicyTypeID int64
+}
+
+// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
+// for simple values it will use straight method calls.
+//
+// To ensure default values, the struct must have been initialized with NewA1ControllerGetAllInstancesForTypeParams() beforehand.
+func (o *A1ControllerGetAllInstancesForTypeParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
+       var res []error
+
+       o.HTTPRequest = r
+
+       rPolicyTypeID, rhkPolicyTypeID, _ := route.Params.GetOK("policy_type_id")
+       if err := o.bindPolicyTypeID(rPolicyTypeID, rhkPolicyTypeID, route.Formats); err != nil {
+               res = append(res, err)
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
+
+// bindPolicyTypeID binds and validates parameter PolicyTypeID from path.
+func (o *A1ControllerGetAllInstancesForTypeParams) bindPolicyTypeID(rawData []string, hasKey bool, formats strfmt.Registry) error {
+       var raw string
+       if len(rawData) > 0 {
+               raw = rawData[len(rawData)-1]
+       }
+
+       // Required: true
+       // Parameter is provided by construction from the route
+
+       value, err := swag.ConvertInt64(raw)
+       if err != nil {
+               return errors.InvalidType("policy_type_id", "path", "int64", raw)
+       }
+       o.PolicyTypeID = value
+
+       if err := o.validatePolicyTypeID(formats); err != nil {
+               return err
+       }
+
+       return nil
+}
+
+// validatePolicyTypeID carries on validations for parameter PolicyTypeID
+func (o *A1ControllerGetAllInstancesForTypeParams) validatePolicyTypeID(formats strfmt.Registry) error {
+
+       if err := validate.MinimumInt("policy_type_id", "path", int64(o.PolicyTypeID), 1, false); err != nil {
+               return err
+       }
+
+       if err := validate.MaximumInt("policy_type_id", "path", int64(o.PolicyTypeID), 2.147483647e+09, false); err != nil {
+               return err
+       }
+
+       return nil
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_instances_for_type_responses.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_instances_for_type_responses.go
new file mode 100644 (file)
index 0000000..43f64b1
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/runtime"
+
+       "subh.com/a1-go/pkg/models"
+)
+
+// A1ControllerGetAllInstancesForTypeOKCode is the HTTP code returned for type A1ControllerGetAllInstancesForTypeOK
+const A1ControllerGetAllInstancesForTypeOKCode int = 200
+
+/*A1ControllerGetAllInstancesForTypeOK list of all policy instance ids for this policy type id
+
+swagger:response a1ControllerGetAllInstancesForTypeOK
+*/
+type A1ControllerGetAllInstancesForTypeOK struct {
+
+       /*
+         In: Body
+       */
+       Payload []models.PolicyInstanceID `json:"body,omitempty"`
+}
+
+// NewA1ControllerGetAllInstancesForTypeOK creates A1ControllerGetAllInstancesForTypeOK with default headers values
+func NewA1ControllerGetAllInstancesForTypeOK() *A1ControllerGetAllInstancesForTypeOK {
+
+       return &A1ControllerGetAllInstancesForTypeOK{}
+}
+
+// WithPayload adds the payload to the a1 controller get all instances for type o k response
+func (o *A1ControllerGetAllInstancesForTypeOK) WithPayload(payload []models.PolicyInstanceID) *A1ControllerGetAllInstancesForTypeOK {
+       o.Payload = payload
+       return o
+}
+
+// SetPayload sets the payload to the a1 controller get all instances for type o k response
+func (o *A1ControllerGetAllInstancesForTypeOK) SetPayload(payload []models.PolicyInstanceID) {
+       o.Payload = payload
+}
+
+// WriteResponse to the client
+func (o *A1ControllerGetAllInstancesForTypeOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.WriteHeader(200)
+       payload := o.Payload
+       if payload == nil {
+               // return empty array
+               payload = make([]models.PolicyInstanceID, 0, 50)
+       }
+
+       if err := producer.Produce(rw, payload); err != nil {
+               panic(err) // let the recovery middleware deal with this
+       }
+}
+
+// A1ControllerGetAllInstancesForTypeServiceUnavailableCode is the HTTP code returned for type A1ControllerGetAllInstancesForTypeServiceUnavailable
+const A1ControllerGetAllInstancesForTypeServiceUnavailableCode int = 503
+
+/*A1ControllerGetAllInstancesForTypeServiceUnavailable Potentially transient backend database error. Client should attempt to retry later.
+
+swagger:response a1ControllerGetAllInstancesForTypeServiceUnavailable
+*/
+type A1ControllerGetAllInstancesForTypeServiceUnavailable struct {
+}
+
+// NewA1ControllerGetAllInstancesForTypeServiceUnavailable creates A1ControllerGetAllInstancesForTypeServiceUnavailable with default headers values
+func NewA1ControllerGetAllInstancesForTypeServiceUnavailable() *A1ControllerGetAllInstancesForTypeServiceUnavailable {
+
+       return &A1ControllerGetAllInstancesForTypeServiceUnavailable{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerGetAllInstancesForTypeServiceUnavailable) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(503)
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_instances_for_type_urlbuilder.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_instances_for_type_urlbuilder.go
new file mode 100644 (file)
index 0000000..5e2e200
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "errors"
+       "net/url"
+       golangswaggerpaths "path"
+       "strings"
+
+       "github.com/go-openapi/swag"
+)
+
+// A1ControllerGetAllInstancesForTypeURL generates an URL for the a1 controller get all instances for type operation
+type A1ControllerGetAllInstancesForTypeURL struct {
+       PolicyTypeID int64
+
+       _basePath string
+       // avoid unkeyed usage
+       _ struct{}
+}
+
+// WithBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *A1ControllerGetAllInstancesForTypeURL) WithBasePath(bp string) *A1ControllerGetAllInstancesForTypeURL {
+       o.SetBasePath(bp)
+       return o
+}
+
+// SetBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *A1ControllerGetAllInstancesForTypeURL) SetBasePath(bp string) {
+       o._basePath = bp
+}
+
+// Build a url path and query string
+func (o *A1ControllerGetAllInstancesForTypeURL) Build() (*url.URL, error) {
+       var _result url.URL
+
+       var _path = "/a1-p/policytypes/{policy_type_id}/policies"
+
+       policyTypeID := swag.FormatInt64(o.PolicyTypeID)
+       if policyTypeID != "" {
+               _path = strings.Replace(_path, "{policy_type_id}", policyTypeID, -1)
+       } else {
+               return nil, errors.New("policyTypeId is required on A1ControllerGetAllInstancesForTypeURL")
+       }
+
+       _basePath := o._basePath
+       _result.Path = golangswaggerpaths.Join(_basePath, _path)
+
+       return &_result, nil
+}
+
+// Must is a helper function to panic when the url builder returns an error
+func (o *A1ControllerGetAllInstancesForTypeURL) Must(u *url.URL, err error) *url.URL {
+       if err != nil {
+               panic(err)
+       }
+       if u == nil {
+               panic("url can't be nil")
+       }
+       return u
+}
+
+// String returns the string representation of the path with query string
+func (o *A1ControllerGetAllInstancesForTypeURL) String() string {
+       return o.Must(o.Build()).String()
+}
+
+// BuildFull builds a full url with scheme, host, path and query string
+func (o *A1ControllerGetAllInstancesForTypeURL) BuildFull(scheme, host string) (*url.URL, error) {
+       if scheme == "" {
+               return nil, errors.New("scheme is required for a full url on A1ControllerGetAllInstancesForTypeURL")
+       }
+       if host == "" {
+               return nil, errors.New("host is required for a full url on A1ControllerGetAllInstancesForTypeURL")
+       }
+
+       base, err := o.Build()
+       if err != nil {
+               return nil, err
+       }
+
+       base.Scheme = scheme
+       base.Host = host
+       return base, nil
+}
+
+// StringFull returns the string representation of a complete url
+func (o *A1ControllerGetAllInstancesForTypeURL) StringFull(scheme, host string) string {
+       return o.Must(o.BuildFull(scheme, host)).String()
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_policy_types.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_policy_types.go
new file mode 100644 (file)
index 0000000..70758b3
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/runtime/middleware"
+)
+
+// A1ControllerGetAllPolicyTypesHandlerFunc turns a function with the right signature into a a1 controller get all policy types handler
+type A1ControllerGetAllPolicyTypesHandlerFunc func(A1ControllerGetAllPolicyTypesParams) middleware.Responder
+
+// Handle executing the request and returning a response
+func (fn A1ControllerGetAllPolicyTypesHandlerFunc) Handle(params A1ControllerGetAllPolicyTypesParams) middleware.Responder {
+       return fn(params)
+}
+
+// A1ControllerGetAllPolicyTypesHandler interface for that can handle valid a1 controller get all policy types params
+type A1ControllerGetAllPolicyTypesHandler interface {
+       Handle(A1ControllerGetAllPolicyTypesParams) middleware.Responder
+}
+
+// NewA1ControllerGetAllPolicyTypes creates a new http.Handler for the a1 controller get all policy types operation
+func NewA1ControllerGetAllPolicyTypes(ctx *middleware.Context, handler A1ControllerGetAllPolicyTypesHandler) *A1ControllerGetAllPolicyTypes {
+       return &A1ControllerGetAllPolicyTypes{Context: ctx, Handler: handler}
+}
+
+/*A1ControllerGetAllPolicyTypes swagger:route GET /a1-p/policytypes A1 Mediator a1ControllerGetAllPolicyTypes
+
+Get a list of all registered policy type ids
+
+*/
+type A1ControllerGetAllPolicyTypes struct {
+       Context *middleware.Context
+       Handler A1ControllerGetAllPolicyTypesHandler
+}
+
+func (o *A1ControllerGetAllPolicyTypes) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
+       route, rCtx, _ := o.Context.RouteInfo(r)
+       if rCtx != nil {
+               r = rCtx
+       }
+       var Params = NewA1ControllerGetAllPolicyTypesParams()
+
+       if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
+               o.Context.Respond(rw, r, route.Produces, route, err)
+               return
+       }
+
+       res := o.Handler.Handle(Params) // actually handle the request
+
+       o.Context.Respond(rw, r, route.Produces, route, res)
+
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_policy_types_parameters.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_policy_types_parameters.go
new file mode 100644 (file)
index 0000000..1f622ac
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/runtime/middleware"
+)
+
+// NewA1ControllerGetAllPolicyTypesParams creates a new A1ControllerGetAllPolicyTypesParams object
+// no default values defined in spec.
+func NewA1ControllerGetAllPolicyTypesParams() A1ControllerGetAllPolicyTypesParams {
+
+       return A1ControllerGetAllPolicyTypesParams{}
+}
+
+// A1ControllerGetAllPolicyTypesParams contains all the bound params for the a1 controller get all policy types operation
+// typically these are obtained from a http.Request
+//
+// swagger:parameters a1.controller.get_all_policy_types
+type A1ControllerGetAllPolicyTypesParams struct {
+
+       // HTTP Request Object
+       HTTPRequest *http.Request `json:"-"`
+}
+
+// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
+// for simple values it will use straight method calls.
+//
+// To ensure default values, the struct must have been initialized with NewA1ControllerGetAllPolicyTypesParams() beforehand.
+func (o *A1ControllerGetAllPolicyTypesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
+       var res []error
+
+       o.HTTPRequest = r
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_policy_types_responses.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_policy_types_responses.go
new file mode 100644 (file)
index 0000000..3b1a362
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/runtime"
+
+       "subh.com/a1-go/pkg/models"
+)
+
+// A1ControllerGetAllPolicyTypesOKCode is the HTTP code returned for type A1ControllerGetAllPolicyTypesOK
+const A1ControllerGetAllPolicyTypesOKCode int = 200
+
+/*A1ControllerGetAllPolicyTypesOK list of all registered policy type ids
+
+swagger:response a1ControllerGetAllPolicyTypesOK
+*/
+type A1ControllerGetAllPolicyTypesOK struct {
+
+       /*
+         In: Body
+       */
+       Payload []models.PolicyTypeID `json:"body,omitempty"`
+}
+
+// NewA1ControllerGetAllPolicyTypesOK creates A1ControllerGetAllPolicyTypesOK with default headers values
+func NewA1ControllerGetAllPolicyTypesOK() *A1ControllerGetAllPolicyTypesOK {
+
+       return &A1ControllerGetAllPolicyTypesOK{}
+}
+
+// WithPayload adds the payload to the a1 controller get all policy types o k response
+func (o *A1ControllerGetAllPolicyTypesOK) WithPayload(payload []models.PolicyTypeID) *A1ControllerGetAllPolicyTypesOK {
+       o.Payload = payload
+       return o
+}
+
+// SetPayload sets the payload to the a1 controller get all policy types o k response
+func (o *A1ControllerGetAllPolicyTypesOK) SetPayload(payload []models.PolicyTypeID) {
+       o.Payload = payload
+}
+
+// WriteResponse to the client
+func (o *A1ControllerGetAllPolicyTypesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.WriteHeader(200)
+       payload := o.Payload
+       if payload == nil {
+               // return empty array
+               payload = make([]models.PolicyTypeID, 0, 50)
+       }
+
+       if err := producer.Produce(rw, payload); err != nil {
+               panic(err) // let the recovery middleware deal with this
+       }
+}
+
+// A1ControllerGetAllPolicyTypesServiceUnavailableCode is the HTTP code returned for type A1ControllerGetAllPolicyTypesServiceUnavailable
+const A1ControllerGetAllPolicyTypesServiceUnavailableCode int = 503
+
+/*A1ControllerGetAllPolicyTypesServiceUnavailable Potentially transient backend database error. Client should attempt to retry later.
+
+swagger:response a1ControllerGetAllPolicyTypesServiceUnavailable
+*/
+type A1ControllerGetAllPolicyTypesServiceUnavailable struct {
+}
+
+// NewA1ControllerGetAllPolicyTypesServiceUnavailable creates A1ControllerGetAllPolicyTypesServiceUnavailable with default headers values
+func NewA1ControllerGetAllPolicyTypesServiceUnavailable() *A1ControllerGetAllPolicyTypesServiceUnavailable {
+
+       return &A1ControllerGetAllPolicyTypesServiceUnavailable{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerGetAllPolicyTypesServiceUnavailable) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(503)
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_policy_types_urlbuilder.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_all_policy_types_urlbuilder.go
new file mode 100644 (file)
index 0000000..2a5c4da
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "errors"
+       "net/url"
+       golangswaggerpaths "path"
+)
+
+// A1ControllerGetAllPolicyTypesURL generates an URL for the a1 controller get all policy types operation
+type A1ControllerGetAllPolicyTypesURL struct {
+       _basePath string
+}
+
+// WithBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *A1ControllerGetAllPolicyTypesURL) WithBasePath(bp string) *A1ControllerGetAllPolicyTypesURL {
+       o.SetBasePath(bp)
+       return o
+}
+
+// SetBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *A1ControllerGetAllPolicyTypesURL) SetBasePath(bp string) {
+       o._basePath = bp
+}
+
+// Build a url path and query string
+func (o *A1ControllerGetAllPolicyTypesURL) Build() (*url.URL, error) {
+       var _result url.URL
+
+       var _path = "/a1-p/policytypes"
+
+       _basePath := o._basePath
+       _result.Path = golangswaggerpaths.Join(_basePath, _path)
+
+       return &_result, nil
+}
+
+// Must is a helper function to panic when the url builder returns an error
+func (o *A1ControllerGetAllPolicyTypesURL) Must(u *url.URL, err error) *url.URL {
+       if err != nil {
+               panic(err)
+       }
+       if u == nil {
+               panic("url can't be nil")
+       }
+       return u
+}
+
+// String returns the string representation of the path with query string
+func (o *A1ControllerGetAllPolicyTypesURL) String() string {
+       return o.Must(o.Build()).String()
+}
+
+// BuildFull builds a full url with scheme, host, path and query string
+func (o *A1ControllerGetAllPolicyTypesURL) BuildFull(scheme, host string) (*url.URL, error) {
+       if scheme == "" {
+               return nil, errors.New("scheme is required for a full url on A1ControllerGetAllPolicyTypesURL")
+       }
+       if host == "" {
+               return nil, errors.New("host is required for a full url on A1ControllerGetAllPolicyTypesURL")
+       }
+
+       base, err := o.Build()
+       if err != nil {
+               return nil, err
+       }
+
+       base.Scheme = scheme
+       base.Host = host
+       return base, nil
+}
+
+// StringFull returns the string representation of a complete url
+func (o *A1ControllerGetAllPolicyTypesURL) StringFull(scheme, host string) string {
+       return o.Must(o.BuildFull(scheme, host)).String()
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_healthcheck.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_healthcheck.go
new file mode 100644 (file)
index 0000000..7ddacf2
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/runtime/middleware"
+)
+
+// A1ControllerGetHealthcheckHandlerFunc turns a function with the right signature into a a1 controller get healthcheck handler
+type A1ControllerGetHealthcheckHandlerFunc func(A1ControllerGetHealthcheckParams) middleware.Responder
+
+// Handle executing the request and returning a response
+func (fn A1ControllerGetHealthcheckHandlerFunc) Handle(params A1ControllerGetHealthcheckParams) middleware.Responder {
+       return fn(params)
+}
+
+// A1ControllerGetHealthcheckHandler interface for that can handle valid a1 controller get healthcheck params
+type A1ControllerGetHealthcheckHandler interface {
+       Handle(A1ControllerGetHealthcheckParams) middleware.Responder
+}
+
+// NewA1ControllerGetHealthcheck creates a new http.Handler for the a1 controller get healthcheck operation
+func NewA1ControllerGetHealthcheck(ctx *middleware.Context, handler A1ControllerGetHealthcheckHandler) *A1ControllerGetHealthcheck {
+       return &A1ControllerGetHealthcheck{Context: ctx, Handler: handler}
+}
+
+/*A1ControllerGetHealthcheck swagger:route GET /a1-p/healthcheck A1 Mediator a1ControllerGetHealthcheck
+
+Perform a healthcheck on a1
+
+
+*/
+type A1ControllerGetHealthcheck struct {
+       Context *middleware.Context
+       Handler A1ControllerGetHealthcheckHandler
+}
+
+func (o *A1ControllerGetHealthcheck) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
+       route, rCtx, _ := o.Context.RouteInfo(r)
+       if rCtx != nil {
+               r = rCtx
+       }
+       var Params = NewA1ControllerGetHealthcheckParams()
+
+       if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
+               o.Context.Respond(rw, r, route.Produces, route, err)
+               return
+       }
+
+       res := o.Handler.Handle(Params) // actually handle the request
+
+       o.Context.Respond(rw, r, route.Produces, route, res)
+
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_healthcheck_parameters.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_healthcheck_parameters.go
new file mode 100644 (file)
index 0000000..0af3c35
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/runtime/middleware"
+)
+
+// NewA1ControllerGetHealthcheckParams creates a new A1ControllerGetHealthcheckParams object
+// no default values defined in spec.
+func NewA1ControllerGetHealthcheckParams() A1ControllerGetHealthcheckParams {
+
+       return A1ControllerGetHealthcheckParams{}
+}
+
+// A1ControllerGetHealthcheckParams contains all the bound params for the a1 controller get healthcheck operation
+// typically these are obtained from a http.Request
+//
+// swagger:parameters a1.controller.get_healthcheck
+type A1ControllerGetHealthcheckParams struct {
+
+       // HTTP Request Object
+       HTTPRequest *http.Request `json:"-"`
+}
+
+// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
+// for simple values it will use straight method calls.
+//
+// To ensure default values, the struct must have been initialized with NewA1ControllerGetHealthcheckParams() beforehand.
+func (o *A1ControllerGetHealthcheckParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
+       var res []error
+
+       o.HTTPRequest = r
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_healthcheck_responses.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_healthcheck_responses.go
new file mode 100644 (file)
index 0000000..20cf0ca
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/runtime"
+)
+
+// A1ControllerGetHealthcheckOKCode is the HTTP code returned for type A1ControllerGetHealthcheckOK
+const A1ControllerGetHealthcheckOKCode int = 200
+
+/*A1ControllerGetHealthcheckOK A1 is healthy. Anything other than a 200 should be considered a1 as failing
+
+
+swagger:response a1ControllerGetHealthcheckOK
+*/
+type A1ControllerGetHealthcheckOK struct {
+}
+
+// NewA1ControllerGetHealthcheckOK creates A1ControllerGetHealthcheckOK with default headers values
+func NewA1ControllerGetHealthcheckOK() *A1ControllerGetHealthcheckOK {
+
+       return &A1ControllerGetHealthcheckOK{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerGetHealthcheckOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(200)
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_healthcheck_urlbuilder.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_healthcheck_urlbuilder.go
new file mode 100644 (file)
index 0000000..1863b57
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "errors"
+       "net/url"
+       golangswaggerpaths "path"
+)
+
+// A1ControllerGetHealthcheckURL generates an URL for the a1 controller get healthcheck operation
+type A1ControllerGetHealthcheckURL struct {
+       _basePath string
+}
+
+// WithBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *A1ControllerGetHealthcheckURL) WithBasePath(bp string) *A1ControllerGetHealthcheckURL {
+       o.SetBasePath(bp)
+       return o
+}
+
+// SetBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *A1ControllerGetHealthcheckURL) SetBasePath(bp string) {
+       o._basePath = bp
+}
+
+// Build a url path and query string
+func (o *A1ControllerGetHealthcheckURL) Build() (*url.URL, error) {
+       var _result url.URL
+
+       var _path = "/a1-p/healthcheck"
+
+       _basePath := o._basePath
+       _result.Path = golangswaggerpaths.Join(_basePath, _path)
+
+       return &_result, nil
+}
+
+// Must is a helper function to panic when the url builder returns an error
+func (o *A1ControllerGetHealthcheckURL) Must(u *url.URL, err error) *url.URL {
+       if err != nil {
+               panic(err)
+       }
+       if u == nil {
+               panic("url can't be nil")
+       }
+       return u
+}
+
+// String returns the string representation of the path with query string
+func (o *A1ControllerGetHealthcheckURL) String() string {
+       return o.Must(o.Build()).String()
+}
+
+// BuildFull builds a full url with scheme, host, path and query string
+func (o *A1ControllerGetHealthcheckURL) BuildFull(scheme, host string) (*url.URL, error) {
+       if scheme == "" {
+               return nil, errors.New("scheme is required for a full url on A1ControllerGetHealthcheckURL")
+       }
+       if host == "" {
+               return nil, errors.New("host is required for a full url on A1ControllerGetHealthcheckURL")
+       }
+
+       base, err := o.Build()
+       if err != nil {
+               return nil, err
+       }
+
+       base.Scheme = scheme
+       base.Host = host
+       return base, nil
+}
+
+// StringFull returns the string representation of a complete url
+func (o *A1ControllerGetHealthcheckURL) StringFull(scheme, host string) string {
+       return o.Must(o.BuildFull(scheme, host)).String()
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance.go
new file mode 100644 (file)
index 0000000..12adc98
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/runtime/middleware"
+)
+
+// A1ControllerGetPolicyInstanceHandlerFunc turns a function with the right signature into a a1 controller get policy instance handler
+type A1ControllerGetPolicyInstanceHandlerFunc func(A1ControllerGetPolicyInstanceParams) middleware.Responder
+
+// Handle executing the request and returning a response
+func (fn A1ControllerGetPolicyInstanceHandlerFunc) Handle(params A1ControllerGetPolicyInstanceParams) middleware.Responder {
+       return fn(params)
+}
+
+// A1ControllerGetPolicyInstanceHandler interface for that can handle valid a1 controller get policy instance params
+type A1ControllerGetPolicyInstanceHandler interface {
+       Handle(A1ControllerGetPolicyInstanceParams) middleware.Responder
+}
+
+// NewA1ControllerGetPolicyInstance creates a new http.Handler for the a1 controller get policy instance operation
+func NewA1ControllerGetPolicyInstance(ctx *middleware.Context, handler A1ControllerGetPolicyInstanceHandler) *A1ControllerGetPolicyInstance {
+       return &A1ControllerGetPolicyInstance{Context: ctx, Handler: handler}
+}
+
+/*A1ControllerGetPolicyInstance swagger:route GET /a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id} A1 Mediator a1ControllerGetPolicyInstance
+
+Retrieve the policy instance
+
+
+*/
+type A1ControllerGetPolicyInstance struct {
+       Context *middleware.Context
+       Handler A1ControllerGetPolicyInstanceHandler
+}
+
+func (o *A1ControllerGetPolicyInstance) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
+       route, rCtx, _ := o.Context.RouteInfo(r)
+       if rCtx != nil {
+               r = rCtx
+       }
+       var Params = NewA1ControllerGetPolicyInstanceParams()
+
+       if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
+               o.Context.Respond(rw, r, route.Produces, route, err)
+               return
+       }
+
+       res := o.Handler.Handle(Params) // actually handle the request
+
+       o.Context.Respond(rw, r, route.Produces, route, res)
+
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance_parameters.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance_parameters.go
new file mode 100644 (file)
index 0000000..9645421
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/runtime/middleware"
+       "github.com/go-openapi/strfmt"
+       "github.com/go-openapi/swag"
+       "github.com/go-openapi/validate"
+)
+
+// NewA1ControllerGetPolicyInstanceParams creates a new A1ControllerGetPolicyInstanceParams object
+// no default values defined in spec.
+func NewA1ControllerGetPolicyInstanceParams() A1ControllerGetPolicyInstanceParams {
+
+       return A1ControllerGetPolicyInstanceParams{}
+}
+
+// A1ControllerGetPolicyInstanceParams contains all the bound params for the a1 controller get policy instance operation
+// typically these are obtained from a http.Request
+//
+// swagger:parameters a1.controller.get_policy_instance
+type A1ControllerGetPolicyInstanceParams struct {
+
+       // HTTP Request Object
+       HTTPRequest *http.Request `json:"-"`
+
+       /*represents a policy instance identifier. UUIDs are advisable but can be any string
+
+         Required: true
+         In: path
+       */
+       PolicyInstanceID string
+       /*represents a policy type identifier. Currently this is restricted to an integer range.
+
+         Required: true
+         Maximum: 2.147483647e+09
+         Minimum: 1
+         In: path
+       */
+       PolicyTypeID int64
+}
+
+// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
+// for simple values it will use straight method calls.
+//
+// To ensure default values, the struct must have been initialized with NewA1ControllerGetPolicyInstanceParams() beforehand.
+func (o *A1ControllerGetPolicyInstanceParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
+       var res []error
+
+       o.HTTPRequest = r
+
+       rPolicyInstanceID, rhkPolicyInstanceID, _ := route.Params.GetOK("policy_instance_id")
+       if err := o.bindPolicyInstanceID(rPolicyInstanceID, rhkPolicyInstanceID, route.Formats); err != nil {
+               res = append(res, err)
+       }
+
+       rPolicyTypeID, rhkPolicyTypeID, _ := route.Params.GetOK("policy_type_id")
+       if err := o.bindPolicyTypeID(rPolicyTypeID, rhkPolicyTypeID, route.Formats); err != nil {
+               res = append(res, err)
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
+
+// bindPolicyInstanceID binds and validates parameter PolicyInstanceID from path.
+func (o *A1ControllerGetPolicyInstanceParams) bindPolicyInstanceID(rawData []string, hasKey bool, formats strfmt.Registry) error {
+       var raw string
+       if len(rawData) > 0 {
+               raw = rawData[len(rawData)-1]
+       }
+
+       // Required: true
+       // Parameter is provided by construction from the route
+
+       o.PolicyInstanceID = raw
+
+       return nil
+}
+
+// bindPolicyTypeID binds and validates parameter PolicyTypeID from path.
+func (o *A1ControllerGetPolicyInstanceParams) bindPolicyTypeID(rawData []string, hasKey bool, formats strfmt.Registry) error {
+       var raw string
+       if len(rawData) > 0 {
+               raw = rawData[len(rawData)-1]
+       }
+
+       // Required: true
+       // Parameter is provided by construction from the route
+
+       value, err := swag.ConvertInt64(raw)
+       if err != nil {
+               return errors.InvalidType("policy_type_id", "path", "int64", raw)
+       }
+       o.PolicyTypeID = value
+
+       if err := o.validatePolicyTypeID(formats); err != nil {
+               return err
+       }
+
+       return nil
+}
+
+// validatePolicyTypeID carries on validations for parameter PolicyTypeID
+func (o *A1ControllerGetPolicyInstanceParams) validatePolicyTypeID(formats strfmt.Registry) error {
+
+       if err := validate.MinimumInt("policy_type_id", "path", int64(o.PolicyTypeID), 1, false); err != nil {
+               return err
+       }
+
+       if err := validate.MaximumInt("policy_type_id", "path", int64(o.PolicyTypeID), 2.147483647e+09, false); err != nil {
+               return err
+       }
+
+       return nil
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance_responses.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance_responses.go
new file mode 100644 (file)
index 0000000..28d32f2
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/runtime"
+)
+
+// A1ControllerGetPolicyInstanceOKCode is the HTTP code returned for type A1ControllerGetPolicyInstanceOK
+const A1ControllerGetPolicyInstanceOKCode int = 200
+
+/*A1ControllerGetPolicyInstanceOK The policy instance. the schema of this object is defined by the create_schema field of the policy type
+
+
+swagger:response a1ControllerGetPolicyInstanceOK
+*/
+type A1ControllerGetPolicyInstanceOK struct {
+
+       /*
+         In: Body
+       */
+       Payload interface{} `json:"body,omitempty"`
+}
+
+// NewA1ControllerGetPolicyInstanceOK creates A1ControllerGetPolicyInstanceOK with default headers values
+func NewA1ControllerGetPolicyInstanceOK() *A1ControllerGetPolicyInstanceOK {
+
+       return &A1ControllerGetPolicyInstanceOK{}
+}
+
+// WithPayload adds the payload to the a1 controller get policy instance o k response
+func (o *A1ControllerGetPolicyInstanceOK) WithPayload(payload interface{}) *A1ControllerGetPolicyInstanceOK {
+       o.Payload = payload
+       return o
+}
+
+// SetPayload sets the payload to the a1 controller get policy instance o k response
+func (o *A1ControllerGetPolicyInstanceOK) SetPayload(payload interface{}) {
+       o.Payload = payload
+}
+
+// WriteResponse to the client
+func (o *A1ControllerGetPolicyInstanceOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.WriteHeader(200)
+       payload := o.Payload
+       if err := producer.Produce(rw, payload); err != nil {
+               panic(err) // let the recovery middleware deal with this
+       }
+}
+
+// A1ControllerGetPolicyInstanceNotFoundCode is the HTTP code returned for type A1ControllerGetPolicyInstanceNotFound
+const A1ControllerGetPolicyInstanceNotFoundCode int = 404
+
+/*A1ControllerGetPolicyInstanceNotFound there is no policy instance with this policy_instance_id or there is no policy type with this policy_type_id
+
+
+swagger:response a1ControllerGetPolicyInstanceNotFound
+*/
+type A1ControllerGetPolicyInstanceNotFound struct {
+}
+
+// NewA1ControllerGetPolicyInstanceNotFound creates A1ControllerGetPolicyInstanceNotFound with default headers values
+func NewA1ControllerGetPolicyInstanceNotFound() *A1ControllerGetPolicyInstanceNotFound {
+
+       return &A1ControllerGetPolicyInstanceNotFound{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerGetPolicyInstanceNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(404)
+}
+
+// A1ControllerGetPolicyInstanceServiceUnavailableCode is the HTTP code returned for type A1ControllerGetPolicyInstanceServiceUnavailable
+const A1ControllerGetPolicyInstanceServiceUnavailableCode int = 503
+
+/*A1ControllerGetPolicyInstanceServiceUnavailable Potentially transient backend database error. Client should attempt to retry later.
+
+swagger:response a1ControllerGetPolicyInstanceServiceUnavailable
+*/
+type A1ControllerGetPolicyInstanceServiceUnavailable struct {
+}
+
+// NewA1ControllerGetPolicyInstanceServiceUnavailable creates A1ControllerGetPolicyInstanceServiceUnavailable with default headers values
+func NewA1ControllerGetPolicyInstanceServiceUnavailable() *A1ControllerGetPolicyInstanceServiceUnavailable {
+
+       return &A1ControllerGetPolicyInstanceServiceUnavailable{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerGetPolicyInstanceServiceUnavailable) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(503)
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance_status.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance_status.go
new file mode 100644 (file)
index 0000000..d5bdfb3
--- /dev/null
@@ -0,0 +1,193 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "encoding/json"
+       "net/http"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/runtime/middleware"
+       "github.com/go-openapi/strfmt"
+       "github.com/go-openapi/swag"
+       "github.com/go-openapi/validate"
+)
+
+// A1ControllerGetPolicyInstanceStatusHandlerFunc turns a function with the right signature into a a1 controller get policy instance status handler
+type A1ControllerGetPolicyInstanceStatusHandlerFunc func(A1ControllerGetPolicyInstanceStatusParams) middleware.Responder
+
+// Handle executing the request and returning a response
+func (fn A1ControllerGetPolicyInstanceStatusHandlerFunc) Handle(params A1ControllerGetPolicyInstanceStatusParams) middleware.Responder {
+       return fn(params)
+}
+
+// A1ControllerGetPolicyInstanceStatusHandler interface for that can handle valid a1 controller get policy instance status params
+type A1ControllerGetPolicyInstanceStatusHandler interface {
+       Handle(A1ControllerGetPolicyInstanceStatusParams) middleware.Responder
+}
+
+// NewA1ControllerGetPolicyInstanceStatus creates a new http.Handler for the a1 controller get policy instance status operation
+func NewA1ControllerGetPolicyInstanceStatus(ctx *middleware.Context, handler A1ControllerGetPolicyInstanceStatusHandler) *A1ControllerGetPolicyInstanceStatus {
+       return &A1ControllerGetPolicyInstanceStatus{Context: ctx, Handler: handler}
+}
+
+/*A1ControllerGetPolicyInstanceStatus swagger:route GET /a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id}/status A1 Mediator a1ControllerGetPolicyInstanceStatus
+
+Retrieve the policy instance status across all handlers of the policy If this endpoint returns successfully (200), it is either IN EFFECT or NOT IN EFFECT. IN EFFECT is returned if at least one policy handler in the RIC is implementing the policy NOT IN EFFECT is returned otherwise If a policy instance is successfully deleted, this endpoint will return a 404 (not a 200)
+
+
+*/
+type A1ControllerGetPolicyInstanceStatus struct {
+       Context *middleware.Context
+       Handler A1ControllerGetPolicyInstanceStatusHandler
+}
+
+func (o *A1ControllerGetPolicyInstanceStatus) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
+       route, rCtx, _ := o.Context.RouteInfo(r)
+       if rCtx != nil {
+               r = rCtx
+       }
+       var Params = NewA1ControllerGetPolicyInstanceStatusParams()
+
+       if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
+               o.Context.Respond(rw, r, route.Produces, route, err)
+               return
+       }
+
+       res := o.Handler.Handle(Params) // actually handle the request
+
+       o.Context.Respond(rw, r, route.Produces, route, res)
+
+}
+
+// A1ControllerGetPolicyInstanceStatusOKBody a1 controller get policy instance status o k body
+//
+// swagger:model A1ControllerGetPolicyInstanceStatusOKBody
+type A1ControllerGetPolicyInstanceStatusOKBody struct {
+
+       // created at
+       // Format: date-time
+       CreatedAt strfmt.DateTime `json:"created_at,omitempty"`
+
+       // has been deleted
+       HasBeenDeleted bool `json:"has_been_deleted,omitempty"`
+
+       // instance status
+       // Enum: [IN EFFECT NOT IN EFFECT]
+       InstanceStatus string `json:"instance_status,omitempty"`
+}
+
+// Validate validates this a1 controller get policy instance status o k body
+func (o *A1ControllerGetPolicyInstanceStatusOKBody) Validate(formats strfmt.Registry) error {
+       var res []error
+
+       if err := o.validateCreatedAt(formats); err != nil {
+               res = append(res, err)
+       }
+
+       if err := o.validateInstanceStatus(formats); err != nil {
+               res = append(res, err)
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
+
+func (o *A1ControllerGetPolicyInstanceStatusOKBody) validateCreatedAt(formats strfmt.Registry) error {
+
+       if swag.IsZero(o.CreatedAt) { // not required
+               return nil
+       }
+
+       if err := validate.FormatOf("a1ControllerGetPolicyInstanceStatusOK"+"."+"created_at", "body", "date-time", o.CreatedAt.String(), formats); err != nil {
+               return err
+       }
+
+       return nil
+}
+
+var a1ControllerGetPolicyInstanceStatusOKBodyTypeInstanceStatusPropEnum []interface{}
+
+func init() {
+       var res []string
+       if err := json.Unmarshal([]byte(`["IN EFFECT","NOT IN EFFECT"]`), &res); err != nil {
+               panic(err)
+       }
+       for _, v := range res {
+               a1ControllerGetPolicyInstanceStatusOKBodyTypeInstanceStatusPropEnum = append(a1ControllerGetPolicyInstanceStatusOKBodyTypeInstanceStatusPropEnum, v)
+       }
+}
+
+const (
+
+       // A1ControllerGetPolicyInstanceStatusOKBodyInstanceStatusINEFFECT captures enum value "IN EFFECT"
+       A1ControllerGetPolicyInstanceStatusOKBodyInstanceStatusINEFFECT string = "IN EFFECT"
+
+       // A1ControllerGetPolicyInstanceStatusOKBodyInstanceStatusNOTINEFFECT captures enum value "NOT IN EFFECT"
+       A1ControllerGetPolicyInstanceStatusOKBodyInstanceStatusNOTINEFFECT string = "NOT IN EFFECT"
+)
+
+// prop value enum
+func (o *A1ControllerGetPolicyInstanceStatusOKBody) validateInstanceStatusEnum(path, location string, value string) error {
+       if err := validate.Enum(path, location, value, a1ControllerGetPolicyInstanceStatusOKBodyTypeInstanceStatusPropEnum); err != nil {
+               return err
+       }
+       return nil
+}
+
+func (o *A1ControllerGetPolicyInstanceStatusOKBody) validateInstanceStatus(formats strfmt.Registry) error {
+
+       if swag.IsZero(o.InstanceStatus) { // not required
+               return nil
+       }
+
+       // value enum
+       if err := o.validateInstanceStatusEnum("a1ControllerGetPolicyInstanceStatusOK"+"."+"instance_status", "body", o.InstanceStatus); err != nil {
+               return err
+       }
+
+       return nil
+}
+
+// MarshalBinary interface implementation
+func (o *A1ControllerGetPolicyInstanceStatusOKBody) MarshalBinary() ([]byte, error) {
+       if o == nil {
+               return nil, nil
+       }
+       return swag.WriteJSON(o)
+}
+
+// UnmarshalBinary interface implementation
+func (o *A1ControllerGetPolicyInstanceStatusOKBody) UnmarshalBinary(b []byte) error {
+       var res A1ControllerGetPolicyInstanceStatusOKBody
+       if err := swag.ReadJSON(b, &res); err != nil {
+               return err
+       }
+       *o = res
+       return nil
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance_status_parameters.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance_status_parameters.go
new file mode 100644 (file)
index 0000000..3ae0780
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/runtime/middleware"
+       "github.com/go-openapi/strfmt"
+       "github.com/go-openapi/swag"
+       "github.com/go-openapi/validate"
+)
+
+// NewA1ControllerGetPolicyInstanceStatusParams creates a new A1ControllerGetPolicyInstanceStatusParams object
+// no default values defined in spec.
+func NewA1ControllerGetPolicyInstanceStatusParams() A1ControllerGetPolicyInstanceStatusParams {
+
+       return A1ControllerGetPolicyInstanceStatusParams{}
+}
+
+// A1ControllerGetPolicyInstanceStatusParams contains all the bound params for the a1 controller get policy instance status operation
+// typically these are obtained from a http.Request
+//
+// swagger:parameters a1.controller.get_policy_instance_status
+type A1ControllerGetPolicyInstanceStatusParams struct {
+
+       // HTTP Request Object
+       HTTPRequest *http.Request `json:"-"`
+
+       /*represents a policy instance identifier. UUIDs are advisable but can be any string
+
+         Required: true
+         In: path
+       */
+       PolicyInstanceID string
+       /*represents a policy type identifier. Currently this is restricted to an integer range.
+
+         Required: true
+         Maximum: 2.147483647e+09
+         Minimum: 1
+         In: path
+       */
+       PolicyTypeID int64
+}
+
+// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
+// for simple values it will use straight method calls.
+//
+// To ensure default values, the struct must have been initialized with NewA1ControllerGetPolicyInstanceStatusParams() beforehand.
+func (o *A1ControllerGetPolicyInstanceStatusParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
+       var res []error
+
+       o.HTTPRequest = r
+
+       rPolicyInstanceID, rhkPolicyInstanceID, _ := route.Params.GetOK("policy_instance_id")
+       if err := o.bindPolicyInstanceID(rPolicyInstanceID, rhkPolicyInstanceID, route.Formats); err != nil {
+               res = append(res, err)
+       }
+
+       rPolicyTypeID, rhkPolicyTypeID, _ := route.Params.GetOK("policy_type_id")
+       if err := o.bindPolicyTypeID(rPolicyTypeID, rhkPolicyTypeID, route.Formats); err != nil {
+               res = append(res, err)
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
+
+// bindPolicyInstanceID binds and validates parameter PolicyInstanceID from path.
+func (o *A1ControllerGetPolicyInstanceStatusParams) bindPolicyInstanceID(rawData []string, hasKey bool, formats strfmt.Registry) error {
+       var raw string
+       if len(rawData) > 0 {
+               raw = rawData[len(rawData)-1]
+       }
+
+       // Required: true
+       // Parameter is provided by construction from the route
+
+       o.PolicyInstanceID = raw
+
+       return nil
+}
+
+// bindPolicyTypeID binds and validates parameter PolicyTypeID from path.
+func (o *A1ControllerGetPolicyInstanceStatusParams) bindPolicyTypeID(rawData []string, hasKey bool, formats strfmt.Registry) error {
+       var raw string
+       if len(rawData) > 0 {
+               raw = rawData[len(rawData)-1]
+       }
+
+       // Required: true
+       // Parameter is provided by construction from the route
+
+       value, err := swag.ConvertInt64(raw)
+       if err != nil {
+               return errors.InvalidType("policy_type_id", "path", "int64", raw)
+       }
+       o.PolicyTypeID = value
+
+       if err := o.validatePolicyTypeID(formats); err != nil {
+               return err
+       }
+
+       return nil
+}
+
+// validatePolicyTypeID carries on validations for parameter PolicyTypeID
+func (o *A1ControllerGetPolicyInstanceStatusParams) validatePolicyTypeID(formats strfmt.Registry) error {
+
+       if err := validate.MinimumInt("policy_type_id", "path", int64(o.PolicyTypeID), 1, false); err != nil {
+               return err
+       }
+
+       if err := validate.MaximumInt("policy_type_id", "path", int64(o.PolicyTypeID), 2.147483647e+09, false); err != nil {
+               return err
+       }
+
+       return nil
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance_status_responses.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance_status_responses.go
new file mode 100644 (file)
index 0000000..ff99fcc
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/runtime"
+)
+
+// A1ControllerGetPolicyInstanceStatusOKCode is the HTTP code returned for type A1ControllerGetPolicyInstanceStatusOK
+const A1ControllerGetPolicyInstanceStatusOKCode int = 200
+
+/*A1ControllerGetPolicyInstanceStatusOK successfully retrieved the status
+
+
+swagger:response a1ControllerGetPolicyInstanceStatusOK
+*/
+type A1ControllerGetPolicyInstanceStatusOK struct {
+
+       /*
+         In: Body
+       */
+       Payload *A1ControllerGetPolicyInstanceStatusOKBody `json:"body,omitempty"`
+}
+
+// NewA1ControllerGetPolicyInstanceStatusOK creates A1ControllerGetPolicyInstanceStatusOK with default headers values
+func NewA1ControllerGetPolicyInstanceStatusOK() *A1ControllerGetPolicyInstanceStatusOK {
+
+       return &A1ControllerGetPolicyInstanceStatusOK{}
+}
+
+// WithPayload adds the payload to the a1 controller get policy instance status o k response
+func (o *A1ControllerGetPolicyInstanceStatusOK) WithPayload(payload *A1ControllerGetPolicyInstanceStatusOKBody) *A1ControllerGetPolicyInstanceStatusOK {
+       o.Payload = payload
+       return o
+}
+
+// SetPayload sets the payload to the a1 controller get policy instance status o k response
+func (o *A1ControllerGetPolicyInstanceStatusOK) SetPayload(payload *A1ControllerGetPolicyInstanceStatusOKBody) {
+       o.Payload = payload
+}
+
+// WriteResponse to the client
+func (o *A1ControllerGetPolicyInstanceStatusOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.WriteHeader(200)
+       if o.Payload != nil {
+               payload := o.Payload
+               if err := producer.Produce(rw, payload); err != nil {
+                       panic(err) // let the recovery middleware deal with this
+               }
+       }
+}
+
+// A1ControllerGetPolicyInstanceStatusNotFoundCode is the HTTP code returned for type A1ControllerGetPolicyInstanceStatusNotFound
+const A1ControllerGetPolicyInstanceStatusNotFoundCode int = 404
+
+/*A1ControllerGetPolicyInstanceStatusNotFound there is no policy instance with this policy_instance_id or there is no policy type with this policy_type_id
+
+
+swagger:response a1ControllerGetPolicyInstanceStatusNotFound
+*/
+type A1ControllerGetPolicyInstanceStatusNotFound struct {
+}
+
+// NewA1ControllerGetPolicyInstanceStatusNotFound creates A1ControllerGetPolicyInstanceStatusNotFound with default headers values
+func NewA1ControllerGetPolicyInstanceStatusNotFound() *A1ControllerGetPolicyInstanceStatusNotFound {
+
+       return &A1ControllerGetPolicyInstanceStatusNotFound{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerGetPolicyInstanceStatusNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(404)
+}
+
+// A1ControllerGetPolicyInstanceStatusServiceUnavailableCode is the HTTP code returned for type A1ControllerGetPolicyInstanceStatusServiceUnavailable
+const A1ControllerGetPolicyInstanceStatusServiceUnavailableCode int = 503
+
+/*A1ControllerGetPolicyInstanceStatusServiceUnavailable Potentially transient backend database error. Client should attempt to retry later.
+
+swagger:response a1ControllerGetPolicyInstanceStatusServiceUnavailable
+*/
+type A1ControllerGetPolicyInstanceStatusServiceUnavailable struct {
+}
+
+// NewA1ControllerGetPolicyInstanceStatusServiceUnavailable creates A1ControllerGetPolicyInstanceStatusServiceUnavailable with default headers values
+func NewA1ControllerGetPolicyInstanceStatusServiceUnavailable() *A1ControllerGetPolicyInstanceStatusServiceUnavailable {
+
+       return &A1ControllerGetPolicyInstanceStatusServiceUnavailable{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerGetPolicyInstanceStatusServiceUnavailable) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(503)
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance_status_urlbuilder.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance_status_urlbuilder.go
new file mode 100644 (file)
index 0000000..daa3860
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "errors"
+       "net/url"
+       golangswaggerpaths "path"
+       "strings"
+
+       "github.com/go-openapi/swag"
+)
+
+// A1ControllerGetPolicyInstanceStatusURL generates an URL for the a1 controller get policy instance status operation
+type A1ControllerGetPolicyInstanceStatusURL struct {
+       PolicyInstanceID string
+       PolicyTypeID     int64
+
+       _basePath string
+       // avoid unkeyed usage
+       _ struct{}
+}
+
+// WithBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *A1ControllerGetPolicyInstanceStatusURL) WithBasePath(bp string) *A1ControllerGetPolicyInstanceStatusURL {
+       o.SetBasePath(bp)
+       return o
+}
+
+// SetBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *A1ControllerGetPolicyInstanceStatusURL) SetBasePath(bp string) {
+       o._basePath = bp
+}
+
+// Build a url path and query string
+func (o *A1ControllerGetPolicyInstanceStatusURL) Build() (*url.URL, error) {
+       var _result url.URL
+
+       var _path = "/a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id}/status"
+
+       policyInstanceID := o.PolicyInstanceID
+       if policyInstanceID != "" {
+               _path = strings.Replace(_path, "{policy_instance_id}", policyInstanceID, -1)
+       } else {
+               return nil, errors.New("policyInstanceId is required on A1ControllerGetPolicyInstanceStatusURL")
+       }
+
+       policyTypeID := swag.FormatInt64(o.PolicyTypeID)
+       if policyTypeID != "" {
+               _path = strings.Replace(_path, "{policy_type_id}", policyTypeID, -1)
+       } else {
+               return nil, errors.New("policyTypeId is required on A1ControllerGetPolicyInstanceStatusURL")
+       }
+
+       _basePath := o._basePath
+       _result.Path = golangswaggerpaths.Join(_basePath, _path)
+
+       return &_result, nil
+}
+
+// Must is a helper function to panic when the url builder returns an error
+func (o *A1ControllerGetPolicyInstanceStatusURL) Must(u *url.URL, err error) *url.URL {
+       if err != nil {
+               panic(err)
+       }
+       if u == nil {
+               panic("url can't be nil")
+       }
+       return u
+}
+
+// String returns the string representation of the path with query string
+func (o *A1ControllerGetPolicyInstanceStatusURL) String() string {
+       return o.Must(o.Build()).String()
+}
+
+// BuildFull builds a full url with scheme, host, path and query string
+func (o *A1ControllerGetPolicyInstanceStatusURL) BuildFull(scheme, host string) (*url.URL, error) {
+       if scheme == "" {
+               return nil, errors.New("scheme is required for a full url on A1ControllerGetPolicyInstanceStatusURL")
+       }
+       if host == "" {
+               return nil, errors.New("host is required for a full url on A1ControllerGetPolicyInstanceStatusURL")
+       }
+
+       base, err := o.Build()
+       if err != nil {
+               return nil, err
+       }
+
+       base.Scheme = scheme
+       base.Host = host
+       return base, nil
+}
+
+// StringFull returns the string representation of a complete url
+func (o *A1ControllerGetPolicyInstanceStatusURL) StringFull(scheme, host string) string {
+       return o.Must(o.BuildFull(scheme, host)).String()
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance_urlbuilder.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_instance_urlbuilder.go
new file mode 100644 (file)
index 0000000..856e61b
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "errors"
+       "net/url"
+       golangswaggerpaths "path"
+       "strings"
+
+       "github.com/go-openapi/swag"
+)
+
+// A1ControllerGetPolicyInstanceURL generates an URL for the a1 controller get policy instance operation
+type A1ControllerGetPolicyInstanceURL struct {
+       PolicyInstanceID string
+       PolicyTypeID     int64
+
+       _basePath string
+       // avoid unkeyed usage
+       _ struct{}
+}
+
+// WithBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *A1ControllerGetPolicyInstanceURL) WithBasePath(bp string) *A1ControllerGetPolicyInstanceURL {
+       o.SetBasePath(bp)
+       return o
+}
+
+// SetBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *A1ControllerGetPolicyInstanceURL) SetBasePath(bp string) {
+       o._basePath = bp
+}
+
+// Build a url path and query string
+func (o *A1ControllerGetPolicyInstanceURL) Build() (*url.URL, error) {
+       var _result url.URL
+
+       var _path = "/a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id}"
+
+       policyInstanceID := o.PolicyInstanceID
+       if policyInstanceID != "" {
+               _path = strings.Replace(_path, "{policy_instance_id}", policyInstanceID, -1)
+       } else {
+               return nil, errors.New("policyInstanceId is required on A1ControllerGetPolicyInstanceURL")
+       }
+
+       policyTypeID := swag.FormatInt64(o.PolicyTypeID)
+       if policyTypeID != "" {
+               _path = strings.Replace(_path, "{policy_type_id}", policyTypeID, -1)
+       } else {
+               return nil, errors.New("policyTypeId is required on A1ControllerGetPolicyInstanceURL")
+       }
+
+       _basePath := o._basePath
+       _result.Path = golangswaggerpaths.Join(_basePath, _path)
+
+       return &_result, nil
+}
+
+// Must is a helper function to panic when the url builder returns an error
+func (o *A1ControllerGetPolicyInstanceURL) Must(u *url.URL, err error) *url.URL {
+       if err != nil {
+               panic(err)
+       }
+       if u == nil {
+               panic("url can't be nil")
+       }
+       return u
+}
+
+// String returns the string representation of the path with query string
+func (o *A1ControllerGetPolicyInstanceURL) String() string {
+       return o.Must(o.Build()).String()
+}
+
+// BuildFull builds a full url with scheme, host, path and query string
+func (o *A1ControllerGetPolicyInstanceURL) BuildFull(scheme, host string) (*url.URL, error) {
+       if scheme == "" {
+               return nil, errors.New("scheme is required for a full url on A1ControllerGetPolicyInstanceURL")
+       }
+       if host == "" {
+               return nil, errors.New("host is required for a full url on A1ControllerGetPolicyInstanceURL")
+       }
+
+       base, err := o.Build()
+       if err != nil {
+               return nil, err
+       }
+
+       base.Scheme = scheme
+       base.Host = host
+       return base, nil
+}
+
+// StringFull returns the string representation of a complete url
+func (o *A1ControllerGetPolicyInstanceURL) StringFull(scheme, host string) string {
+       return o.Must(o.BuildFull(scheme, host)).String()
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_type.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_type.go
new file mode 100644 (file)
index 0000000..4ab7c05
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/runtime/middleware"
+)
+
+// A1ControllerGetPolicyTypeHandlerFunc turns a function with the right signature into a a1 controller get policy type handler
+type A1ControllerGetPolicyTypeHandlerFunc func(A1ControllerGetPolicyTypeParams) middleware.Responder
+
+// Handle executing the request and returning a response
+func (fn A1ControllerGetPolicyTypeHandlerFunc) Handle(params A1ControllerGetPolicyTypeParams) middleware.Responder {
+       return fn(params)
+}
+
+// A1ControllerGetPolicyTypeHandler interface for that can handle valid a1 controller get policy type params
+type A1ControllerGetPolicyTypeHandler interface {
+       Handle(A1ControllerGetPolicyTypeParams) middleware.Responder
+}
+
+// NewA1ControllerGetPolicyType creates a new http.Handler for the a1 controller get policy type operation
+func NewA1ControllerGetPolicyType(ctx *middleware.Context, handler A1ControllerGetPolicyTypeHandler) *A1ControllerGetPolicyType {
+       return &A1ControllerGetPolicyType{Context: ctx, Handler: handler}
+}
+
+/*A1ControllerGetPolicyType swagger:route GET /a1-p/policytypes/{policy_type_id} A1 Mediator a1ControllerGetPolicyType
+
+Get this policy type
+
+
+*/
+type A1ControllerGetPolicyType struct {
+       Context *middleware.Context
+       Handler A1ControllerGetPolicyTypeHandler
+}
+
+func (o *A1ControllerGetPolicyType) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
+       route, rCtx, _ := o.Context.RouteInfo(r)
+       if rCtx != nil {
+               r = rCtx
+       }
+       var Params = NewA1ControllerGetPolicyTypeParams()
+
+       if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
+               o.Context.Respond(rw, r, route.Produces, route, err)
+               return
+       }
+
+       res := o.Handler.Handle(Params) // actually handle the request
+
+       o.Context.Respond(rw, r, route.Produces, route, res)
+
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_type_parameters.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_type_parameters.go
new file mode 100644 (file)
index 0000000..9c39fcb
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/runtime/middleware"
+       "github.com/go-openapi/strfmt"
+       "github.com/go-openapi/swag"
+       "github.com/go-openapi/validate"
+)
+
+// NewA1ControllerGetPolicyTypeParams creates a new A1ControllerGetPolicyTypeParams object
+// no default values defined in spec.
+func NewA1ControllerGetPolicyTypeParams() A1ControllerGetPolicyTypeParams {
+
+       return A1ControllerGetPolicyTypeParams{}
+}
+
+// A1ControllerGetPolicyTypeParams contains all the bound params for the a1 controller get policy type operation
+// typically these are obtained from a http.Request
+//
+// swagger:parameters a1.controller.get_policy_type
+type A1ControllerGetPolicyTypeParams struct {
+
+       // HTTP Request Object
+       HTTPRequest *http.Request `json:"-"`
+
+       /*represents a policy type identifier. Currently this is restricted to an integer range.
+
+         Required: true
+         Maximum: 2.147483647e+09
+         Minimum: 1
+         In: path
+       */
+       PolicyTypeID int64
+}
+
+// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
+// for simple values it will use straight method calls.
+//
+// To ensure default values, the struct must have been initialized with NewA1ControllerGetPolicyTypeParams() beforehand.
+func (o *A1ControllerGetPolicyTypeParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
+       var res []error
+
+       o.HTTPRequest = r
+
+       rPolicyTypeID, rhkPolicyTypeID, _ := route.Params.GetOK("policy_type_id")
+       if err := o.bindPolicyTypeID(rPolicyTypeID, rhkPolicyTypeID, route.Formats); err != nil {
+               res = append(res, err)
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
+
+// bindPolicyTypeID binds and validates parameter PolicyTypeID from path.
+func (o *A1ControllerGetPolicyTypeParams) bindPolicyTypeID(rawData []string, hasKey bool, formats strfmt.Registry) error {
+       var raw string
+       if len(rawData) > 0 {
+               raw = rawData[len(rawData)-1]
+       }
+
+       // Required: true
+       // Parameter is provided by construction from the route
+
+       value, err := swag.ConvertInt64(raw)
+       if err != nil {
+               return errors.InvalidType("policy_type_id", "path", "int64", raw)
+       }
+       o.PolicyTypeID = value
+
+       if err := o.validatePolicyTypeID(formats); err != nil {
+               return err
+       }
+
+       return nil
+}
+
+// validatePolicyTypeID carries on validations for parameter PolicyTypeID
+func (o *A1ControllerGetPolicyTypeParams) validatePolicyTypeID(formats strfmt.Registry) error {
+
+       if err := validate.MinimumInt("policy_type_id", "path", int64(o.PolicyTypeID), 1, false); err != nil {
+               return err
+       }
+
+       if err := validate.MaximumInt("policy_type_id", "path", int64(o.PolicyTypeID), 2.147483647e+09, false); err != nil {
+               return err
+       }
+
+       return nil
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_type_responses.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_type_responses.go
new file mode 100644 (file)
index 0000000..553c320
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "net/http"
+
+       "github.com/go-openapi/runtime"
+
+       "subh.com/a1-go/pkg/models"
+)
+
+// A1ControllerGetPolicyTypeOKCode is the HTTP code returned for type A1ControllerGetPolicyTypeOK
+const A1ControllerGetPolicyTypeOKCode int = 200
+
+/*A1ControllerGetPolicyTypeOK policy type successfully found
+
+swagger:response a1ControllerGetPolicyTypeOK
+*/
+type A1ControllerGetPolicyTypeOK struct {
+
+       /*
+         In: Body
+       */
+       Payload *models.PolicyTypeSchema `json:"body,omitempty"`
+}
+
+// NewA1ControllerGetPolicyTypeOK creates A1ControllerGetPolicyTypeOK with default headers values
+func NewA1ControllerGetPolicyTypeOK() *A1ControllerGetPolicyTypeOK {
+
+       return &A1ControllerGetPolicyTypeOK{}
+}
+
+// WithPayload adds the payload to the a1 controller get policy type o k response
+func (o *A1ControllerGetPolicyTypeOK) WithPayload(payload *models.PolicyTypeSchema) *A1ControllerGetPolicyTypeOK {
+       o.Payload = payload
+       return o
+}
+
+// SetPayload sets the payload to the a1 controller get policy type o k response
+func (o *A1ControllerGetPolicyTypeOK) SetPayload(payload *models.PolicyTypeSchema) {
+       o.Payload = payload
+}
+
+// WriteResponse to the client
+func (o *A1ControllerGetPolicyTypeOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.WriteHeader(200)
+       if o.Payload != nil {
+               payload := o.Payload
+               if err := producer.Produce(rw, payload); err != nil {
+                       panic(err) // let the recovery middleware deal with this
+               }
+       }
+}
+
+// A1ControllerGetPolicyTypeNotFoundCode is the HTTP code returned for type A1ControllerGetPolicyTypeNotFound
+const A1ControllerGetPolicyTypeNotFoundCode int = 404
+
+/*A1ControllerGetPolicyTypeNotFound policy type not found
+
+
+swagger:response a1ControllerGetPolicyTypeNotFound
+*/
+type A1ControllerGetPolicyTypeNotFound struct {
+}
+
+// NewA1ControllerGetPolicyTypeNotFound creates A1ControllerGetPolicyTypeNotFound with default headers values
+func NewA1ControllerGetPolicyTypeNotFound() *A1ControllerGetPolicyTypeNotFound {
+
+       return &A1ControllerGetPolicyTypeNotFound{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerGetPolicyTypeNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(404)
+}
+
+// A1ControllerGetPolicyTypeServiceUnavailableCode is the HTTP code returned for type A1ControllerGetPolicyTypeServiceUnavailable
+const A1ControllerGetPolicyTypeServiceUnavailableCode int = 503
+
+/*A1ControllerGetPolicyTypeServiceUnavailable Potentially transient backend database error. Client should attempt to retry later.
+
+swagger:response a1ControllerGetPolicyTypeServiceUnavailable
+*/
+type A1ControllerGetPolicyTypeServiceUnavailable struct {
+}
+
+// NewA1ControllerGetPolicyTypeServiceUnavailable creates A1ControllerGetPolicyTypeServiceUnavailable with default headers values
+func NewA1ControllerGetPolicyTypeServiceUnavailable() *A1ControllerGetPolicyTypeServiceUnavailable {
+
+       return &A1ControllerGetPolicyTypeServiceUnavailable{}
+}
+
+// WriteResponse to the client
+func (o *A1ControllerGetPolicyTypeServiceUnavailable) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(503)
+}
diff --git a/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_type_urlbuilder.go b/a1-go/pkg/restapi/operations/a1_mediator/a1_controller_get_policy_type_urlbuilder.go
new file mode 100644 (file)
index 0000000..775430c
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package a1_mediator
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "errors"
+       "net/url"
+       golangswaggerpaths "path"
+       "strings"
+
+       "github.com/go-openapi/swag"
+)
+
+// A1ControllerGetPolicyTypeURL generates an URL for the a1 controller get policy type operation
+type A1ControllerGetPolicyTypeURL struct {
+       PolicyTypeID int64
+
+       _basePath string
+       // avoid unkeyed usage
+       _ struct{}
+}
+
+// WithBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *A1ControllerGetPolicyTypeURL) WithBasePath(bp string) *A1ControllerGetPolicyTypeURL {
+       o.SetBasePath(bp)
+       return o
+}
+
+// SetBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *A1ControllerGetPolicyTypeURL) SetBasePath(bp string) {
+       o._basePath = bp
+}
+
+// Build a url path and query string
+func (o *A1ControllerGetPolicyTypeURL) Build() (*url.URL, error) {
+       var _result url.URL
+
+       var _path = "/a1-p/policytypes/{policy_type_id}"
+
+       policyTypeID := swag.FormatInt64(o.PolicyTypeID)
+       if policyTypeID != "" {
+               _path = strings.Replace(_path, "{policy_type_id}", policyTypeID, -1)
+       } else {
+               return nil, errors.New("policyTypeId is required on A1ControllerGetPolicyTypeURL")
+       }
+
+       _basePath := o._basePath
+       _result.Path = golangswaggerpaths.Join(_basePath, _path)
+
+       return &_result, nil
+}
+
+// Must is a helper function to panic when the url builder returns an error
+func (o *A1ControllerGetPolicyTypeURL) Must(u *url.URL, err error) *url.URL {
+       if err != nil {
+               panic(err)
+       }
+       if u == nil {
+               panic("url can't be nil")
+       }
+       return u
+}
+
+// String returns the string representation of the path with query string
+func (o *A1ControllerGetPolicyTypeURL) String() string {
+       return o.Must(o.Build()).String()
+}
+
+// BuildFull builds a full url with scheme, host, path and query string
+func (o *A1ControllerGetPolicyTypeURL) BuildFull(scheme, host string) (*url.URL, error) {
+       if scheme == "" {
+               return nil, errors.New("scheme is required for a full url on A1ControllerGetPolicyTypeURL")
+       }
+       if host == "" {
+               return nil, errors.New("host is required for a full url on A1ControllerGetPolicyTypeURL")
+       }
+
+       base, err := o.Build()
+       if err != nil {
+               return nil, err
+       }
+
+       base.Scheme = scheme
+       base.Host = host
+       return base, nil
+}
+
+// StringFull returns the string representation of a complete url
+func (o *A1ControllerGetPolicyTypeURL) StringFull(scheme, host string) string {
+       return o.Must(o.BuildFull(scheme, host)).String()
+}
diff --git a/a1-go/pkg/restapi/server.go b/a1-go/pkg/restapi/server.go
new file mode 100644 (file)
index 0000000..c7c17ec
--- /dev/null
@@ -0,0 +1,531 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+// Code generated by go-swagger; DO NOT EDIT.
+
+package restapi
+
+import (
+       "context"
+       "crypto/tls"
+       "crypto/x509"
+       "errors"
+       "fmt"
+       "io/ioutil"
+       "log"
+       "net"
+       "net/http"
+       "os"
+       "os/signal"
+       "strconv"
+       "sync"
+       "sync/atomic"
+       "syscall"
+       "time"
+
+       "github.com/go-openapi/runtime/flagext"
+       "github.com/go-openapi/swag"
+       flags "github.com/jessevdk/go-flags"
+       "golang.org/x/net/netutil"
+
+       "subh.com/a1-go/pkg/restapi/operations"
+)
+
+const (
+       schemeHTTP  = "http"
+       schemeHTTPS = "https"
+       schemeUnix  = "unix"
+)
+
+var defaultSchemes []string
+
+func init() {
+       defaultSchemes = []string{
+               schemeHTTP,
+       }
+}
+
+// NewServer creates a new api a1 server but does not configure it
+func NewServer(api *operations.A1API) *Server {
+       s := new(Server)
+
+       s.shutdown = make(chan struct{})
+       s.api = api
+       s.interrupt = make(chan os.Signal, 1)
+       return s
+}
+
+// ConfigureAPI configures the API and handlers.
+func (s *Server) ConfigureAPI() {
+       if s.api != nil {
+               s.handler = configureAPI(s.api)
+       }
+}
+
+// ConfigureFlags configures the additional flags defined by the handlers. Needs to be called before the parser.Parse
+func (s *Server) ConfigureFlags() {
+       if s.api != nil {
+               configureFlags(s.api)
+       }
+}
+
+// Server for the a1 API
+type Server struct {
+       EnabledListeners []string         `long:"scheme" description:"the listeners to enable, this can be repeated and defaults to the schemes in the swagger spec"`
+       CleanupTimeout   time.Duration    `long:"cleanup-timeout" description:"grace period for which to wait before killing idle connections" default:"10s"`
+       GracefulTimeout  time.Duration    `long:"graceful-timeout" description:"grace period for which to wait before shutting down the server" default:"15s"`
+       MaxHeaderSize    flagext.ByteSize `long:"max-header-size" description:"controls the maximum number of bytes the server will read parsing the request header's keys and values, including the request line. It does not limit the size of the request body." default:"1MiB"`
+
+       SocketPath    flags.Filename `long:"socket-path" description:"the unix socket to listen on" default:"/var/run/a1.sock"`
+       domainSocketL net.Listener
+
+       Host         string        `long:"host" description:"the IP to listen on" default:"localhost" env:"HOST"`
+       Port         int           `long:"port" description:"the port to listen on for insecure connections, defaults to a random value" env:"PORT"`
+       ListenLimit  int           `long:"listen-limit" description:"limit the number of outstanding requests"`
+       KeepAlive    time.Duration `long:"keep-alive" description:"sets the TCP keep-alive timeouts on accepted connections. It prunes dead TCP connections ( e.g. closing laptop mid-download)" default:"3m"`
+       ReadTimeout  time.Duration `long:"read-timeout" description:"maximum duration before timing out read of the request" default:"30s"`
+       WriteTimeout time.Duration `long:"write-timeout" description:"maximum duration before timing out write of the response" default:"60s"`
+       httpServerL  net.Listener
+
+       TLSHost           string         `long:"tls-host" description:"the IP to listen on for tls, when not specified it's the same as --host" env:"TLS_HOST"`
+       TLSPort           int            `long:"tls-port" description:"the port to listen on for secure connections, defaults to a random value" env:"TLS_PORT"`
+       TLSCertificate    flags.Filename `long:"tls-certificate" description:"the certificate to use for secure connections" env:"TLS_CERTIFICATE"`
+       TLSCertificateKey flags.Filename `long:"tls-key" description:"the private key to use for secure connections" env:"TLS_PRIVATE_KEY"`
+       TLSCACertificate  flags.Filename `long:"tls-ca" description:"the certificate authority file to be used with mutual tls auth" env:"TLS_CA_CERTIFICATE"`
+       TLSListenLimit    int            `long:"tls-listen-limit" description:"limit the number of outstanding requests"`
+       TLSKeepAlive      time.Duration  `long:"tls-keep-alive" description:"sets the TCP keep-alive timeouts on accepted connections. It prunes dead TCP connections ( e.g. closing laptop mid-download)"`
+       TLSReadTimeout    time.Duration  `long:"tls-read-timeout" description:"maximum duration before timing out read of the request"`
+       TLSWriteTimeout   time.Duration  `long:"tls-write-timeout" description:"maximum duration before timing out write of the response"`
+       httpsServerL      net.Listener
+
+       api          *operations.A1API
+       handler      http.Handler
+       hasListeners bool
+       shutdown     chan struct{}
+       shuttingDown int32
+       interrupted  bool
+       interrupt    chan os.Signal
+}
+
+// Logf logs message either via defined user logger or via system one if no user logger is defined.
+func (s *Server) Logf(f string, args ...interface{}) {
+       if s.api != nil && s.api.Logger != nil {
+               s.api.Logger(f, args...)
+       } else {
+               log.Printf(f, args...)
+       }
+}
+
+// Fatalf logs message either via defined user logger or via system one if no user logger is defined.
+// Exits with non-zero status after printing
+func (s *Server) Fatalf(f string, args ...interface{}) {
+       if s.api != nil && s.api.Logger != nil {
+               s.api.Logger(f, args...)
+               os.Exit(1)
+       } else {
+               log.Fatalf(f, args...)
+       }
+}
+
+// SetAPI configures the server with the specified API. Needs to be called before Serve
+func (s *Server) SetAPI(api *operations.A1API) {
+       if api == nil {
+               s.api = nil
+               s.handler = nil
+               return
+       }
+
+       s.api = api
+       s.handler = configureAPI(api)
+}
+
+func (s *Server) hasScheme(scheme string) bool {
+       schemes := s.EnabledListeners
+       if len(schemes) == 0 {
+               schemes = defaultSchemes
+       }
+
+       for _, v := range schemes {
+               if v == scheme {
+                       return true
+               }
+       }
+       return false
+}
+
+// Serve the api
+func (s *Server) Serve() (err error) {
+       if !s.hasListeners {
+               if err = s.Listen(); err != nil {
+                       return err
+               }
+       }
+
+       // set default handler, if none is set
+       if s.handler == nil {
+               if s.api == nil {
+                       return errors.New("can't create the default handler, as no api is set")
+               }
+
+               s.SetHandler(s.api.Serve(nil))
+       }
+
+       wg := new(sync.WaitGroup)
+       once := new(sync.Once)
+       signalNotify(s.interrupt)
+       go handleInterrupt(once, s)
+
+       servers := []*http.Server{}
+
+       if s.hasScheme(schemeUnix) {
+               domainSocket := new(http.Server)
+               domainSocket.MaxHeaderBytes = int(s.MaxHeaderSize)
+               domainSocket.Handler = s.handler
+               if int64(s.CleanupTimeout) > 0 {
+                       domainSocket.IdleTimeout = s.CleanupTimeout
+               }
+
+               configureServer(domainSocket, "unix", string(s.SocketPath))
+
+               servers = append(servers, domainSocket)
+               wg.Add(1)
+               s.Logf("Serving a1 at unix://%s", s.SocketPath)
+               go func(l net.Listener) {
+                       defer wg.Done()
+                       if err := domainSocket.Serve(l); err != nil && err != http.ErrServerClosed {
+                               s.Fatalf("%v", err)
+                       }
+                       s.Logf("Stopped serving a1 at unix://%s", s.SocketPath)
+               }(s.domainSocketL)
+       }
+
+       if s.hasScheme(schemeHTTP) {
+               httpServer := new(http.Server)
+               httpServer.MaxHeaderBytes = int(s.MaxHeaderSize)
+               httpServer.ReadTimeout = s.ReadTimeout
+               httpServer.WriteTimeout = s.WriteTimeout
+               httpServer.SetKeepAlivesEnabled(int64(s.KeepAlive) > 0)
+               if s.ListenLimit > 0 {
+                       s.httpServerL = netutil.LimitListener(s.httpServerL, s.ListenLimit)
+               }
+
+               if int64(s.CleanupTimeout) > 0 {
+                       httpServer.IdleTimeout = s.CleanupTimeout
+               }
+
+               httpServer.Handler = s.handler
+
+               configureServer(httpServer, "http", s.httpServerL.Addr().String())
+
+               servers = append(servers, httpServer)
+               wg.Add(1)
+               s.Logf("Serving a1 at http://%s", s.httpServerL.Addr())
+               go func(l net.Listener) {
+                       defer wg.Done()
+                       if err := httpServer.Serve(l); err != nil && err != http.ErrServerClosed {
+                               s.Fatalf("%v", err)
+                       }
+                       s.Logf("Stopped serving a1 at http://%s", l.Addr())
+               }(s.httpServerL)
+       }
+
+       if s.hasScheme(schemeHTTPS) {
+               httpsServer := new(http.Server)
+               httpsServer.MaxHeaderBytes = int(s.MaxHeaderSize)
+               httpsServer.ReadTimeout = s.TLSReadTimeout
+               httpsServer.WriteTimeout = s.TLSWriteTimeout
+               httpsServer.SetKeepAlivesEnabled(int64(s.TLSKeepAlive) > 0)
+               if s.TLSListenLimit > 0 {
+                       s.httpsServerL = netutil.LimitListener(s.httpsServerL, s.TLSListenLimit)
+               }
+               if int64(s.CleanupTimeout) > 0 {
+                       httpsServer.IdleTimeout = s.CleanupTimeout
+               }
+               httpsServer.Handler = s.handler
+
+               // Inspired by https://blog.bracebin.com/achieving-perfect-ssl-labs-score-with-go
+               httpsServer.TLSConfig = &tls.Config{
+                       // Causes servers to use Go's default ciphersuite preferences,
+                       // which are tuned to avoid attacks. Does nothing on clients.
+                       PreferServerCipherSuites: true,
+                       // Only use curves which have assembly implementations
+                       // https://github.com/golang/go/tree/master/src/crypto/elliptic
+                       CurvePreferences: []tls.CurveID{tls.CurveP256},
+                       // Use modern tls mode https://wiki.mozilla.org/Security/Server_Side_TLS#Modern_compatibility
+                       NextProtos: []string{"h2", "http/1.1"},
+                       // https://www.owasp.org/index.php/Transport_Layer_Protection_Cheat_Sheet#Rule_-_Only_Support_Strong_Protocols
+                       MinVersion: tls.VersionTLS12,
+                       // These ciphersuites support Forward Secrecy: https://en.wikipedia.org/wiki/Forward_secrecy
+                       CipherSuites: []uint16{
+                               tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
+                               tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
+                               tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
+                               tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
+                               tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
+                               tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,
+                       },
+               }
+
+               // build standard config from server options
+               if s.TLSCertificate != "" && s.TLSCertificateKey != "" {
+                       httpsServer.TLSConfig.Certificates = make([]tls.Certificate, 1)
+                       httpsServer.TLSConfig.Certificates[0], err = tls.LoadX509KeyPair(string(s.TLSCertificate), string(s.TLSCertificateKey))
+                       if err != nil {
+                               return err
+                       }
+               }
+
+               if s.TLSCACertificate != "" {
+                       // include specified CA certificate
+                       caCert, caCertErr := ioutil.ReadFile(string(s.TLSCACertificate))
+                       if caCertErr != nil {
+                               return caCertErr
+                       }
+                       caCertPool := x509.NewCertPool()
+                       ok := caCertPool.AppendCertsFromPEM(caCert)
+                       if !ok {
+                               return fmt.Errorf("cannot parse CA certificate")
+                       }
+                       httpsServer.TLSConfig.ClientCAs = caCertPool
+                       httpsServer.TLSConfig.ClientAuth = tls.RequireAndVerifyClientCert
+               }
+
+               // call custom TLS configurator
+               configureTLS(httpsServer.TLSConfig)
+
+               if len(httpsServer.TLSConfig.Certificates) == 0 && httpsServer.TLSConfig.GetCertificate == nil {
+                       // after standard and custom config are passed, this ends up with no certificate
+                       if s.TLSCertificate == "" {
+                               if s.TLSCertificateKey == "" {
+                                       s.Fatalf("the required flags `--tls-certificate` and `--tls-key` were not specified")
+                               }
+                               s.Fatalf("the required flag `--tls-certificate` was not specified")
+                       }
+                       if s.TLSCertificateKey == "" {
+                               s.Fatalf("the required flag `--tls-key` was not specified")
+                       }
+                       // this happens with a wrong custom TLS configurator
+                       s.Fatalf("no certificate was configured for TLS")
+               }
+
+               // must have at least one certificate or panics
+               httpsServer.TLSConfig.BuildNameToCertificate()
+
+               configureServer(httpsServer, "https", s.httpsServerL.Addr().String())
+
+               servers = append(servers, httpsServer)
+               wg.Add(1)
+               s.Logf("Serving a1 at https://%s", s.httpsServerL.Addr())
+               go func(l net.Listener) {
+                       defer wg.Done()
+                       if err := httpsServer.Serve(l); err != nil && err != http.ErrServerClosed {
+                               s.Fatalf("%v", err)
+                       }
+                       s.Logf("Stopped serving a1 at https://%s", l.Addr())
+               }(tls.NewListener(s.httpsServerL, httpsServer.TLSConfig))
+       }
+
+       wg.Add(1)
+       go s.handleShutdown(wg, &servers)
+
+       wg.Wait()
+       return nil
+}
+
+// Listen creates the listeners for the server
+func (s *Server) Listen() error {
+       if s.hasListeners { // already done this
+               return nil
+       }
+
+       if s.hasScheme(schemeHTTPS) {
+               // Use http host if https host wasn't defined
+               if s.TLSHost == "" {
+                       s.TLSHost = s.Host
+               }
+               // Use http listen limit if https listen limit wasn't defined
+               if s.TLSListenLimit == 0 {
+                       s.TLSListenLimit = s.ListenLimit
+               }
+               // Use http tcp keep alive if https tcp keep alive wasn't defined
+               if int64(s.TLSKeepAlive) == 0 {
+                       s.TLSKeepAlive = s.KeepAlive
+               }
+               // Use http read timeout if https read timeout wasn't defined
+               if int64(s.TLSReadTimeout) == 0 {
+                       s.TLSReadTimeout = s.ReadTimeout
+               }
+               // Use http write timeout if https write timeout wasn't defined
+               if int64(s.TLSWriteTimeout) == 0 {
+                       s.TLSWriteTimeout = s.WriteTimeout
+               }
+       }
+
+       if s.hasScheme(schemeUnix) {
+               domSockListener, err := net.Listen("unix", string(s.SocketPath))
+               if err != nil {
+                       return err
+               }
+               s.domainSocketL = domSockListener
+       }
+
+       if s.hasScheme(schemeHTTP) {
+               listener, err := net.Listen("tcp", net.JoinHostPort(s.Host, strconv.Itoa(s.Port)))
+               if err != nil {
+                       return err
+               }
+
+               h, p, err := swag.SplitHostPort(listener.Addr().String())
+               if err != nil {
+                       return err
+               }
+               s.Host = h
+               s.Port = p
+               s.httpServerL = listener
+       }
+
+       if s.hasScheme(schemeHTTPS) {
+               tlsListener, err := net.Listen("tcp", net.JoinHostPort(s.TLSHost, strconv.Itoa(s.TLSPort)))
+               if err != nil {
+                       return err
+               }
+
+               sh, sp, err := swag.SplitHostPort(tlsListener.Addr().String())
+               if err != nil {
+                       return err
+               }
+               s.TLSHost = sh
+               s.TLSPort = sp
+               s.httpsServerL = tlsListener
+       }
+
+       s.hasListeners = true
+       return nil
+}
+
+// Shutdown server and clean up resources
+func (s *Server) Shutdown() error {
+       if atomic.CompareAndSwapInt32(&s.shuttingDown, 0, 1) {
+               close(s.shutdown)
+       }
+       return nil
+}
+
+func (s *Server) handleShutdown(wg *sync.WaitGroup, serversPtr *[]*http.Server) {
+       // wg.Done must occur last, after s.api.ServerShutdown()
+       // (to preserve old behaviour)
+       defer wg.Done()
+
+       <-s.shutdown
+
+       servers := *serversPtr
+
+       ctx, cancel := context.WithTimeout(context.TODO(), s.GracefulTimeout)
+       defer cancel()
+
+       // first execute the pre-shutdown hook
+       s.api.PreServerShutdown()
+
+       shutdownChan := make(chan bool)
+       for i := range servers {
+               server := servers[i]
+               go func() {
+                       var success bool
+                       defer func() {
+                               shutdownChan <- success
+                       }()
+                       if err := server.Shutdown(ctx); err != nil {
+                               // Error from closing listeners, or context timeout:
+                               s.Logf("HTTP server Shutdown: %v", err)
+                       } else {
+                               success = true
+                       }
+               }()
+       }
+
+       // Wait until all listeners have successfully shut down before calling ServerShutdown
+       success := true
+       for range servers {
+               success = success && <-shutdownChan
+       }
+       if success {
+               s.api.ServerShutdown()
+       }
+}
+
+// GetHandler returns a handler useful for testing
+func (s *Server) GetHandler() http.Handler {
+       return s.handler
+}
+
+// SetHandler allows for setting a http handler on this server
+func (s *Server) SetHandler(handler http.Handler) {
+       s.handler = handler
+}
+
+// UnixListener returns the domain socket listener
+func (s *Server) UnixListener() (net.Listener, error) {
+       if !s.hasListeners {
+               if err := s.Listen(); err != nil {
+                       return nil, err
+               }
+       }
+       return s.domainSocketL, nil
+}
+
+// HTTPListener returns the http listener
+func (s *Server) HTTPListener() (net.Listener, error) {
+       if !s.hasListeners {
+               if err := s.Listen(); err != nil {
+                       return nil, err
+               }
+       }
+       return s.httpServerL, nil
+}
+
+// TLSListener returns the https listener
+func (s *Server) TLSListener() (net.Listener, error) {
+       if !s.hasListeners {
+               if err := s.Listen(); err != nil {
+                       return nil, err
+               }
+       }
+       return s.httpsServerL, nil
+}
+
+func handleInterrupt(once *sync.Once, s *Server) {
+       once.Do(func() {
+               for range s.interrupt {
+                       if s.interrupted {
+                               s.Logf("Server already shutting down")
+                               continue
+                       }
+                       s.interrupted = true
+                       s.Logf("Shutting down... ")
+                       if err := s.Shutdown(); err != nil {
+                               s.Logf("HTTP server Shutdown: %v", err)
+                       }
+               }
+       })
+}
+
+func signalNotify(interrupt chan<- os.Signal) {
+       signal.Notify(interrupt, syscall.SIGINT, syscall.SIGTERM)
+}
diff --git a/a1-go/pkg/restful/restful.go b/a1-go/pkg/restful/restful.go
new file mode 100644 (file)
index 0000000..66b66fb
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+package restful
+
+import (
+       "fmt"
+       "log"
+       "os"
+
+       "github.com/go-openapi/loads"
+       "github.com/go-openapi/runtime/middleware"
+       "subh.com/a1-go/pkg/restapi"
+       "subh.com/a1-go/pkg/restapi/operations"
+       "subh.com/a1-go/pkg/restapi/operations/a1_mediator"
+       "subh.com/a1-go/pkg/resthooks"
+)
+
+func NewRestful() *Restful {
+       r := &Restful{
+               rh: resthooks.NewResthook(),
+       }
+       r.api = r.setupHandler()
+       return r
+}
+
+func (r *Restful) setupHandler() *operations.A1API {
+       swaggerSpec, err := loads.Embedded(restapi.SwaggerJSON, restapi.FlatSwaggerJSON)
+       if err != nil {
+               os.Exit(1)
+       }
+
+       api := operations.NewA1API(swaggerSpec)
+       api.A1MediatorA1ControllerGetAllPolicyTypesHandler = a1_mediator.A1ControllerGetAllPolicyTypesHandlerFunc(func(param a1_mediator.A1ControllerGetAllPolicyTypesParams) middleware.Responder {
+               fmt.Printf("\n---- handler for get all all policy type --- \n")
+               return a1_mediator.NewA1ControllerGetAllPolicyTypesOK().WithPayload(r.rh.GetAllPolicyType())
+       })
+       return api
+
+}
+
+func (r *Restful) Run() {
+
+       server := restapi.NewServer(r.api)
+       defer server.Shutdown()
+       server.Port = 8080
+       server.Host = "0.0.0.0"
+       if err := server.Serve(); err != nil {
+               log.Fatal(err.Error())
+       }
+}
diff --git a/a1-go/pkg/restful/types.go b/a1-go/pkg/restful/types.go
new file mode 100644 (file)
index 0000000..e15d182
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+package restful
+
+import (
+       "subh.com/a1-go/pkg/restapi/operations"
+       resthook "subh.com/a1-go/pkg/resthooks"
+)
+
+type Restful struct {
+       api *operations.A1API
+       rh  *resthook.Resthook
+}
diff --git a/a1-go/pkg/resthooks/resthooks.go b/a1-go/pkg/resthooks/resthooks.go
new file mode 100644 (file)
index 0000000..d4654b6
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+package resthooks
+
+import (
+       "fmt"
+       "strconv"
+       "strings"
+
+       "gerrit.o-ran-sc.org/r/ric-plt/sdlgo"
+       "subh.com/a1-go/pkg/models"
+)
+
+func NewResthook() *Resthook {
+       return createResthook(sdlgo.NewSyncStorage())
+}
+
+func createResthook(sdlInst iSdl) *Resthook {
+       return &Resthook{
+               db: sdlInst,
+       }
+}
+
+func (rh *Resthook) GetAllPolicyType() []models.PolicyTypeID {
+
+       var policyTypeIDs []models.PolicyTypeID
+
+       keys, err := rh.db.GetAll("A1m_ns")
+
+       if err != nil {
+               fmt.Printf("error in retrieving policy. err: %v", err)
+               return policyTypeIDs
+       }
+       fmt.Printf("keys : %+v", keys)
+
+       for _, key := range keys {
+               if strings.HasPrefix(strings.TrimLeft(key, " "), "a1.policy_type.") {
+                       pti := strings.Split(strings.Trim(key, " "), "a1.policy_type.")[1]
+                       ptii, _ := strconv.ParseInt(pti, 10, 64)
+                       policyTypeIDs = append(policyTypeIDs, models.PolicyTypeID(ptii))
+               }
+       }
+
+       fmt.Printf("return : %+v", policyTypeIDs)
+       return policyTypeIDs
+}
diff --git a/a1-go/pkg/resthooks/resthooks_test.go b/a1-go/pkg/resthooks/resthooks_test.go
new file mode 100644 (file)
index 0000000..db4a04c
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+package resthooks
+
+import (
+       "os"
+       "testing"
+
+       "github.com/stretchr/testify/assert"
+       "github.com/stretchr/testify/mock"
+)
+
+var rh *Resthook
+var sdlInst *SdlMock
+
+func TestMain(m *testing.M) {
+       sdlInst = new(SdlMock)
+       rh = createResthook(sdlInst)
+       code := m.Run()
+       os.Exit(code)
+}
+
+func TestGetAllPolicyType(t *testing.T) {
+       resp := rh.GetAllPolicyType()
+       assert.Equal(t, 2, len(resp))
+}
+
+type SdlMock struct {
+       mock.Mock
+}
+
+func (s *SdlMock) GetAll(ns string) ([]string, error) {
+       return []string{"a1.policy_instance.1006001.qos",
+               "a1.policy_type.1006001",
+               "a1.policy_type.20000",
+               "a1.policy_inst_metadata.1006001.qos",
+       }, nil
+}
diff --git a/a1-go/pkg/resthooks/types.go b/a1-go/pkg/resthooks/types.go
new file mode 100644 (file)
index 0000000..778cb17
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+==================================================================================
+  Copyright (c) 2021 Samsung
+
+   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.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+==================================================================================
+*/
+package resthooks
+
+type Resthook struct {
+       db iSdl
+}
+
+type iSdl interface {
+       GetAll(string) ([]string, error)
+}