Add models 58/2458/1 v0.0.25
authorMohamed Abukar <abukar.mohamed@nokia.com>
Mon, 10 Feb 2020 07:48:59 +0000 (09:48 +0200)
committerMohamed Abukar <abukar.mohamed@nokia.com>
Mon, 10 Feb 2020 07:49:06 +0000 (09:49 +0200)
Change-Id: I97198a7a556457ee5448c964be509d106e9441c8
Signed-off-by: Mohamed Abukar <abukar.mohamed@nokia.com>
48 files changed:
pkg/clientapi/common/common_client.go [new file with mode: 0644]
pkg/clientapi/common/unsubscribe_parameters.go [new file with mode: 0644]
pkg/clientapi/common/unsubscribe_responses.go [new file with mode: 0644]
pkg/clientapi/control/control_client.go [new file with mode: 0644]
pkg/clientapi/control/subscribe_control_parameters.go [new file with mode: 0644]
pkg/clientapi/control/subscribe_control_responses.go [new file with mode: 0644]
pkg/clientapi/policy/policy_client.go [new file with mode: 0644]
pkg/clientapi/policy/subscribe_policy_parameters.go [new file with mode: 0644]
pkg/clientapi/policy/subscribe_policy_responses.go [new file with mode: 0644]
pkg/clientapi/r_i_c_subscription_client.go [new file with mode: 0644]
pkg/clientapi/report/report_client.go [new file with mode: 0644]
pkg/clientapi/report/subscribe_report_parameters.go [new file with mode: 0644]
pkg/clientapi/report/subscribe_report_responses.go [new file with mode: 0644]
pkg/clientmodel/control_params.go [new file with mode: 0644]
pkg/clientmodel/event_trigger.go [new file with mode: 0644]
pkg/clientmodel/event_trigger_list.go [new file with mode: 0644]
pkg/clientmodel/policy_params.go [new file with mode: 0644]
pkg/clientmodel/report_params.go [new file with mode: 0644]
pkg/clientmodel/subscription_result.go [new file with mode: 0644]
pkg/clientmodel/subscription_type.go [new file with mode: 0644]
pkg/models/control_params.go [new file with mode: 0644]
pkg/models/event_trigger.go [new file with mode: 0644]
pkg/models/event_trigger_list.go [new file with mode: 0644]
pkg/models/policy_params.go [new file with mode: 0644]
pkg/models/report_params.go [new file with mode: 0644]
pkg/models/subscription_result.go [new file with mode: 0644]
pkg/models/subscription_type.go [new file with mode: 0644]
pkg/restapi/configure_xapp_framework.go [new file with mode: 0644]
pkg/restapi/doc.go [new file with mode: 0644]
pkg/restapi/embedded_spec.go [new file with mode: 0644]
pkg/restapi/operations/common/unsubscribe.go [new file with mode: 0644]
pkg/restapi/operations/common/unsubscribe_parameters.go [new file with mode: 0644]
pkg/restapi/operations/common/unsubscribe_responses.go [new file with mode: 0644]
pkg/restapi/operations/common/unsubscribe_urlbuilder.go [new file with mode: 0644]
pkg/restapi/operations/control/subscribe_control.go [new file with mode: 0644]
pkg/restapi/operations/control/subscribe_control_parameters.go [new file with mode: 0644]
pkg/restapi/operations/control/subscribe_control_responses.go [new file with mode: 0644]
pkg/restapi/operations/control/subscribe_control_urlbuilder.go [new file with mode: 0644]
pkg/restapi/operations/policy/subscribe_policy.go [new file with mode: 0644]
pkg/restapi/operations/policy/subscribe_policy_parameters.go [new file with mode: 0644]
pkg/restapi/operations/policy/subscribe_policy_responses.go [new file with mode: 0644]
pkg/restapi/operations/policy/subscribe_policy_urlbuilder.go [new file with mode: 0644]
pkg/restapi/operations/report/subscribe_report.go [new file with mode: 0644]
pkg/restapi/operations/report/subscribe_report_parameters.go [new file with mode: 0644]
pkg/restapi/operations/report/subscribe_report_responses.go [new file with mode: 0644]
pkg/restapi/operations/report/subscribe_report_urlbuilder.go [new file with mode: 0644]
pkg/restapi/operations/xapp_framework_api.go [new file with mode: 0644]
pkg/restapi/server.go [new file with mode: 0644]

diff --git a/pkg/clientapi/common/common_client.go b/pkg/clientapi/common/common_client.go
new file mode 100644 (file)
index 0000000..b88df18
--- /dev/null
@@ -0,0 +1,58 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package common
+
+// 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/runtime"
+
+       strfmt "github.com/go-openapi/strfmt"
+)
+
+// New creates a new common API client.
+func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
+       return &Client{transport: transport, formats: formats}
+}
+
+/*
+Client for common API
+*/
+type Client struct {
+       transport runtime.ClientTransport
+       formats   strfmt.Registry
+}
+
+/*
+Unsubscribe unsubscribes x2 a p events from subscription manager
+*/
+func (a *Client) Unsubscribe(params *UnsubscribeParams) (*UnsubscribeNoContent, error) {
+       // TODO: Validate the params before sending
+       if params == nil {
+               params = NewUnsubscribeParams()
+       }
+
+       result, err := a.transport.Submit(&runtime.ClientOperation{
+               ID:                 "Unsubscribe",
+               Method:             "DELETE",
+               PathPattern:        "/subscriptions/{subscriptionId}",
+               ProducesMediaTypes: []string{""},
+               ConsumesMediaTypes: []string{""},
+               Schemes:            []string{"http"},
+               Params:             params,
+               Reader:             &UnsubscribeReader{formats: a.formats},
+               Context:            params.Context,
+               Client:             params.HTTPClient,
+       })
+       if err != nil {
+               return nil, err
+       }
+       return result.(*UnsubscribeNoContent), nil
+
+}
+
+// SetTransport changes the transport on the client
+func (a *Client) SetTransport(transport runtime.ClientTransport) {
+       a.transport = transport
+}
diff --git a/pkg/clientapi/common/unsubscribe_parameters.go b/pkg/clientapi/common/unsubscribe_parameters.go
new file mode 100644 (file)
index 0000000..5563ca5
--- /dev/null
@@ -0,0 +1,137 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package common
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "context"
+       "net/http"
+       "time"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/runtime"
+       cr "github.com/go-openapi/runtime/client"
+       "github.com/go-openapi/swag"
+
+       strfmt "github.com/go-openapi/strfmt"
+)
+
+// NewUnsubscribeParams creates a new UnsubscribeParams object
+// with the default values initialized.
+func NewUnsubscribeParams() *UnsubscribeParams {
+       var ()
+       return &UnsubscribeParams{
+
+               timeout: cr.DefaultTimeout,
+       }
+}
+
+// NewUnsubscribeParamsWithTimeout creates a new UnsubscribeParams object
+// with the default values initialized, and the ability to set a timeout on a request
+func NewUnsubscribeParamsWithTimeout(timeout time.Duration) *UnsubscribeParams {
+       var ()
+       return &UnsubscribeParams{
+
+               timeout: timeout,
+       }
+}
+
+// NewUnsubscribeParamsWithContext creates a new UnsubscribeParams object
+// with the default values initialized, and the ability to set a context for a request
+func NewUnsubscribeParamsWithContext(ctx context.Context) *UnsubscribeParams {
+       var ()
+       return &UnsubscribeParams{
+
+               Context: ctx,
+       }
+}
+
+// NewUnsubscribeParamsWithHTTPClient creates a new UnsubscribeParams object
+// with the default values initialized, and the ability to set a custom HTTPClient for a request
+func NewUnsubscribeParamsWithHTTPClient(client *http.Client) *UnsubscribeParams {
+       var ()
+       return &UnsubscribeParams{
+               HTTPClient: client,
+       }
+}
+
+/*UnsubscribeParams contains all the parameters to send to the API endpoint
+for the unsubscribe operation typically these are written to a http.Request
+*/
+type UnsubscribeParams struct {
+
+       /*SubscriptionID
+         The subscriptionId to be unsubscribed
+
+       */
+       SubscriptionID int64
+
+       timeout    time.Duration
+       Context    context.Context
+       HTTPClient *http.Client
+}
+
+// WithTimeout adds the timeout to the unsubscribe params
+func (o *UnsubscribeParams) WithTimeout(timeout time.Duration) *UnsubscribeParams {
+       o.SetTimeout(timeout)
+       return o
+}
+
+// SetTimeout adds the timeout to the unsubscribe params
+func (o *UnsubscribeParams) SetTimeout(timeout time.Duration) {
+       o.timeout = timeout
+}
+
+// WithContext adds the context to the unsubscribe params
+func (o *UnsubscribeParams) WithContext(ctx context.Context) *UnsubscribeParams {
+       o.SetContext(ctx)
+       return o
+}
+
+// SetContext adds the context to the unsubscribe params
+func (o *UnsubscribeParams) SetContext(ctx context.Context) {
+       o.Context = ctx
+}
+
+// WithHTTPClient adds the HTTPClient to the unsubscribe params
+func (o *UnsubscribeParams) WithHTTPClient(client *http.Client) *UnsubscribeParams {
+       o.SetHTTPClient(client)
+       return o
+}
+
+// SetHTTPClient adds the HTTPClient to the unsubscribe params
+func (o *UnsubscribeParams) SetHTTPClient(client *http.Client) {
+       o.HTTPClient = client
+}
+
+// WithSubscriptionID adds the subscriptionID to the unsubscribe params
+func (o *UnsubscribeParams) WithSubscriptionID(subscriptionID int64) *UnsubscribeParams {
+       o.SetSubscriptionID(subscriptionID)
+       return o
+}
+
+// SetSubscriptionID adds the subscriptionId to the unsubscribe params
+func (o *UnsubscribeParams) SetSubscriptionID(subscriptionID int64) {
+       o.SubscriptionID = subscriptionID
+}
+
+// WriteToRequest writes these params to a swagger request
+func (o *UnsubscribeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
+
+       if err := r.SetTimeout(o.timeout); err != nil {
+               return err
+       }
+       var res []error
+
+       // path param subscriptionId
+       if err := r.SetPathParam("subscriptionId", swag.FormatInt64(o.SubscriptionID)); err != nil {
+               return err
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
diff --git a/pkg/clientapi/common/unsubscribe_responses.go b/pkg/clientapi/common/unsubscribe_responses.go
new file mode 100644 (file)
index 0000000..ed78aef
--- /dev/null
@@ -0,0 +1,112 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package common
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "fmt"
+
+       "github.com/go-openapi/runtime"
+
+       strfmt "github.com/go-openapi/strfmt"
+)
+
+// UnsubscribeReader is a Reader for the Unsubscribe structure.
+type UnsubscribeReader struct {
+       formats strfmt.Registry
+}
+
+// ReadResponse reads a server response into the received o.
+func (o *UnsubscribeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
+       switch response.Code() {
+
+       case 204:
+               result := NewUnsubscribeNoContent()
+               if err := result.readResponse(response, consumer, o.formats); err != nil {
+                       return nil, err
+               }
+               return result, nil
+
+       case 400:
+               result := NewUnsubscribeBadRequest()
+               if err := result.readResponse(response, consumer, o.formats); err != nil {
+                       return nil, err
+               }
+               return nil, result
+
+       case 500:
+               result := NewUnsubscribeInternalServerError()
+               if err := result.readResponse(response, consumer, o.formats); err != nil {
+                       return nil, err
+               }
+               return nil, result
+
+       default:
+               return nil, runtime.NewAPIError("unknown error", response, response.Code())
+       }
+}
+
+// NewUnsubscribeNoContent creates a UnsubscribeNoContent with default headers values
+func NewUnsubscribeNoContent() *UnsubscribeNoContent {
+       return &UnsubscribeNoContent{}
+}
+
+/*UnsubscribeNoContent handles this case with default header values.
+
+Operation done successfully
+*/
+type UnsubscribeNoContent struct {
+}
+
+func (o *UnsubscribeNoContent) Error() string {
+       return fmt.Sprintf("[DELETE /subscriptions/{subscriptionId}][%d] unsubscribeNoContent ", 204)
+}
+
+func (o *UnsubscribeNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
+
+       return nil
+}
+
+// NewUnsubscribeBadRequest creates a UnsubscribeBadRequest with default headers values
+func NewUnsubscribeBadRequest() *UnsubscribeBadRequest {
+       return &UnsubscribeBadRequest{}
+}
+
+/*UnsubscribeBadRequest handles this case with default header values.
+
+Invalid requestorId supplied
+*/
+type UnsubscribeBadRequest struct {
+}
+
+func (o *UnsubscribeBadRequest) Error() string {
+       return fmt.Sprintf("[DELETE /subscriptions/{subscriptionId}][%d] unsubscribeBadRequest ", 400)
+}
+
+func (o *UnsubscribeBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
+
+       return nil
+}
+
+// NewUnsubscribeInternalServerError creates a UnsubscribeInternalServerError with default headers values
+func NewUnsubscribeInternalServerError() *UnsubscribeInternalServerError {
+       return &UnsubscribeInternalServerError{}
+}
+
+/*UnsubscribeInternalServerError handles this case with default header values.
+
+Internal error
+*/
+type UnsubscribeInternalServerError struct {
+}
+
+func (o *UnsubscribeInternalServerError) Error() string {
+       return fmt.Sprintf("[DELETE /subscriptions/{subscriptionId}][%d] unsubscribeInternalServerError ", 500)
+}
+
+func (o *UnsubscribeInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
+
+       return nil
+}
diff --git a/pkg/clientapi/control/control_client.go b/pkg/clientapi/control/control_client.go
new file mode 100644 (file)
index 0000000..4c99b8c
--- /dev/null
@@ -0,0 +1,58 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package control
+
+// 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/runtime"
+
+       strfmt "github.com/go-openapi/strfmt"
+)
+
+// New creates a new control API client.
+func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
+       return &Client{transport: transport, formats: formats}
+}
+
+/*
+Client for control API
+*/
+type Client struct {
+       transport runtime.ClientTransport
+       formats   strfmt.Registry
+}
+
+/*
+SubscribeControl subscribes and send c o n t r o l message to r a n to initiate or resume call processing in r a n
+*/
+func (a *Client) SubscribeControl(params *SubscribeControlParams) (*SubscribeControlCreated, error) {
+       // TODO: Validate the params before sending
+       if params == nil {
+               params = NewSubscribeControlParams()
+       }
+
+       result, err := a.transport.Submit(&runtime.ClientOperation{
+               ID:                 "subscribeControl",
+               Method:             "POST",
+               PathPattern:        "/subscriptions/control",
+               ProducesMediaTypes: []string{"application/json"},
+               ConsumesMediaTypes: []string{"application/json"},
+               Schemes:            []string{"http"},
+               Params:             params,
+               Reader:             &SubscribeControlReader{formats: a.formats},
+               Context:            params.Context,
+               Client:             params.HTTPClient,
+       })
+       if err != nil {
+               return nil, err
+       }
+       return result.(*SubscribeControlCreated), nil
+
+}
+
+// SetTransport changes the transport on the client
+func (a *Client) SetTransport(transport runtime.ClientTransport) {
+       a.transport = transport
+}
diff --git a/pkg/clientapi/control/subscribe_control_parameters.go b/pkg/clientapi/control/subscribe_control_parameters.go
new file mode 100644 (file)
index 0000000..81a5355
--- /dev/null
@@ -0,0 +1,139 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package control
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "context"
+       "net/http"
+       "time"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/runtime"
+       cr "github.com/go-openapi/runtime/client"
+
+       strfmt "github.com/go-openapi/strfmt"
+
+       clientmodel "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientmodel"
+)
+
+// NewSubscribeControlParams creates a new SubscribeControlParams object
+// with the default values initialized.
+func NewSubscribeControlParams() *SubscribeControlParams {
+       var ()
+       return &SubscribeControlParams{
+
+               timeout: cr.DefaultTimeout,
+       }
+}
+
+// NewSubscribeControlParamsWithTimeout creates a new SubscribeControlParams object
+// with the default values initialized, and the ability to set a timeout on a request
+func NewSubscribeControlParamsWithTimeout(timeout time.Duration) *SubscribeControlParams {
+       var ()
+       return &SubscribeControlParams{
+
+               timeout: timeout,
+       }
+}
+
+// NewSubscribeControlParamsWithContext creates a new SubscribeControlParams object
+// with the default values initialized, and the ability to set a context for a request
+func NewSubscribeControlParamsWithContext(ctx context.Context) *SubscribeControlParams {
+       var ()
+       return &SubscribeControlParams{
+
+               Context: ctx,
+       }
+}
+
+// NewSubscribeControlParamsWithHTTPClient creates a new SubscribeControlParams object
+// with the default values initialized, and the ability to set a custom HTTPClient for a request
+func NewSubscribeControlParamsWithHTTPClient(client *http.Client) *SubscribeControlParams {
+       var ()
+       return &SubscribeControlParams{
+               HTTPClient: client,
+       }
+}
+
+/*SubscribeControlParams contains all the parameters to send to the API endpoint
+for the subscribe control operation typically these are written to a http.Request
+*/
+type SubscribeControlParams struct {
+
+       /*ControlParams
+         Subscription control parameters
+
+       */
+       ControlParams *clientmodel.ControlParams
+
+       timeout    time.Duration
+       Context    context.Context
+       HTTPClient *http.Client
+}
+
+// WithTimeout adds the timeout to the subscribe control params
+func (o *SubscribeControlParams) WithTimeout(timeout time.Duration) *SubscribeControlParams {
+       o.SetTimeout(timeout)
+       return o
+}
+
+// SetTimeout adds the timeout to the subscribe control params
+func (o *SubscribeControlParams) SetTimeout(timeout time.Duration) {
+       o.timeout = timeout
+}
+
+// WithContext adds the context to the subscribe control params
+func (o *SubscribeControlParams) WithContext(ctx context.Context) *SubscribeControlParams {
+       o.SetContext(ctx)
+       return o
+}
+
+// SetContext adds the context to the subscribe control params
+func (o *SubscribeControlParams) SetContext(ctx context.Context) {
+       o.Context = ctx
+}
+
+// WithHTTPClient adds the HTTPClient to the subscribe control params
+func (o *SubscribeControlParams) WithHTTPClient(client *http.Client) *SubscribeControlParams {
+       o.SetHTTPClient(client)
+       return o
+}
+
+// SetHTTPClient adds the HTTPClient to the subscribe control params
+func (o *SubscribeControlParams) SetHTTPClient(client *http.Client) {
+       o.HTTPClient = client
+}
+
+// WithControlParams adds the controlParams to the subscribe control params
+func (o *SubscribeControlParams) WithControlParams(controlParams *clientmodel.ControlParams) *SubscribeControlParams {
+       o.SetControlParams(controlParams)
+       return o
+}
+
+// SetControlParams adds the controlParams to the subscribe control params
+func (o *SubscribeControlParams) SetControlParams(controlParams *clientmodel.ControlParams) {
+       o.ControlParams = controlParams
+}
+
+// WriteToRequest writes these params to a swagger request
+func (o *SubscribeControlParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
+
+       if err := r.SetTimeout(o.timeout); err != nil {
+               return err
+       }
+       var res []error
+
+       if o.ControlParams != nil {
+               if err := r.SetBodyParam(o.ControlParams); err != nil {
+                       return err
+               }
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
diff --git a/pkg/clientapi/control/subscribe_control_responses.go b/pkg/clientapi/control/subscribe_control_responses.go
new file mode 100644 (file)
index 0000000..15d72e5
--- /dev/null
@@ -0,0 +1,121 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package control
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "fmt"
+       "io"
+
+       "github.com/go-openapi/runtime"
+
+       strfmt "github.com/go-openapi/strfmt"
+
+       clientmodel "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientmodel"
+)
+
+// SubscribeControlReader is a Reader for the SubscribeControl structure.
+type SubscribeControlReader struct {
+       formats strfmt.Registry
+}
+
+// ReadResponse reads a server response into the received o.
+func (o *SubscribeControlReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
+       switch response.Code() {
+
+       case 201:
+               result := NewSubscribeControlCreated()
+               if err := result.readResponse(response, consumer, o.formats); err != nil {
+                       return nil, err
+               }
+               return result, nil
+
+       case 400:
+               result := NewSubscribeControlBadRequest()
+               if err := result.readResponse(response, consumer, o.formats); err != nil {
+                       return nil, err
+               }
+               return nil, result
+
+       case 500:
+               result := NewSubscribeControlInternalServerError()
+               if err := result.readResponse(response, consumer, o.formats); err != nil {
+                       return nil, err
+               }
+               return nil, result
+
+       default:
+               return nil, runtime.NewAPIError("unknown error", response, response.Code())
+       }
+}
+
+// NewSubscribeControlCreated creates a SubscribeControlCreated with default headers values
+func NewSubscribeControlCreated() *SubscribeControlCreated {
+       return &SubscribeControlCreated{}
+}
+
+/*SubscribeControlCreated handles this case with default header values.
+
+Subscription successfully created
+*/
+type SubscribeControlCreated struct {
+       Payload clientmodel.SubscriptionResult
+}
+
+func (o *SubscribeControlCreated) Error() string {
+       return fmt.Sprintf("[POST /subscriptions/control][%d] subscribeControlCreated  %+v", 201, o.Payload)
+}
+
+func (o *SubscribeControlCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
+
+       // response payload
+       if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
+               return err
+       }
+
+       return nil
+}
+
+// NewSubscribeControlBadRequest creates a SubscribeControlBadRequest with default headers values
+func NewSubscribeControlBadRequest() *SubscribeControlBadRequest {
+       return &SubscribeControlBadRequest{}
+}
+
+/*SubscribeControlBadRequest handles this case with default header values.
+
+Invalid input
+*/
+type SubscribeControlBadRequest struct {
+}
+
+func (o *SubscribeControlBadRequest) Error() string {
+       return fmt.Sprintf("[POST /subscriptions/control][%d] subscribeControlBadRequest ", 400)
+}
+
+func (o *SubscribeControlBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
+
+       return nil
+}
+
+// NewSubscribeControlInternalServerError creates a SubscribeControlInternalServerError with default headers values
+func NewSubscribeControlInternalServerError() *SubscribeControlInternalServerError {
+       return &SubscribeControlInternalServerError{}
+}
+
+/*SubscribeControlInternalServerError handles this case with default header values.
+
+Internal error
+*/
+type SubscribeControlInternalServerError struct {
+}
+
+func (o *SubscribeControlInternalServerError) Error() string {
+       return fmt.Sprintf("[POST /subscriptions/control][%d] subscribeControlInternalServerError ", 500)
+}
+
+func (o *SubscribeControlInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
+
+       return nil
+}
diff --git a/pkg/clientapi/policy/policy_client.go b/pkg/clientapi/policy/policy_client.go
new file mode 100644 (file)
index 0000000..b8ca3bb
--- /dev/null
@@ -0,0 +1,58 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package policy
+
+// 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/runtime"
+
+       strfmt "github.com/go-openapi/strfmt"
+)
+
+// New creates a new policy API client.
+func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
+       return &Client{transport: transport, formats: formats}
+}
+
+/*
+Client for policy API
+*/
+type Client struct {
+       transport runtime.ClientTransport
+       formats   strfmt.Registry
+}
+
+/*
+SubscribePolicy subscribes and send p o l i c y message to r a n to execute a specific p o l i c y during call processing in r a n after each occurrence of a defined s u b s c r IP t i o n
+*/
+func (a *Client) SubscribePolicy(params *SubscribePolicyParams) (*SubscribePolicyCreated, error) {
+       // TODO: Validate the params before sending
+       if params == nil {
+               params = NewSubscribePolicyParams()
+       }
+
+       result, err := a.transport.Submit(&runtime.ClientOperation{
+               ID:                 "subscribePolicy",
+               Method:             "POST",
+               PathPattern:        "/subscriptions/policy",
+               ProducesMediaTypes: []string{"application/json"},
+               ConsumesMediaTypes: []string{"application/json"},
+               Schemes:            []string{"http"},
+               Params:             params,
+               Reader:             &SubscribePolicyReader{formats: a.formats},
+               Context:            params.Context,
+               Client:             params.HTTPClient,
+       })
+       if err != nil {
+               return nil, err
+       }
+       return result.(*SubscribePolicyCreated), nil
+
+}
+
+// SetTransport changes the transport on the client
+func (a *Client) SetTransport(transport runtime.ClientTransport) {
+       a.transport = transport
+}
diff --git a/pkg/clientapi/policy/subscribe_policy_parameters.go b/pkg/clientapi/policy/subscribe_policy_parameters.go
new file mode 100644 (file)
index 0000000..9d4cf92
--- /dev/null
@@ -0,0 +1,139 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package policy
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "context"
+       "net/http"
+       "time"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/runtime"
+       cr "github.com/go-openapi/runtime/client"
+
+       strfmt "github.com/go-openapi/strfmt"
+
+       clientmodel "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientmodel"
+)
+
+// NewSubscribePolicyParams creates a new SubscribePolicyParams object
+// with the default values initialized.
+func NewSubscribePolicyParams() *SubscribePolicyParams {
+       var ()
+       return &SubscribePolicyParams{
+
+               timeout: cr.DefaultTimeout,
+       }
+}
+
+// NewSubscribePolicyParamsWithTimeout creates a new SubscribePolicyParams object
+// with the default values initialized, and the ability to set a timeout on a request
+func NewSubscribePolicyParamsWithTimeout(timeout time.Duration) *SubscribePolicyParams {
+       var ()
+       return &SubscribePolicyParams{
+
+               timeout: timeout,
+       }
+}
+
+// NewSubscribePolicyParamsWithContext creates a new SubscribePolicyParams object
+// with the default values initialized, and the ability to set a context for a request
+func NewSubscribePolicyParamsWithContext(ctx context.Context) *SubscribePolicyParams {
+       var ()
+       return &SubscribePolicyParams{
+
+               Context: ctx,
+       }
+}
+
+// NewSubscribePolicyParamsWithHTTPClient creates a new SubscribePolicyParams object
+// with the default values initialized, and the ability to set a custom HTTPClient for a request
+func NewSubscribePolicyParamsWithHTTPClient(client *http.Client) *SubscribePolicyParams {
+       var ()
+       return &SubscribePolicyParams{
+               HTTPClient: client,
+       }
+}
+
+/*SubscribePolicyParams contains all the parameters to send to the API endpoint
+for the subscribe policy operation typically these are written to a http.Request
+*/
+type SubscribePolicyParams struct {
+
+       /*PolicyParams
+         Subscription policy parameters
+
+       */
+       PolicyParams *clientmodel.PolicyParams
+
+       timeout    time.Duration
+       Context    context.Context
+       HTTPClient *http.Client
+}
+
+// WithTimeout adds the timeout to the subscribe policy params
+func (o *SubscribePolicyParams) WithTimeout(timeout time.Duration) *SubscribePolicyParams {
+       o.SetTimeout(timeout)
+       return o
+}
+
+// SetTimeout adds the timeout to the subscribe policy params
+func (o *SubscribePolicyParams) SetTimeout(timeout time.Duration) {
+       o.timeout = timeout
+}
+
+// WithContext adds the context to the subscribe policy params
+func (o *SubscribePolicyParams) WithContext(ctx context.Context) *SubscribePolicyParams {
+       o.SetContext(ctx)
+       return o
+}
+
+// SetContext adds the context to the subscribe policy params
+func (o *SubscribePolicyParams) SetContext(ctx context.Context) {
+       o.Context = ctx
+}
+
+// WithHTTPClient adds the HTTPClient to the subscribe policy params
+func (o *SubscribePolicyParams) WithHTTPClient(client *http.Client) *SubscribePolicyParams {
+       o.SetHTTPClient(client)
+       return o
+}
+
+// SetHTTPClient adds the HTTPClient to the subscribe policy params
+func (o *SubscribePolicyParams) SetHTTPClient(client *http.Client) {
+       o.HTTPClient = client
+}
+
+// WithPolicyParams adds the policyParams to the subscribe policy params
+func (o *SubscribePolicyParams) WithPolicyParams(policyParams *clientmodel.PolicyParams) *SubscribePolicyParams {
+       o.SetPolicyParams(policyParams)
+       return o
+}
+
+// SetPolicyParams adds the policyParams to the subscribe policy params
+func (o *SubscribePolicyParams) SetPolicyParams(policyParams *clientmodel.PolicyParams) {
+       o.PolicyParams = policyParams
+}
+
+// WriteToRequest writes these params to a swagger request
+func (o *SubscribePolicyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
+
+       if err := r.SetTimeout(o.timeout); err != nil {
+               return err
+       }
+       var res []error
+
+       if o.PolicyParams != nil {
+               if err := r.SetBodyParam(o.PolicyParams); err != nil {
+                       return err
+               }
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
diff --git a/pkg/clientapi/policy/subscribe_policy_responses.go b/pkg/clientapi/policy/subscribe_policy_responses.go
new file mode 100644 (file)
index 0000000..e817e10
--- /dev/null
@@ -0,0 +1,121 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package policy
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "fmt"
+       "io"
+
+       "github.com/go-openapi/runtime"
+
+       strfmt "github.com/go-openapi/strfmt"
+
+       clientmodel "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientmodel"
+)
+
+// SubscribePolicyReader is a Reader for the SubscribePolicy structure.
+type SubscribePolicyReader struct {
+       formats strfmt.Registry
+}
+
+// ReadResponse reads a server response into the received o.
+func (o *SubscribePolicyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
+       switch response.Code() {
+
+       case 201:
+               result := NewSubscribePolicyCreated()
+               if err := result.readResponse(response, consumer, o.formats); err != nil {
+                       return nil, err
+               }
+               return result, nil
+
+       case 400:
+               result := NewSubscribePolicyBadRequest()
+               if err := result.readResponse(response, consumer, o.formats); err != nil {
+                       return nil, err
+               }
+               return nil, result
+
+       case 500:
+               result := NewSubscribePolicyInternalServerError()
+               if err := result.readResponse(response, consumer, o.formats); err != nil {
+                       return nil, err
+               }
+               return nil, result
+
+       default:
+               return nil, runtime.NewAPIError("unknown error", response, response.Code())
+       }
+}
+
+// NewSubscribePolicyCreated creates a SubscribePolicyCreated with default headers values
+func NewSubscribePolicyCreated() *SubscribePolicyCreated {
+       return &SubscribePolicyCreated{}
+}
+
+/*SubscribePolicyCreated handles this case with default header values.
+
+Subscription successfully created
+*/
+type SubscribePolicyCreated struct {
+       Payload clientmodel.SubscriptionResult
+}
+
+func (o *SubscribePolicyCreated) Error() string {
+       return fmt.Sprintf("[POST /subscriptions/policy][%d] subscribePolicyCreated  %+v", 201, o.Payload)
+}
+
+func (o *SubscribePolicyCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
+
+       // response payload
+       if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
+               return err
+       }
+
+       return nil
+}
+
+// NewSubscribePolicyBadRequest creates a SubscribePolicyBadRequest with default headers values
+func NewSubscribePolicyBadRequest() *SubscribePolicyBadRequest {
+       return &SubscribePolicyBadRequest{}
+}
+
+/*SubscribePolicyBadRequest handles this case with default header values.
+
+Invalid input
+*/
+type SubscribePolicyBadRequest struct {
+}
+
+func (o *SubscribePolicyBadRequest) Error() string {
+       return fmt.Sprintf("[POST /subscriptions/policy][%d] subscribePolicyBadRequest ", 400)
+}
+
+func (o *SubscribePolicyBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
+
+       return nil
+}
+
+// NewSubscribePolicyInternalServerError creates a SubscribePolicyInternalServerError with default headers values
+func NewSubscribePolicyInternalServerError() *SubscribePolicyInternalServerError {
+       return &SubscribePolicyInternalServerError{}
+}
+
+/*SubscribePolicyInternalServerError handles this case with default header values.
+
+Internal error
+*/
+type SubscribePolicyInternalServerError struct {
+}
+
+func (o *SubscribePolicyInternalServerError) Error() string {
+       return fmt.Sprintf("[POST /subscriptions/policy][%d] subscribePolicyInternalServerError ", 500)
+}
+
+func (o *SubscribePolicyInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
+
+       return nil
+}
diff --git a/pkg/clientapi/r_i_c_subscription_client.go b/pkg/clientapi/r_i_c_subscription_client.go
new file mode 100644 (file)
index 0000000..91c32aa
--- /dev/null
@@ -0,0 +1,138 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package clientapi
+
+// 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/runtime"
+       httptransport "github.com/go-openapi/runtime/client"
+
+       strfmt "github.com/go-openapi/strfmt"
+
+       "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/common"
+       "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/control"
+       "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/policy"
+       "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/report"
+)
+
+// Default r i c subscription HTTP client.
+var Default = NewHTTPClient(nil)
+
+const (
+       // DefaultHost is the default Host
+       // found in Meta (info) section of spec file
+       DefaultHost string = "hostname"
+       // DefaultBasePath is the default BasePath
+       // found in Meta (info) section of spec file
+       DefaultBasePath string = "/ric/v1"
+)
+
+// DefaultSchemes are the default schemes found in Meta (info) section of spec file
+var DefaultSchemes = []string{"http"}
+
+// NewHTTPClient creates a new r i c subscription HTTP client.
+func NewHTTPClient(formats strfmt.Registry) *RICSubscription {
+       return NewHTTPClientWithConfig(formats, nil)
+}
+
+// NewHTTPClientWithConfig creates a new r i c subscription HTTP client,
+// using a customizable transport config.
+func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *RICSubscription {
+       // ensure nullable parameters have default
+       if cfg == nil {
+               cfg = DefaultTransportConfig()
+       }
+
+       // create transport and client
+       transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes)
+       return New(transport, formats)
+}
+
+// New creates a new r i c subscription client
+func New(transport runtime.ClientTransport, formats strfmt.Registry) *RICSubscription {
+       // ensure nullable parameters have default
+       if formats == nil {
+               formats = strfmt.Default
+       }
+
+       cli := new(RICSubscription)
+       cli.Transport = transport
+
+       cli.Common = common.New(transport, formats)
+
+       cli.Control = control.New(transport, formats)
+
+       cli.Policy = policy.New(transport, formats)
+
+       cli.Report = report.New(transport, formats)
+
+       return cli
+}
+
+// DefaultTransportConfig creates a TransportConfig with the
+// default settings taken from the meta section of the spec file.
+func DefaultTransportConfig() *TransportConfig {
+       return &TransportConfig{
+               Host:     DefaultHost,
+               BasePath: DefaultBasePath,
+               Schemes:  DefaultSchemes,
+       }
+}
+
+// TransportConfig contains the transport related info,
+// found in the meta section of the spec file.
+type TransportConfig struct {
+       Host     string
+       BasePath string
+       Schemes  []string
+}
+
+// WithHost overrides the default host,
+// provided by the meta section of the spec file.
+func (cfg *TransportConfig) WithHost(host string) *TransportConfig {
+       cfg.Host = host
+       return cfg
+}
+
+// WithBasePath overrides the default basePath,
+// provided by the meta section of the spec file.
+func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig {
+       cfg.BasePath = basePath
+       return cfg
+}
+
+// WithSchemes overrides the default schemes,
+// provided by the meta section of the spec file.
+func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
+       cfg.Schemes = schemes
+       return cfg
+}
+
+// RICSubscription is a client for r i c subscription
+type RICSubscription struct {
+       Common *common.Client
+
+       Control *control.Client
+
+       Policy *policy.Client
+
+       Report *report.Client
+
+       Transport runtime.ClientTransport
+}
+
+// SetTransport changes the transport on the client and all its subresources
+func (c *RICSubscription) SetTransport(transport runtime.ClientTransport) {
+       c.Transport = transport
+
+       c.Common.SetTransport(transport)
+
+       c.Control.SetTransport(transport)
+
+       c.Policy.SetTransport(transport)
+
+       c.Report.SetTransport(transport)
+
+}
diff --git a/pkg/clientapi/report/report_client.go b/pkg/clientapi/report/report_client.go
new file mode 100644 (file)
index 0000000..ac70452
--- /dev/null
@@ -0,0 +1,58 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package report
+
+// 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/runtime"
+
+       strfmt "github.com/go-openapi/strfmt"
+)
+
+// New creates a new report API client.
+func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
+       return &Client{transport: transport, formats: formats}
+}
+
+/*
+Client for report API
+*/
+type Client struct {
+       transport runtime.ClientTransport
+       formats   strfmt.Registry
+}
+
+/*
+SubscribeReport subscribes a list of x2 a p event triggers to receive r e p o r t messages sent by r a n
+*/
+func (a *Client) SubscribeReport(params *SubscribeReportParams) (*SubscribeReportCreated, error) {
+       // TODO: Validate the params before sending
+       if params == nil {
+               params = NewSubscribeReportParams()
+       }
+
+       result, err := a.transport.Submit(&runtime.ClientOperation{
+               ID:                 "subscribeReport",
+               Method:             "POST",
+               PathPattern:        "/subscriptions/report",
+               ProducesMediaTypes: []string{"application/json"},
+               ConsumesMediaTypes: []string{"application/json"},
+               Schemes:            []string{"http"},
+               Params:             params,
+               Reader:             &SubscribeReportReader{formats: a.formats},
+               Context:            params.Context,
+               Client:             params.HTTPClient,
+       })
+       if err != nil {
+               return nil, err
+       }
+       return result.(*SubscribeReportCreated), nil
+
+}
+
+// SetTransport changes the transport on the client
+func (a *Client) SetTransport(transport runtime.ClientTransport) {
+       a.transport = transport
+}
diff --git a/pkg/clientapi/report/subscribe_report_parameters.go b/pkg/clientapi/report/subscribe_report_parameters.go
new file mode 100644 (file)
index 0000000..dad7e45
--- /dev/null
@@ -0,0 +1,139 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package report
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "context"
+       "net/http"
+       "time"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/runtime"
+       cr "github.com/go-openapi/runtime/client"
+
+       strfmt "github.com/go-openapi/strfmt"
+
+       clientmodel "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientmodel"
+)
+
+// NewSubscribeReportParams creates a new SubscribeReportParams object
+// with the default values initialized.
+func NewSubscribeReportParams() *SubscribeReportParams {
+       var ()
+       return &SubscribeReportParams{
+
+               timeout: cr.DefaultTimeout,
+       }
+}
+
+// NewSubscribeReportParamsWithTimeout creates a new SubscribeReportParams object
+// with the default values initialized, and the ability to set a timeout on a request
+func NewSubscribeReportParamsWithTimeout(timeout time.Duration) *SubscribeReportParams {
+       var ()
+       return &SubscribeReportParams{
+
+               timeout: timeout,
+       }
+}
+
+// NewSubscribeReportParamsWithContext creates a new SubscribeReportParams object
+// with the default values initialized, and the ability to set a context for a request
+func NewSubscribeReportParamsWithContext(ctx context.Context) *SubscribeReportParams {
+       var ()
+       return &SubscribeReportParams{
+
+               Context: ctx,
+       }
+}
+
+// NewSubscribeReportParamsWithHTTPClient creates a new SubscribeReportParams object
+// with the default values initialized, and the ability to set a custom HTTPClient for a request
+func NewSubscribeReportParamsWithHTTPClient(client *http.Client) *SubscribeReportParams {
+       var ()
+       return &SubscribeReportParams{
+               HTTPClient: client,
+       }
+}
+
+/*SubscribeReportParams contains all the parameters to send to the API endpoint
+for the subscribe report operation typically these are written to a http.Request
+*/
+type SubscribeReportParams struct {
+
+       /*ReportParams
+         Subscription report parameters
+
+       */
+       ReportParams *clientmodel.ReportParams
+
+       timeout    time.Duration
+       Context    context.Context
+       HTTPClient *http.Client
+}
+
+// WithTimeout adds the timeout to the subscribe report params
+func (o *SubscribeReportParams) WithTimeout(timeout time.Duration) *SubscribeReportParams {
+       o.SetTimeout(timeout)
+       return o
+}
+
+// SetTimeout adds the timeout to the subscribe report params
+func (o *SubscribeReportParams) SetTimeout(timeout time.Duration) {
+       o.timeout = timeout
+}
+
+// WithContext adds the context to the subscribe report params
+func (o *SubscribeReportParams) WithContext(ctx context.Context) *SubscribeReportParams {
+       o.SetContext(ctx)
+       return o
+}
+
+// SetContext adds the context to the subscribe report params
+func (o *SubscribeReportParams) SetContext(ctx context.Context) {
+       o.Context = ctx
+}
+
+// WithHTTPClient adds the HTTPClient to the subscribe report params
+func (o *SubscribeReportParams) WithHTTPClient(client *http.Client) *SubscribeReportParams {
+       o.SetHTTPClient(client)
+       return o
+}
+
+// SetHTTPClient adds the HTTPClient to the subscribe report params
+func (o *SubscribeReportParams) SetHTTPClient(client *http.Client) {
+       o.HTTPClient = client
+}
+
+// WithReportParams adds the reportParams to the subscribe report params
+func (o *SubscribeReportParams) WithReportParams(reportParams *clientmodel.ReportParams) *SubscribeReportParams {
+       o.SetReportParams(reportParams)
+       return o
+}
+
+// SetReportParams adds the reportParams to the subscribe report params
+func (o *SubscribeReportParams) SetReportParams(reportParams *clientmodel.ReportParams) {
+       o.ReportParams = reportParams
+}
+
+// WriteToRequest writes these params to a swagger request
+func (o *SubscribeReportParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
+
+       if err := r.SetTimeout(o.timeout); err != nil {
+               return err
+       }
+       var res []error
+
+       if o.ReportParams != nil {
+               if err := r.SetBodyParam(o.ReportParams); err != nil {
+                       return err
+               }
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
diff --git a/pkg/clientapi/report/subscribe_report_responses.go b/pkg/clientapi/report/subscribe_report_responses.go
new file mode 100644 (file)
index 0000000..2b842f3
--- /dev/null
@@ -0,0 +1,121 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package report
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "fmt"
+       "io"
+
+       "github.com/go-openapi/runtime"
+
+       strfmt "github.com/go-openapi/strfmt"
+
+       clientmodel "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientmodel"
+)
+
+// SubscribeReportReader is a Reader for the SubscribeReport structure.
+type SubscribeReportReader struct {
+       formats strfmt.Registry
+}
+
+// ReadResponse reads a server response into the received o.
+func (o *SubscribeReportReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
+       switch response.Code() {
+
+       case 201:
+               result := NewSubscribeReportCreated()
+               if err := result.readResponse(response, consumer, o.formats); err != nil {
+                       return nil, err
+               }
+               return result, nil
+
+       case 400:
+               result := NewSubscribeReportBadRequest()
+               if err := result.readResponse(response, consumer, o.formats); err != nil {
+                       return nil, err
+               }
+               return nil, result
+
+       case 500:
+               result := NewSubscribeReportInternalServerError()
+               if err := result.readResponse(response, consumer, o.formats); err != nil {
+                       return nil, err
+               }
+               return nil, result
+
+       default:
+               return nil, runtime.NewAPIError("unknown error", response, response.Code())
+       }
+}
+
+// NewSubscribeReportCreated creates a SubscribeReportCreated with default headers values
+func NewSubscribeReportCreated() *SubscribeReportCreated {
+       return &SubscribeReportCreated{}
+}
+
+/*SubscribeReportCreated handles this case with default header values.
+
+Subscription successfully created
+*/
+type SubscribeReportCreated struct {
+       Payload clientmodel.SubscriptionResult
+}
+
+func (o *SubscribeReportCreated) Error() string {
+       return fmt.Sprintf("[POST /subscriptions/report][%d] subscribeReportCreated  %+v", 201, o.Payload)
+}
+
+func (o *SubscribeReportCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
+
+       // response payload
+       if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
+               return err
+       }
+
+       return nil
+}
+
+// NewSubscribeReportBadRequest creates a SubscribeReportBadRequest with default headers values
+func NewSubscribeReportBadRequest() *SubscribeReportBadRequest {
+       return &SubscribeReportBadRequest{}
+}
+
+/*SubscribeReportBadRequest handles this case with default header values.
+
+Invalid input
+*/
+type SubscribeReportBadRequest struct {
+}
+
+func (o *SubscribeReportBadRequest) Error() string {
+       return fmt.Sprintf("[POST /subscriptions/report][%d] subscribeReportBadRequest ", 400)
+}
+
+func (o *SubscribeReportBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
+
+       return nil
+}
+
+// NewSubscribeReportInternalServerError creates a SubscribeReportInternalServerError with default headers values
+func NewSubscribeReportInternalServerError() *SubscribeReportInternalServerError {
+       return &SubscribeReportInternalServerError{}
+}
+
+/*SubscribeReportInternalServerError handles this case with default header values.
+
+Internal error
+*/
+type SubscribeReportInternalServerError struct {
+}
+
+func (o *SubscribeReportInternalServerError) Error() string {
+       return fmt.Sprintf("[POST /subscriptions/report][%d] subscribeReportInternalServerError ", 500)
+}
+
+func (o *SubscribeReportInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
+
+       return nil
+}
diff --git a/pkg/clientmodel/control_params.go b/pkg/clientmodel/control_params.go
new file mode 100644 (file)
index 0000000..73d9034
--- /dev/null
@@ -0,0 +1,46 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package clientmodel
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       strfmt "github.com/go-openapi/strfmt"
+
+       "github.com/go-openapi/swag"
+)
+
+// ControlParams control params
+// swagger:model ControlParams
+type ControlParams struct {
+
+       // requestor Id
+       RequestorID int64 `json:"RequestorId,omitempty"`
+
+       // t b d
+       TBD string `json:"TBD,omitempty"`
+}
+
+// Validate validates this control params
+func (m *ControlParams) Validate(formats strfmt.Registry) error {
+       return nil
+}
+
+// MarshalBinary interface implementation
+func (m *ControlParams) MarshalBinary() ([]byte, error) {
+       if m == nil {
+               return nil, nil
+       }
+       return swag.WriteJSON(m)
+}
+
+// UnmarshalBinary interface implementation
+func (m *ControlParams) UnmarshalBinary(b []byte) error {
+       var res ControlParams
+       if err := swag.ReadJSON(b, &res); err != nil {
+               return err
+       }
+       *m = res
+       return nil
+}
diff --git a/pkg/clientmodel/event_trigger.go b/pkg/clientmodel/event_trigger.go
new file mode 100644 (file)
index 0000000..e0a3206
--- /dev/null
@@ -0,0 +1,104 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package clientmodel
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       strfmt "github.com/go-openapi/strfmt"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/swag"
+       "github.com/go-openapi/validate"
+)
+
+// EventTrigger event trigger
+// swagger:model EventTrigger
+type EventTrigger struct {
+
+       // e n b Id
+       ENBID int64 `json:"ENBId,omitempty"`
+
+       // interface direction
+       // Required: true
+       InterfaceDirection *int64 `json:"InterfaceDirection"`
+
+       // plmn Id
+       PlmnID string `json:"PlmnId,omitempty"`
+
+       // procedure code
+       // Required: true
+       ProcedureCode *int64 `json:"ProcedureCode"`
+
+       // type of message
+       // Required: true
+       TypeOfMessage *int64 `json:"TypeOfMessage"`
+}
+
+// Validate validates this event trigger
+func (m *EventTrigger) Validate(formats strfmt.Registry) error {
+       var res []error
+
+       if err := m.validateInterfaceDirection(formats); err != nil {
+               res = append(res, err)
+       }
+
+       if err := m.validateProcedureCode(formats); err != nil {
+               res = append(res, err)
+       }
+
+       if err := m.validateTypeOfMessage(formats); err != nil {
+               res = append(res, err)
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
+
+func (m *EventTrigger) validateInterfaceDirection(formats strfmt.Registry) error {
+
+       if err := validate.Required("InterfaceDirection", "body", m.InterfaceDirection); err != nil {
+               return err
+       }
+
+       return nil
+}
+
+func (m *EventTrigger) validateProcedureCode(formats strfmt.Registry) error {
+
+       if err := validate.Required("ProcedureCode", "body", m.ProcedureCode); err != nil {
+               return err
+       }
+
+       return nil
+}
+
+func (m *EventTrigger) validateTypeOfMessage(formats strfmt.Registry) error {
+
+       if err := validate.Required("TypeOfMessage", "body", m.TypeOfMessage); err != nil {
+               return err
+       }
+
+       return nil
+}
+
+// MarshalBinary interface implementation
+func (m *EventTrigger) MarshalBinary() ([]byte, error) {
+       if m == nil {
+               return nil, nil
+       }
+       return swag.WriteJSON(m)
+}
+
+// UnmarshalBinary interface implementation
+func (m *EventTrigger) UnmarshalBinary(b []byte) error {
+       var res EventTrigger
+       if err := swag.ReadJSON(b, &res); err != nil {
+               return err
+       }
+       *m = res
+       return nil
+}
diff --git a/pkg/clientmodel/event_trigger_list.go b/pkg/clientmodel/event_trigger_list.go
new file mode 100644 (file)
index 0000000..f205322
--- /dev/null
@@ -0,0 +1,45 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package clientmodel
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       "strconv"
+
+       strfmt "github.com/go-openapi/strfmt"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/swag"
+)
+
+// EventTriggerList event trigger list
+// swagger:model EventTriggerList
+type EventTriggerList []*EventTrigger
+
+// Validate validates this event trigger list
+func (m EventTriggerList) Validate(formats strfmt.Registry) error {
+       var res []error
+
+       for i := 0; i < len(m); i++ {
+               if swag.IsZero(m[i]) { // not required
+                       continue
+               }
+
+               if m[i] != nil {
+                       if err := m[i].Validate(formats); err != nil {
+                               if ve, ok := err.(*errors.Validation); ok {
+                                       return ve.ValidateName(strconv.Itoa(i))
+                               }
+                               return err
+                       }
+               }
+
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
diff --git a/pkg/clientmodel/policy_params.go b/pkg/clientmodel/policy_params.go
new file mode 100644 (file)
index 0000000..138681a
--- /dev/null
@@ -0,0 +1,46 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package clientmodel
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       strfmt "github.com/go-openapi/strfmt"
+
+       "github.com/go-openapi/swag"
+)
+
+// PolicyParams policy params
+// swagger:model PolicyParams
+type PolicyParams struct {
+
+       // requestor Id
+       RequestorID int64 `json:"RequestorId,omitempty"`
+
+       // t b d
+       TBD string `json:"TBD,omitempty"`
+}
+
+// Validate validates this policy params
+func (m *PolicyParams) Validate(formats strfmt.Registry) error {
+       return nil
+}
+
+// MarshalBinary interface implementation
+func (m *PolicyParams) MarshalBinary() ([]byte, error) {
+       if m == nil {
+               return nil, nil
+       }
+       return swag.WriteJSON(m)
+}
+
+// UnmarshalBinary interface implementation
+func (m *PolicyParams) UnmarshalBinary(b []byte) error {
+       var res PolicyParams
+       if err := swag.ReadJSON(b, &res); err != nil {
+               return err
+       }
+       *m = res
+       return nil
+}
diff --git a/pkg/clientmodel/report_params.go b/pkg/clientmodel/report_params.go
new file mode 100644 (file)
index 0000000..1be3bb1
--- /dev/null
@@ -0,0 +1,88 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package clientmodel
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       strfmt "github.com/go-openapi/strfmt"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/swag"
+       "github.com/go-openapi/validate"
+)
+
+// ReportParams report params
+// swagger:model ReportParams
+type ReportParams struct {
+
+       // event triggers
+       // Required: true
+       EventTriggers EventTriggerList `json:"EventTriggers"`
+
+       // requestor Id
+       // Required: true
+       RequestorID *int64 `json:"RequestorId"`
+}
+
+// Validate validates this report params
+func (m *ReportParams) Validate(formats strfmt.Registry) error {
+       var res []error
+
+       if err := m.validateEventTriggers(formats); err != nil {
+               res = append(res, err)
+       }
+
+       if err := m.validateRequestorID(formats); err != nil {
+               res = append(res, err)
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
+
+func (m *ReportParams) validateEventTriggers(formats strfmt.Registry) error {
+
+       if err := validate.Required("EventTriggers", "body", m.EventTriggers); err != nil {
+               return err
+       }
+
+       if err := m.EventTriggers.Validate(formats); err != nil {
+               if ve, ok := err.(*errors.Validation); ok {
+                       return ve.ValidateName("EventTriggers")
+               }
+               return err
+       }
+
+       return nil
+}
+
+func (m *ReportParams) validateRequestorID(formats strfmt.Registry) error {
+
+       if err := validate.Required("RequestorId", "body", m.RequestorID); err != nil {
+               return err
+       }
+
+       return nil
+}
+
+// MarshalBinary interface implementation
+func (m *ReportParams) MarshalBinary() ([]byte, error) {
+       if m == nil {
+               return nil, nil
+       }
+       return swag.WriteJSON(m)
+}
+
+// UnmarshalBinary interface implementation
+func (m *ReportParams) UnmarshalBinary(b []byte) error {
+       var res ReportParams
+       if err := swag.ReadJSON(b, &res); err != nil {
+               return err
+       }
+       *m = res
+       return nil
+}
diff --git a/pkg/clientmodel/subscription_result.go b/pkg/clientmodel/subscription_result.go
new file mode 100644 (file)
index 0000000..dfeefa0
--- /dev/null
@@ -0,0 +1,19 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package clientmodel
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+       strfmt "github.com/go-openapi/strfmt"
+)
+
+// SubscriptionResult A list of unique IDs
+// swagger:model SubscriptionResult
+type SubscriptionResult []int64
+
+// Validate validates this subscription result
+func (m SubscriptionResult) Validate(formats strfmt.Registry) error {
+       return nil
+}
diff --git a/pkg/clientmodel/subscription_type.go b/pkg/clientmodel/subscription_type.go
new file mode 100644 (file)
index 0000000..6a2574c
--- /dev/null
@@ -0,0 +1,69 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package clientmodel
+
+// 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"
+
+       strfmt "github.com/go-openapi/strfmt"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/validate"
+)
+
+// SubscriptionType subscription type
+// swagger:model SubscriptionType
+type SubscriptionType string
+
+const (
+
+       // SubscriptionTypeControl captures enum value "control"
+       SubscriptionTypeControl SubscriptionType = "control"
+
+       // SubscriptionTypeInsert captures enum value "insert"
+       SubscriptionTypeInsert SubscriptionType = "insert"
+
+       // SubscriptionTypePolicy captures enum value "policy"
+       SubscriptionTypePolicy SubscriptionType = "policy"
+
+       // SubscriptionTypeReport captures enum value "report"
+       SubscriptionTypeReport SubscriptionType = "report"
+)
+
+// for schema
+var subscriptionTypeEnum []interface{}
+
+func init() {
+       var res []SubscriptionType
+       if err := json.Unmarshal([]byte(`["control","insert","policy","report"]`), &res); err != nil {
+               panic(err)
+       }
+       for _, v := range res {
+               subscriptionTypeEnum = append(subscriptionTypeEnum, v)
+       }
+}
+
+func (m SubscriptionType) validateSubscriptionTypeEnum(path, location string, value SubscriptionType) error {
+       if err := validate.Enum(path, location, value, subscriptionTypeEnum); err != nil {
+               return err
+       }
+       return nil
+}
+
+// Validate validates this subscription type
+func (m SubscriptionType) Validate(formats strfmt.Registry) error {
+       var res []error
+
+       // value enum
+       if err := m.validateSubscriptionTypeEnum("", "body", m); err != nil {
+               return err
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
diff --git a/pkg/models/control_params.go b/pkg/models/control_params.go
new file mode 100644 (file)
index 0000000..17ce7cf
--- /dev/null
@@ -0,0 +1,46 @@
+// 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 (
+       strfmt "github.com/go-openapi/strfmt"
+
+       "github.com/go-openapi/swag"
+)
+
+// ControlParams control params
+// swagger:model ControlParams
+type ControlParams struct {
+
+       // requestor Id
+       RequestorID int64 `json:"RequestorId,omitempty"`
+
+       // t b d
+       TBD string `json:"TBD,omitempty"`
+}
+
+// Validate validates this control params
+func (m *ControlParams) Validate(formats strfmt.Registry) error {
+       return nil
+}
+
+// MarshalBinary interface implementation
+func (m *ControlParams) MarshalBinary() ([]byte, error) {
+       if m == nil {
+               return nil, nil
+       }
+       return swag.WriteJSON(m)
+}
+
+// UnmarshalBinary interface implementation
+func (m *ControlParams) UnmarshalBinary(b []byte) error {
+       var res ControlParams
+       if err := swag.ReadJSON(b, &res); err != nil {
+               return err
+       }
+       *m = res
+       return nil
+}
diff --git a/pkg/models/event_trigger.go b/pkg/models/event_trigger.go
new file mode 100644 (file)
index 0000000..2567fc4
--- /dev/null
@@ -0,0 +1,104 @@
+// 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 (
+       strfmt "github.com/go-openapi/strfmt"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/swag"
+       "github.com/go-openapi/validate"
+)
+
+// EventTrigger event trigger
+// swagger:model EventTrigger
+type EventTrigger struct {
+
+       // e n b Id
+       ENBID int64 `json:"ENBId,omitempty"`
+
+       // interface direction
+       // Required: true
+       InterfaceDirection *int64 `json:"InterfaceDirection"`
+
+       // plmn Id
+       PlmnID string `json:"PlmnId,omitempty"`
+
+       // procedure code
+       // Required: true
+       ProcedureCode *int64 `json:"ProcedureCode"`
+
+       // type of message
+       // Required: true
+       TypeOfMessage *int64 `json:"TypeOfMessage"`
+}
+
+// Validate validates this event trigger
+func (m *EventTrigger) Validate(formats strfmt.Registry) error {
+       var res []error
+
+       if err := m.validateInterfaceDirection(formats); err != nil {
+               res = append(res, err)
+       }
+
+       if err := m.validateProcedureCode(formats); err != nil {
+               res = append(res, err)
+       }
+
+       if err := m.validateTypeOfMessage(formats); err != nil {
+               res = append(res, err)
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
+
+func (m *EventTrigger) validateInterfaceDirection(formats strfmt.Registry) error {
+
+       if err := validate.Required("InterfaceDirection", "body", m.InterfaceDirection); err != nil {
+               return err
+       }
+
+       return nil
+}
+
+func (m *EventTrigger) validateProcedureCode(formats strfmt.Registry) error {
+
+       if err := validate.Required("ProcedureCode", "body", m.ProcedureCode); err != nil {
+               return err
+       }
+
+       return nil
+}
+
+func (m *EventTrigger) validateTypeOfMessage(formats strfmt.Registry) error {
+
+       if err := validate.Required("TypeOfMessage", "body", m.TypeOfMessage); err != nil {
+               return err
+       }
+
+       return nil
+}
+
+// MarshalBinary interface implementation
+func (m *EventTrigger) MarshalBinary() ([]byte, error) {
+       if m == nil {
+               return nil, nil
+       }
+       return swag.WriteJSON(m)
+}
+
+// UnmarshalBinary interface implementation
+func (m *EventTrigger) UnmarshalBinary(b []byte) error {
+       var res EventTrigger
+       if err := swag.ReadJSON(b, &res); err != nil {
+               return err
+       }
+       *m = res
+       return nil
+}
diff --git a/pkg/models/event_trigger_list.go b/pkg/models/event_trigger_list.go
new file mode 100644 (file)
index 0000000..c3c3dbc
--- /dev/null
@@ -0,0 +1,45 @@
+// 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 (
+       "strconv"
+
+       strfmt "github.com/go-openapi/strfmt"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/swag"
+)
+
+// EventTriggerList event trigger list
+// swagger:model EventTriggerList
+type EventTriggerList []*EventTrigger
+
+// Validate validates this event trigger list
+func (m EventTriggerList) Validate(formats strfmt.Registry) error {
+       var res []error
+
+       for i := 0; i < len(m); i++ {
+               if swag.IsZero(m[i]) { // not required
+                       continue
+               }
+
+               if m[i] != nil {
+                       if err := m[i].Validate(formats); err != nil {
+                               if ve, ok := err.(*errors.Validation); ok {
+                                       return ve.ValidateName(strconv.Itoa(i))
+                               }
+                               return err
+                       }
+               }
+
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
diff --git a/pkg/models/policy_params.go b/pkg/models/policy_params.go
new file mode 100644 (file)
index 0000000..c8c7627
--- /dev/null
@@ -0,0 +1,46 @@
+// 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 (
+       strfmt "github.com/go-openapi/strfmt"
+
+       "github.com/go-openapi/swag"
+)
+
+// PolicyParams policy params
+// swagger:model PolicyParams
+type PolicyParams struct {
+
+       // requestor Id
+       RequestorID int64 `json:"RequestorId,omitempty"`
+
+       // t b d
+       TBD string `json:"TBD,omitempty"`
+}
+
+// Validate validates this policy params
+func (m *PolicyParams) Validate(formats strfmt.Registry) error {
+       return nil
+}
+
+// MarshalBinary interface implementation
+func (m *PolicyParams) MarshalBinary() ([]byte, error) {
+       if m == nil {
+               return nil, nil
+       }
+       return swag.WriteJSON(m)
+}
+
+// UnmarshalBinary interface implementation
+func (m *PolicyParams) UnmarshalBinary(b []byte) error {
+       var res PolicyParams
+       if err := swag.ReadJSON(b, &res); err != nil {
+               return err
+       }
+       *m = res
+       return nil
+}
diff --git a/pkg/models/report_params.go b/pkg/models/report_params.go
new file mode 100644 (file)
index 0000000..c4c12d3
--- /dev/null
@@ -0,0 +1,88 @@
+// 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 (
+       strfmt "github.com/go-openapi/strfmt"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/swag"
+       "github.com/go-openapi/validate"
+)
+
+// ReportParams report params
+// swagger:model ReportParams
+type ReportParams struct {
+
+       // event triggers
+       // Required: true
+       EventTriggers EventTriggerList `json:"EventTriggers"`
+
+       // requestor Id
+       // Required: true
+       RequestorID *int64 `json:"RequestorId"`
+}
+
+// Validate validates this report params
+func (m *ReportParams) Validate(formats strfmt.Registry) error {
+       var res []error
+
+       if err := m.validateEventTriggers(formats); err != nil {
+               res = append(res, err)
+       }
+
+       if err := m.validateRequestorID(formats); err != nil {
+               res = append(res, err)
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
+
+func (m *ReportParams) validateEventTriggers(formats strfmt.Registry) error {
+
+       if err := validate.Required("EventTriggers", "body", m.EventTriggers); err != nil {
+               return err
+       }
+
+       if err := m.EventTriggers.Validate(formats); err != nil {
+               if ve, ok := err.(*errors.Validation); ok {
+                       return ve.ValidateName("EventTriggers")
+               }
+               return err
+       }
+
+       return nil
+}
+
+func (m *ReportParams) validateRequestorID(formats strfmt.Registry) error {
+
+       if err := validate.Required("RequestorId", "body", m.RequestorID); err != nil {
+               return err
+       }
+
+       return nil
+}
+
+// MarshalBinary interface implementation
+func (m *ReportParams) MarshalBinary() ([]byte, error) {
+       if m == nil {
+               return nil, nil
+       }
+       return swag.WriteJSON(m)
+}
+
+// UnmarshalBinary interface implementation
+func (m *ReportParams) UnmarshalBinary(b []byte) error {
+       var res ReportParams
+       if err := swag.ReadJSON(b, &res); err != nil {
+               return err
+       }
+       *m = res
+       return nil
+}
diff --git a/pkg/models/subscription_result.go b/pkg/models/subscription_result.go
new file mode 100644 (file)
index 0000000..d92eff6
--- /dev/null
@@ -0,0 +1,19 @@
+// 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 (
+       strfmt "github.com/go-openapi/strfmt"
+)
+
+// SubscriptionResult A list of unique IDs
+// swagger:model SubscriptionResult
+type SubscriptionResult []int64
+
+// Validate validates this subscription result
+func (m SubscriptionResult) Validate(formats strfmt.Registry) error {
+       return nil
+}
diff --git a/pkg/models/subscription_type.go b/pkg/models/subscription_type.go
new file mode 100644 (file)
index 0000000..8c6b7cf
--- /dev/null
@@ -0,0 +1,69 @@
+// 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 (
+       "encoding/json"
+
+       strfmt "github.com/go-openapi/strfmt"
+
+       "github.com/go-openapi/errors"
+       "github.com/go-openapi/validate"
+)
+
+// SubscriptionType subscription type
+// swagger:model SubscriptionType
+type SubscriptionType string
+
+const (
+
+       // SubscriptionTypeControl captures enum value "control"
+       SubscriptionTypeControl SubscriptionType = "control"
+
+       // SubscriptionTypeInsert captures enum value "insert"
+       SubscriptionTypeInsert SubscriptionType = "insert"
+
+       // SubscriptionTypePolicy captures enum value "policy"
+       SubscriptionTypePolicy SubscriptionType = "policy"
+
+       // SubscriptionTypeReport captures enum value "report"
+       SubscriptionTypeReport SubscriptionType = "report"
+)
+
+// for schema
+var subscriptionTypeEnum []interface{}
+
+func init() {
+       var res []SubscriptionType
+       if err := json.Unmarshal([]byte(`["control","insert","policy","report"]`), &res); err != nil {
+               panic(err)
+       }
+       for _, v := range res {
+               subscriptionTypeEnum = append(subscriptionTypeEnum, v)
+       }
+}
+
+func (m SubscriptionType) validateSubscriptionTypeEnum(path, location string, value SubscriptionType) error {
+       if err := validate.Enum(path, location, value, subscriptionTypeEnum); err != nil {
+               return err
+       }
+       return nil
+}
+
+// Validate validates this subscription type
+func (m SubscriptionType) Validate(formats strfmt.Registry) error {
+       var res []error
+
+       // value enum
+       if err := m.validateSubscriptionTypeEnum("", "body", m); err != nil {
+               return err
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
diff --git a/pkg/restapi/configure_xapp_framework.go b/pkg/restapi/configure_xapp_framework.go
new file mode 100644 (file)
index 0000000..d497418
--- /dev/null
@@ -0,0 +1,88 @@
+// This file is safe to edit. Once it exists it will not be overwritten
+
+package restapi
+
+import (
+       "crypto/tls"
+       "net/http"
+
+       errors "github.com/go-openapi/errors"
+       runtime "github.com/go-openapi/runtime"
+       middleware "github.com/go-openapi/runtime/middleware"
+
+       "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations"
+       "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/common"
+       "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/control"
+       "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/policy"
+       "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/report"
+)
+
+//go:generate swagger generate server --target ../../pkg --name XappFramework --spec ../../api/xapp_rest_api.yaml --exclude-main
+
+func configureFlags(api *operations.XappFrameworkAPI) {
+       // api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }
+}
+
+func configureAPI(api *operations.XappFrameworkAPI) 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.CommonUnsubscribeHandler == nil {
+               api.CommonUnsubscribeHandler = common.UnsubscribeHandlerFunc(func(params common.UnsubscribeParams) middleware.Responder {
+                       return middleware.NotImplemented("operation common.Unsubscribe has not yet been implemented")
+               })
+       }
+       if api.ControlSubscribeControlHandler == nil {
+               api.ControlSubscribeControlHandler = control.SubscribeControlHandlerFunc(func(params control.SubscribeControlParams) middleware.Responder {
+                       return middleware.NotImplemented("operation control.SubscribeControl has not yet been implemented")
+               })
+       }
+       if api.PolicySubscribePolicyHandler == nil {
+               api.PolicySubscribePolicyHandler = policy.SubscribePolicyHandlerFunc(func(params policy.SubscribePolicyParams) middleware.Responder {
+                       return middleware.NotImplemented("operation policy.SubscribePolicy has not yet been implemented")
+               })
+       }
+       if api.ReportSubscribeReportHandler == nil {
+               api.ReportSubscribeReportHandler = report.SubscribeReportHandlerFunc(func(params report.SubscribeReportParams) middleware.Responder {
+                       return middleware.NotImplemented("operation report.SubscribeReport has not yet been implemented")
+               })
+       }
+
+       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/pkg/restapi/doc.go b/pkg/restapi/doc.go
new file mode 100644 (file)
index 0000000..8cc5aad
--- /dev/null
@@ -0,0 +1,23 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+/*
+Package restapi RIC subscription
+This is the initial REST API for RIC subscription
+
+
+    Schemes:
+      http
+    Host: hostname
+    BasePath: /ric/v1
+    Version: 0.0.1
+    License: Apache 2.0 http://www.apache.org/licenses/LICENSE-2.0.html
+
+    Consumes:
+    - application/json
+
+    Produces:
+    - application/json
+
+swagger:meta
+*/
+package restapi
diff --git a/pkg/restapi/embedded_spec.go b/pkg/restapi/embedded_spec.go
new file mode 100644 (file)
index 0000000..4498b5b
--- /dev/null
@@ -0,0 +1,522 @@
+// 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(`{
+  "schemes": [
+    "http"
+  ],
+  "swagger": "2.0",
+  "info": {
+    "description": "This is the initial REST API for RIC subscription",
+    "title": "RIC subscription",
+    "license": {
+      "name": "Apache 2.0",
+      "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
+    },
+    "version": "0.0.1"
+  },
+  "host": "hostname",
+  "basePath": "/ric/v1",
+  "paths": {
+    "/subscriptions/control": {
+      "post": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "control"
+        ],
+        "summary": "Subscribe and send \"CONTROL\" message to RAN to initiate or resume call processing in RAN",
+        "operationId": "subscribeControl",
+        "parameters": [
+          {
+            "description": "Subscription control parameters",
+            "name": "ControlParams",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/ControlParams"
+            }
+          }
+        ],
+        "responses": {
+          "201": {
+            "description": "Subscription successfully created",
+            "schema": {
+              "$ref": "#/definitions/SubscriptionResult"
+            }
+          },
+          "400": {
+            "description": "Invalid input"
+          },
+          "500": {
+            "description": "Internal error"
+          }
+        }
+      }
+    },
+    "/subscriptions/policy": {
+      "post": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "policy"
+        ],
+        "summary": "Subscribe and send \"POLICY\" message to RAN to execute a specific POLICY during call processing in RAN after each occurrence of a defined SUBSCRIPTION",
+        "operationId": "subscribePolicy",
+        "parameters": [
+          {
+            "description": "Subscription policy parameters",
+            "name": "PolicyParams",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/PolicyParams"
+            }
+          }
+        ],
+        "responses": {
+          "201": {
+            "description": "Subscription successfully created",
+            "schema": {
+              "$ref": "#/definitions/SubscriptionResult"
+            }
+          },
+          "400": {
+            "description": "Invalid input"
+          },
+          "500": {
+            "description": "Internal error"
+          }
+        }
+      }
+    },
+    "/subscriptions/report": {
+      "post": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "report"
+        ],
+        "summary": "Subscribe a list of X2AP event triggers to receive \"REPORT\" messages sent by RAN",
+        "operationId": "subscribeReport",
+        "parameters": [
+          {
+            "description": "Subscription report parameters",
+            "name": "ReportParams",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/ReportParams"
+            }
+          }
+        ],
+        "responses": {
+          "201": {
+            "description": "Subscription successfully created",
+            "schema": {
+              "$ref": "#/definitions/SubscriptionResult"
+            }
+          },
+          "400": {
+            "description": "Invalid input"
+          },
+          "500": {
+            "description": "Internal error"
+          }
+        }
+      }
+    },
+    "/subscriptions/{subscriptionId}": {
+      "delete": {
+        "tags": [
+          "common"
+        ],
+        "summary": "Unsubscribe X2AP events from Subscription Manager",
+        "operationId": "Unsubscribe",
+        "parameters": [
+          {
+            "type": "integer",
+            "description": "The subscriptionId to be unsubscribed",
+            "name": "subscriptionId",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "description": "Operation done successfully"
+          },
+          "400": {
+            "description": "Invalid requestorId supplied"
+          },
+          "500": {
+            "description": "Internal error"
+          }
+        }
+      }
+    }
+  },
+  "definitions": {
+    "ControlParams": {
+      "type": "object",
+      "properties": {
+        "RequestorId": {
+          "type": "integer"
+        },
+        "TBD": {
+          "type": "string"
+        }
+      }
+    },
+    "EventTrigger": {
+      "type": "object",
+      "required": [
+        "InterfaceDirection",
+        "ProcedureCode",
+        "TypeOfMessage"
+      ],
+      "properties": {
+        "ENBId": {
+          "type": "integer"
+        },
+        "InterfaceDirection": {
+          "type": "integer"
+        },
+        "PlmnId": {
+          "type": "string"
+        },
+        "ProcedureCode": {
+          "type": "integer"
+        },
+        "TypeOfMessage": {
+          "type": "integer"
+        }
+      }
+    },
+    "EventTriggerList": {
+      "type": "array",
+      "items": {
+        "$ref": "#/definitions/EventTrigger"
+      }
+    },
+    "PolicyParams": {
+      "type": "object",
+      "properties": {
+        "RequestorId": {
+          "type": "integer"
+        },
+        "TBD": {
+          "type": "string"
+        }
+      }
+    },
+    "ReportParams": {
+      "type": "object",
+      "required": [
+        "RequestorId",
+        "EventTriggers"
+      ],
+      "properties": {
+        "EventTriggers": {
+          "$ref": "#/definitions/EventTriggerList"
+        },
+        "RequestorId": {
+          "type": "integer"
+        }
+      }
+    },
+    "SubscriptionResult": {
+      "description": "A list of unique IDs",
+      "type": "array",
+      "items": {
+        "type": "integer"
+      }
+    },
+    "SubscriptionType": {
+      "type": "string",
+      "enum": [
+        "control",
+        "insert",
+        "policy",
+        "report"
+      ]
+    }
+  }
+}`))
+       FlatSwaggerJSON = json.RawMessage([]byte(`{
+  "schemes": [
+    "http"
+  ],
+  "swagger": "2.0",
+  "info": {
+    "description": "This is the initial REST API for RIC subscription",
+    "title": "RIC subscription",
+    "license": {
+      "name": "Apache 2.0",
+      "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
+    },
+    "version": "0.0.1"
+  },
+  "host": "hostname",
+  "basePath": "/ric/v1",
+  "paths": {
+    "/subscriptions/control": {
+      "post": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "control"
+        ],
+        "summary": "Subscribe and send \"CONTROL\" message to RAN to initiate or resume call processing in RAN",
+        "operationId": "subscribeControl",
+        "parameters": [
+          {
+            "description": "Subscription control parameters",
+            "name": "ControlParams",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/ControlParams"
+            }
+          }
+        ],
+        "responses": {
+          "201": {
+            "description": "Subscription successfully created",
+            "schema": {
+              "$ref": "#/definitions/SubscriptionResult"
+            }
+          },
+          "400": {
+            "description": "Invalid input"
+          },
+          "500": {
+            "description": "Internal error"
+          }
+        }
+      }
+    },
+    "/subscriptions/policy": {
+      "post": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "policy"
+        ],
+        "summary": "Subscribe and send \"POLICY\" message to RAN to execute a specific POLICY during call processing in RAN after each occurrence of a defined SUBSCRIPTION",
+        "operationId": "subscribePolicy",
+        "parameters": [
+          {
+            "description": "Subscription policy parameters",
+            "name": "PolicyParams",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/PolicyParams"
+            }
+          }
+        ],
+        "responses": {
+          "201": {
+            "description": "Subscription successfully created",
+            "schema": {
+              "$ref": "#/definitions/SubscriptionResult"
+            }
+          },
+          "400": {
+            "description": "Invalid input"
+          },
+          "500": {
+            "description": "Internal error"
+          }
+        }
+      }
+    },
+    "/subscriptions/report": {
+      "post": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "report"
+        ],
+        "summary": "Subscribe a list of X2AP event triggers to receive \"REPORT\" messages sent by RAN",
+        "operationId": "subscribeReport",
+        "parameters": [
+          {
+            "description": "Subscription report parameters",
+            "name": "ReportParams",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/ReportParams"
+            }
+          }
+        ],
+        "responses": {
+          "201": {
+            "description": "Subscription successfully created",
+            "schema": {
+              "$ref": "#/definitions/SubscriptionResult"
+            }
+          },
+          "400": {
+            "description": "Invalid input"
+          },
+          "500": {
+            "description": "Internal error"
+          }
+        }
+      }
+    },
+    "/subscriptions/{subscriptionId}": {
+      "delete": {
+        "tags": [
+          "common"
+        ],
+        "summary": "Unsubscribe X2AP events from Subscription Manager",
+        "operationId": "Unsubscribe",
+        "parameters": [
+          {
+            "type": "integer",
+            "description": "The subscriptionId to be unsubscribed",
+            "name": "subscriptionId",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "description": "Operation done successfully"
+          },
+          "400": {
+            "description": "Invalid requestorId supplied"
+          },
+          "500": {
+            "description": "Internal error"
+          }
+        }
+      }
+    }
+  },
+  "definitions": {
+    "ControlParams": {
+      "type": "object",
+      "properties": {
+        "RequestorId": {
+          "type": "integer"
+        },
+        "TBD": {
+          "type": "string"
+        }
+      }
+    },
+    "EventTrigger": {
+      "type": "object",
+      "required": [
+        "InterfaceDirection",
+        "ProcedureCode",
+        "TypeOfMessage"
+      ],
+      "properties": {
+        "ENBId": {
+          "type": "integer"
+        },
+        "InterfaceDirection": {
+          "type": "integer"
+        },
+        "PlmnId": {
+          "type": "string"
+        },
+        "ProcedureCode": {
+          "type": "integer"
+        },
+        "TypeOfMessage": {
+          "type": "integer"
+        }
+      }
+    },
+    "EventTriggerList": {
+      "type": "array",
+      "items": {
+        "$ref": "#/definitions/EventTrigger"
+      }
+    },
+    "PolicyParams": {
+      "type": "object",
+      "properties": {
+        "RequestorId": {
+          "type": "integer"
+        },
+        "TBD": {
+          "type": "string"
+        }
+      }
+    },
+    "ReportParams": {
+      "type": "object",
+      "required": [
+        "RequestorId",
+        "EventTriggers"
+      ],
+      "properties": {
+        "EventTriggers": {
+          "$ref": "#/definitions/EventTriggerList"
+        },
+        "RequestorId": {
+          "type": "integer"
+        }
+      }
+    },
+    "SubscriptionResult": {
+      "description": "A list of unique IDs",
+      "type": "array",
+      "items": {
+        "type": "integer"
+      }
+    },
+    "SubscriptionType": {
+      "type": "string",
+      "enum": [
+        "control",
+        "insert",
+        "policy",
+        "report"
+      ]
+    }
+  }
+}`))
+}
diff --git a/pkg/restapi/operations/common/unsubscribe.go b/pkg/restapi/operations/common/unsubscribe.go
new file mode 100644 (file)
index 0000000..84dac86
--- /dev/null
@@ -0,0 +1,58 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package common
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "net/http"
+
+       middleware "github.com/go-openapi/runtime/middleware"
+)
+
+// UnsubscribeHandlerFunc turns a function with the right signature into a unsubscribe handler
+type UnsubscribeHandlerFunc func(UnsubscribeParams) middleware.Responder
+
+// Handle executing the request and returning a response
+func (fn UnsubscribeHandlerFunc) Handle(params UnsubscribeParams) middleware.Responder {
+       return fn(params)
+}
+
+// UnsubscribeHandler interface for that can handle valid unsubscribe params
+type UnsubscribeHandler interface {
+       Handle(UnsubscribeParams) middleware.Responder
+}
+
+// NewUnsubscribe creates a new http.Handler for the unsubscribe operation
+func NewUnsubscribe(ctx *middleware.Context, handler UnsubscribeHandler) *Unsubscribe {
+       return &Unsubscribe{Context: ctx, Handler: handler}
+}
+
+/*Unsubscribe swagger:route DELETE /subscriptions/{subscriptionId} common unsubscribe
+
+Unsubscribe X2AP events from Subscription Manager
+
+*/
+type Unsubscribe struct {
+       Context *middleware.Context
+       Handler UnsubscribeHandler
+}
+
+func (o *Unsubscribe) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
+       route, rCtx, _ := o.Context.RouteInfo(r)
+       if rCtx != nil {
+               r = rCtx
+       }
+       var Params = NewUnsubscribeParams()
+
+       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/pkg/restapi/operations/common/unsubscribe_parameters.go b/pkg/restapi/operations/common/unsubscribe_parameters.go
new file mode 100644 (file)
index 0000000..465b0ee
--- /dev/null
@@ -0,0 +1,78 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package common
+
+// 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/swag"
+
+       strfmt "github.com/go-openapi/strfmt"
+)
+
+// NewUnsubscribeParams creates a new UnsubscribeParams object
+// no default values defined in spec.
+func NewUnsubscribeParams() UnsubscribeParams {
+
+       return UnsubscribeParams{}
+}
+
+// UnsubscribeParams contains all the bound params for the unsubscribe operation
+// typically these are obtained from a http.Request
+//
+// swagger:parameters Unsubscribe
+type UnsubscribeParams struct {
+
+       // HTTP Request Object
+       HTTPRequest *http.Request `json:"-"`
+
+       /*The subscriptionId to be unsubscribed
+         Required: true
+         In: path
+       */
+       SubscriptionID 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 NewUnsubscribeParams() beforehand.
+func (o *UnsubscribeParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
+       var res []error
+
+       o.HTTPRequest = r
+
+       rSubscriptionID, rhkSubscriptionID, _ := route.Params.GetOK("subscriptionId")
+       if err := o.bindSubscriptionID(rSubscriptionID, rhkSubscriptionID, route.Formats); err != nil {
+               res = append(res, err)
+       }
+
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
+
+// bindSubscriptionID binds and validates parameter SubscriptionID from path.
+func (o *UnsubscribeParams) bindSubscriptionID(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("subscriptionId", "path", "int64", raw)
+       }
+       o.SubscriptionID = value
+
+       return nil
+}
diff --git a/pkg/restapi/operations/common/unsubscribe_responses.go b/pkg/restapi/operations/common/unsubscribe_responses.go
new file mode 100644 (file)
index 0000000..ec8bd6b
--- /dev/null
@@ -0,0 +1,84 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package common
+
+// 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"
+)
+
+// UnsubscribeNoContentCode is the HTTP code returned for type UnsubscribeNoContent
+const UnsubscribeNoContentCode int = 204
+
+/*UnsubscribeNoContent Operation done successfully
+
+swagger:response unsubscribeNoContent
+*/
+type UnsubscribeNoContent struct {
+}
+
+// NewUnsubscribeNoContent creates UnsubscribeNoContent with default headers values
+func NewUnsubscribeNoContent() *UnsubscribeNoContent {
+
+       return &UnsubscribeNoContent{}
+}
+
+// WriteResponse to the client
+func (o *UnsubscribeNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(204)
+}
+
+// UnsubscribeBadRequestCode is the HTTP code returned for type UnsubscribeBadRequest
+const UnsubscribeBadRequestCode int = 400
+
+/*UnsubscribeBadRequest Invalid requestorId supplied
+
+swagger:response unsubscribeBadRequest
+*/
+type UnsubscribeBadRequest struct {
+}
+
+// NewUnsubscribeBadRequest creates UnsubscribeBadRequest with default headers values
+func NewUnsubscribeBadRequest() *UnsubscribeBadRequest {
+
+       return &UnsubscribeBadRequest{}
+}
+
+// WriteResponse to the client
+func (o *UnsubscribeBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(400)
+}
+
+// UnsubscribeInternalServerErrorCode is the HTTP code returned for type UnsubscribeInternalServerError
+const UnsubscribeInternalServerErrorCode int = 500
+
+/*UnsubscribeInternalServerError Internal error
+
+swagger:response unsubscribeInternalServerError
+*/
+type UnsubscribeInternalServerError struct {
+}
+
+// NewUnsubscribeInternalServerError creates UnsubscribeInternalServerError with default headers values
+func NewUnsubscribeInternalServerError() *UnsubscribeInternalServerError {
+
+       return &UnsubscribeInternalServerError{}
+}
+
+// WriteResponse to the client
+func (o *UnsubscribeInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(500)
+}
diff --git a/pkg/restapi/operations/common/unsubscribe_urlbuilder.go b/pkg/restapi/operations/common/unsubscribe_urlbuilder.go
new file mode 100644 (file)
index 0000000..3f1710e
--- /dev/null
@@ -0,0 +1,101 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package common
+
+// 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"
+)
+
+// UnsubscribeURL generates an URL for the unsubscribe operation
+type UnsubscribeURL struct {
+       SubscriptionID 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 *UnsubscribeURL) WithBasePath(bp string) *UnsubscribeURL {
+       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 *UnsubscribeURL) SetBasePath(bp string) {
+       o._basePath = bp
+}
+
+// Build a url path and query string
+func (o *UnsubscribeURL) Build() (*url.URL, error) {
+       var _result url.URL
+
+       var _path = "/subscriptions/{subscriptionId}"
+
+       subscriptionID := swag.FormatInt64(o.SubscriptionID)
+       if subscriptionID != "" {
+               _path = strings.Replace(_path, "{subscriptionId}", subscriptionID, -1)
+       } else {
+               return nil, errors.New("subscriptionId is required on UnsubscribeURL")
+       }
+
+       _basePath := o._basePath
+       if _basePath == "" {
+               _basePath = "/ric/v1"
+       }
+       _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 *UnsubscribeURL) 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 *UnsubscribeURL) String() string {
+       return o.Must(o.Build()).String()
+}
+
+// BuildFull builds a full url with scheme, host, path and query string
+func (o *UnsubscribeURL) BuildFull(scheme, host string) (*url.URL, error) {
+       if scheme == "" {
+               return nil, errors.New("scheme is required for a full url on UnsubscribeURL")
+       }
+       if host == "" {
+               return nil, errors.New("host is required for a full url on UnsubscribeURL")
+       }
+
+       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 *UnsubscribeURL) StringFull(scheme, host string) string {
+       return o.Must(o.BuildFull(scheme, host)).String()
+}
diff --git a/pkg/restapi/operations/control/subscribe_control.go b/pkg/restapi/operations/control/subscribe_control.go
new file mode 100644 (file)
index 0000000..d35dbf2
--- /dev/null
@@ -0,0 +1,58 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package control
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "net/http"
+
+       middleware "github.com/go-openapi/runtime/middleware"
+)
+
+// SubscribeControlHandlerFunc turns a function with the right signature into a subscribe control handler
+type SubscribeControlHandlerFunc func(SubscribeControlParams) middleware.Responder
+
+// Handle executing the request and returning a response
+func (fn SubscribeControlHandlerFunc) Handle(params SubscribeControlParams) middleware.Responder {
+       return fn(params)
+}
+
+// SubscribeControlHandler interface for that can handle valid subscribe control params
+type SubscribeControlHandler interface {
+       Handle(SubscribeControlParams) middleware.Responder
+}
+
+// NewSubscribeControl creates a new http.Handler for the subscribe control operation
+func NewSubscribeControl(ctx *middleware.Context, handler SubscribeControlHandler) *SubscribeControl {
+       return &SubscribeControl{Context: ctx, Handler: handler}
+}
+
+/*SubscribeControl swagger:route POST /subscriptions/control control subscribeControl
+
+Subscribe and send "CONTROL" message to RAN to initiate or resume call processing in RAN
+
+*/
+type SubscribeControl struct {
+       Context *middleware.Context
+       Handler SubscribeControlHandler
+}
+
+func (o *SubscribeControl) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
+       route, rCtx, _ := o.Context.RouteInfo(r)
+       if rCtx != nil {
+               r = rCtx
+       }
+       var Params = NewSubscribeControlParams()
+
+       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/pkg/restapi/operations/control/subscribe_control_parameters.go b/pkg/restapi/operations/control/subscribe_control_parameters.go
new file mode 100644 (file)
index 0000000..79ebb27
--- /dev/null
@@ -0,0 +1,69 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package control
+
+// 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"
+
+       models "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/models"
+)
+
+// NewSubscribeControlParams creates a new SubscribeControlParams object
+// no default values defined in spec.
+func NewSubscribeControlParams() SubscribeControlParams {
+
+       return SubscribeControlParams{}
+}
+
+// SubscribeControlParams contains all the bound params for the subscribe control operation
+// typically these are obtained from a http.Request
+//
+// swagger:parameters subscribeControl
+type SubscribeControlParams struct {
+
+       // HTTP Request Object
+       HTTPRequest *http.Request `json:"-"`
+
+       /*Subscription control parameters
+         In: body
+       */
+       ControlParams *models.ControlParams
+}
+
+// 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 NewSubscribeControlParams() beforehand.
+func (o *SubscribeControlParams) 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.ControlParams
+               if err := route.Consumer.Consume(r.Body, &body); err != nil {
+                       res = append(res, errors.NewParseError("controlParams", "body", "", err))
+               } else {
+                       // validate body object
+                       if err := body.Validate(route.Formats); err != nil {
+                               res = append(res, err)
+                       }
+
+                       if len(res) == 0 {
+                               o.ControlParams = &body
+                       }
+               }
+       }
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
diff --git a/pkg/restapi/operations/control/subscribe_control_responses.go b/pkg/restapi/operations/control/subscribe_control_responses.go
new file mode 100644 (file)
index 0000000..7a56f7f
--- /dev/null
@@ -0,0 +1,109 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package control
+
+// 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"
+
+       models "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/models"
+)
+
+// SubscribeControlCreatedCode is the HTTP code returned for type SubscribeControlCreated
+const SubscribeControlCreatedCode int = 201
+
+/*SubscribeControlCreated Subscription successfully created
+
+swagger:response subscribeControlCreated
+*/
+type SubscribeControlCreated struct {
+
+       /*
+         In: Body
+       */
+       Payload models.SubscriptionResult `json:"body,omitempty"`
+}
+
+// NewSubscribeControlCreated creates SubscribeControlCreated with default headers values
+func NewSubscribeControlCreated() *SubscribeControlCreated {
+
+       return &SubscribeControlCreated{}
+}
+
+// WithPayload adds the payload to the subscribe control created response
+func (o *SubscribeControlCreated) WithPayload(payload models.SubscriptionResult) *SubscribeControlCreated {
+       o.Payload = payload
+       return o
+}
+
+// SetPayload sets the payload to the subscribe control created response
+func (o *SubscribeControlCreated) SetPayload(payload models.SubscriptionResult) {
+       o.Payload = payload
+}
+
+// WriteResponse to the client
+func (o *SubscribeControlCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.WriteHeader(201)
+       payload := o.Payload
+       if payload == nil {
+               // return empty array
+               payload = models.SubscriptionResult{}
+       }
+
+       if err := producer.Produce(rw, payload); err != nil {
+               panic(err) // let the recovery middleware deal with this
+       }
+}
+
+// SubscribeControlBadRequestCode is the HTTP code returned for type SubscribeControlBadRequest
+const SubscribeControlBadRequestCode int = 400
+
+/*SubscribeControlBadRequest Invalid input
+
+swagger:response subscribeControlBadRequest
+*/
+type SubscribeControlBadRequest struct {
+}
+
+// NewSubscribeControlBadRequest creates SubscribeControlBadRequest with default headers values
+func NewSubscribeControlBadRequest() *SubscribeControlBadRequest {
+
+       return &SubscribeControlBadRequest{}
+}
+
+// WriteResponse to the client
+func (o *SubscribeControlBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(400)
+}
+
+// SubscribeControlInternalServerErrorCode is the HTTP code returned for type SubscribeControlInternalServerError
+const SubscribeControlInternalServerErrorCode int = 500
+
+/*SubscribeControlInternalServerError Internal error
+
+swagger:response subscribeControlInternalServerError
+*/
+type SubscribeControlInternalServerError struct {
+}
+
+// NewSubscribeControlInternalServerError creates SubscribeControlInternalServerError with default headers values
+func NewSubscribeControlInternalServerError() *SubscribeControlInternalServerError {
+
+       return &SubscribeControlInternalServerError{}
+}
+
+// WriteResponse to the client
+func (o *SubscribeControlInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(500)
+}
diff --git a/pkg/restapi/operations/control/subscribe_control_urlbuilder.go b/pkg/restapi/operations/control/subscribe_control_urlbuilder.go
new file mode 100644 (file)
index 0000000..556a9f3
--- /dev/null
@@ -0,0 +1,87 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package control
+
+// 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"
+)
+
+// SubscribeControlURL generates an URL for the subscribe control operation
+type SubscribeControlURL 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 *SubscribeControlURL) WithBasePath(bp string) *SubscribeControlURL {
+       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 *SubscribeControlURL) SetBasePath(bp string) {
+       o._basePath = bp
+}
+
+// Build a url path and query string
+func (o *SubscribeControlURL) Build() (*url.URL, error) {
+       var _result url.URL
+
+       var _path = "/subscriptions/control"
+
+       _basePath := o._basePath
+       if _basePath == "" {
+               _basePath = "/ric/v1"
+       }
+       _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 *SubscribeControlURL) 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 *SubscribeControlURL) String() string {
+       return o.Must(o.Build()).String()
+}
+
+// BuildFull builds a full url with scheme, host, path and query string
+func (o *SubscribeControlURL) BuildFull(scheme, host string) (*url.URL, error) {
+       if scheme == "" {
+               return nil, errors.New("scheme is required for a full url on SubscribeControlURL")
+       }
+       if host == "" {
+               return nil, errors.New("host is required for a full url on SubscribeControlURL")
+       }
+
+       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 *SubscribeControlURL) StringFull(scheme, host string) string {
+       return o.Must(o.BuildFull(scheme, host)).String()
+}
diff --git a/pkg/restapi/operations/policy/subscribe_policy.go b/pkg/restapi/operations/policy/subscribe_policy.go
new file mode 100644 (file)
index 0000000..f812cec
--- /dev/null
@@ -0,0 +1,58 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package policy
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "net/http"
+
+       middleware "github.com/go-openapi/runtime/middleware"
+)
+
+// SubscribePolicyHandlerFunc turns a function with the right signature into a subscribe policy handler
+type SubscribePolicyHandlerFunc func(SubscribePolicyParams) middleware.Responder
+
+// Handle executing the request and returning a response
+func (fn SubscribePolicyHandlerFunc) Handle(params SubscribePolicyParams) middleware.Responder {
+       return fn(params)
+}
+
+// SubscribePolicyHandler interface for that can handle valid subscribe policy params
+type SubscribePolicyHandler interface {
+       Handle(SubscribePolicyParams) middleware.Responder
+}
+
+// NewSubscribePolicy creates a new http.Handler for the subscribe policy operation
+func NewSubscribePolicy(ctx *middleware.Context, handler SubscribePolicyHandler) *SubscribePolicy {
+       return &SubscribePolicy{Context: ctx, Handler: handler}
+}
+
+/*SubscribePolicy swagger:route POST /subscriptions/policy policy subscribePolicy
+
+Subscribe and send "POLICY" message to RAN to execute a specific POLICY during call processing in RAN after each occurrence of a defined SUBSCRIPTION
+
+*/
+type SubscribePolicy struct {
+       Context *middleware.Context
+       Handler SubscribePolicyHandler
+}
+
+func (o *SubscribePolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
+       route, rCtx, _ := o.Context.RouteInfo(r)
+       if rCtx != nil {
+               r = rCtx
+       }
+       var Params = NewSubscribePolicyParams()
+
+       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/pkg/restapi/operations/policy/subscribe_policy_parameters.go b/pkg/restapi/operations/policy/subscribe_policy_parameters.go
new file mode 100644 (file)
index 0000000..ca6cb28
--- /dev/null
@@ -0,0 +1,69 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package policy
+
+// 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"
+
+       models "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/models"
+)
+
+// NewSubscribePolicyParams creates a new SubscribePolicyParams object
+// no default values defined in spec.
+func NewSubscribePolicyParams() SubscribePolicyParams {
+
+       return SubscribePolicyParams{}
+}
+
+// SubscribePolicyParams contains all the bound params for the subscribe policy operation
+// typically these are obtained from a http.Request
+//
+// swagger:parameters subscribePolicy
+type SubscribePolicyParams struct {
+
+       // HTTP Request Object
+       HTTPRequest *http.Request `json:"-"`
+
+       /*Subscription policy parameters
+         In: body
+       */
+       PolicyParams *models.PolicyParams
+}
+
+// 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 NewSubscribePolicyParams() beforehand.
+func (o *SubscribePolicyParams) 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.PolicyParams
+               if err := route.Consumer.Consume(r.Body, &body); err != nil {
+                       res = append(res, errors.NewParseError("policyParams", "body", "", err))
+               } else {
+                       // validate body object
+                       if err := body.Validate(route.Formats); err != nil {
+                               res = append(res, err)
+                       }
+
+                       if len(res) == 0 {
+                               o.PolicyParams = &body
+                       }
+               }
+       }
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
diff --git a/pkg/restapi/operations/policy/subscribe_policy_responses.go b/pkg/restapi/operations/policy/subscribe_policy_responses.go
new file mode 100644 (file)
index 0000000..485674c
--- /dev/null
@@ -0,0 +1,109 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package policy
+
+// 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"
+
+       models "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/models"
+)
+
+// SubscribePolicyCreatedCode is the HTTP code returned for type SubscribePolicyCreated
+const SubscribePolicyCreatedCode int = 201
+
+/*SubscribePolicyCreated Subscription successfully created
+
+swagger:response subscribePolicyCreated
+*/
+type SubscribePolicyCreated struct {
+
+       /*
+         In: Body
+       */
+       Payload models.SubscriptionResult `json:"body,omitempty"`
+}
+
+// NewSubscribePolicyCreated creates SubscribePolicyCreated with default headers values
+func NewSubscribePolicyCreated() *SubscribePolicyCreated {
+
+       return &SubscribePolicyCreated{}
+}
+
+// WithPayload adds the payload to the subscribe policy created response
+func (o *SubscribePolicyCreated) WithPayload(payload models.SubscriptionResult) *SubscribePolicyCreated {
+       o.Payload = payload
+       return o
+}
+
+// SetPayload sets the payload to the subscribe policy created response
+func (o *SubscribePolicyCreated) SetPayload(payload models.SubscriptionResult) {
+       o.Payload = payload
+}
+
+// WriteResponse to the client
+func (o *SubscribePolicyCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.WriteHeader(201)
+       payload := o.Payload
+       if payload == nil {
+               // return empty array
+               payload = models.SubscriptionResult{}
+       }
+
+       if err := producer.Produce(rw, payload); err != nil {
+               panic(err) // let the recovery middleware deal with this
+       }
+}
+
+// SubscribePolicyBadRequestCode is the HTTP code returned for type SubscribePolicyBadRequest
+const SubscribePolicyBadRequestCode int = 400
+
+/*SubscribePolicyBadRequest Invalid input
+
+swagger:response subscribePolicyBadRequest
+*/
+type SubscribePolicyBadRequest struct {
+}
+
+// NewSubscribePolicyBadRequest creates SubscribePolicyBadRequest with default headers values
+func NewSubscribePolicyBadRequest() *SubscribePolicyBadRequest {
+
+       return &SubscribePolicyBadRequest{}
+}
+
+// WriteResponse to the client
+func (o *SubscribePolicyBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(400)
+}
+
+// SubscribePolicyInternalServerErrorCode is the HTTP code returned for type SubscribePolicyInternalServerError
+const SubscribePolicyInternalServerErrorCode int = 500
+
+/*SubscribePolicyInternalServerError Internal error
+
+swagger:response subscribePolicyInternalServerError
+*/
+type SubscribePolicyInternalServerError struct {
+}
+
+// NewSubscribePolicyInternalServerError creates SubscribePolicyInternalServerError with default headers values
+func NewSubscribePolicyInternalServerError() *SubscribePolicyInternalServerError {
+
+       return &SubscribePolicyInternalServerError{}
+}
+
+// WriteResponse to the client
+func (o *SubscribePolicyInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(500)
+}
diff --git a/pkg/restapi/operations/policy/subscribe_policy_urlbuilder.go b/pkg/restapi/operations/policy/subscribe_policy_urlbuilder.go
new file mode 100644 (file)
index 0000000..2274f40
--- /dev/null
@@ -0,0 +1,87 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package policy
+
+// 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"
+)
+
+// SubscribePolicyURL generates an URL for the subscribe policy operation
+type SubscribePolicyURL 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 *SubscribePolicyURL) WithBasePath(bp string) *SubscribePolicyURL {
+       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 *SubscribePolicyURL) SetBasePath(bp string) {
+       o._basePath = bp
+}
+
+// Build a url path and query string
+func (o *SubscribePolicyURL) Build() (*url.URL, error) {
+       var _result url.URL
+
+       var _path = "/subscriptions/policy"
+
+       _basePath := o._basePath
+       if _basePath == "" {
+               _basePath = "/ric/v1"
+       }
+       _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 *SubscribePolicyURL) 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 *SubscribePolicyURL) String() string {
+       return o.Must(o.Build()).String()
+}
+
+// BuildFull builds a full url with scheme, host, path and query string
+func (o *SubscribePolicyURL) BuildFull(scheme, host string) (*url.URL, error) {
+       if scheme == "" {
+               return nil, errors.New("scheme is required for a full url on SubscribePolicyURL")
+       }
+       if host == "" {
+               return nil, errors.New("host is required for a full url on SubscribePolicyURL")
+       }
+
+       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 *SubscribePolicyURL) StringFull(scheme, host string) string {
+       return o.Must(o.BuildFull(scheme, host)).String()
+}
diff --git a/pkg/restapi/operations/report/subscribe_report.go b/pkg/restapi/operations/report/subscribe_report.go
new file mode 100644 (file)
index 0000000..2ced7c7
--- /dev/null
@@ -0,0 +1,58 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package report
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+       "net/http"
+
+       middleware "github.com/go-openapi/runtime/middleware"
+)
+
+// SubscribeReportHandlerFunc turns a function with the right signature into a subscribe report handler
+type SubscribeReportHandlerFunc func(SubscribeReportParams) middleware.Responder
+
+// Handle executing the request and returning a response
+func (fn SubscribeReportHandlerFunc) Handle(params SubscribeReportParams) middleware.Responder {
+       return fn(params)
+}
+
+// SubscribeReportHandler interface for that can handle valid subscribe report params
+type SubscribeReportHandler interface {
+       Handle(SubscribeReportParams) middleware.Responder
+}
+
+// NewSubscribeReport creates a new http.Handler for the subscribe report operation
+func NewSubscribeReport(ctx *middleware.Context, handler SubscribeReportHandler) *SubscribeReport {
+       return &SubscribeReport{Context: ctx, Handler: handler}
+}
+
+/*SubscribeReport swagger:route POST /subscriptions/report report subscribeReport
+
+Subscribe a list of X2AP event triggers to receive "REPORT" messages sent by RAN
+
+*/
+type SubscribeReport struct {
+       Context *middleware.Context
+       Handler SubscribeReportHandler
+}
+
+func (o *SubscribeReport) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
+       route, rCtx, _ := o.Context.RouteInfo(r)
+       if rCtx != nil {
+               r = rCtx
+       }
+       var Params = NewSubscribeReportParams()
+
+       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/pkg/restapi/operations/report/subscribe_report_parameters.go b/pkg/restapi/operations/report/subscribe_report_parameters.go
new file mode 100644 (file)
index 0000000..96adaaf
--- /dev/null
@@ -0,0 +1,69 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package report
+
+// 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"
+
+       models "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/models"
+)
+
+// NewSubscribeReportParams creates a new SubscribeReportParams object
+// no default values defined in spec.
+func NewSubscribeReportParams() SubscribeReportParams {
+
+       return SubscribeReportParams{}
+}
+
+// SubscribeReportParams contains all the bound params for the subscribe report operation
+// typically these are obtained from a http.Request
+//
+// swagger:parameters subscribeReport
+type SubscribeReportParams struct {
+
+       // HTTP Request Object
+       HTTPRequest *http.Request `json:"-"`
+
+       /*Subscription report parameters
+         In: body
+       */
+       ReportParams *models.ReportParams
+}
+
+// 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 NewSubscribeReportParams() beforehand.
+func (o *SubscribeReportParams) 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.ReportParams
+               if err := route.Consumer.Consume(r.Body, &body); err != nil {
+                       res = append(res, errors.NewParseError("reportParams", "body", "", err))
+               } else {
+                       // validate body object
+                       if err := body.Validate(route.Formats); err != nil {
+                               res = append(res, err)
+                       }
+
+                       if len(res) == 0 {
+                               o.ReportParams = &body
+                       }
+               }
+       }
+       if len(res) > 0 {
+               return errors.CompositeValidationError(res...)
+       }
+       return nil
+}
diff --git a/pkg/restapi/operations/report/subscribe_report_responses.go b/pkg/restapi/operations/report/subscribe_report_responses.go
new file mode 100644 (file)
index 0000000..d175d73
--- /dev/null
@@ -0,0 +1,109 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package report
+
+// 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"
+
+       models "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/models"
+)
+
+// SubscribeReportCreatedCode is the HTTP code returned for type SubscribeReportCreated
+const SubscribeReportCreatedCode int = 201
+
+/*SubscribeReportCreated Subscription successfully created
+
+swagger:response subscribeReportCreated
+*/
+type SubscribeReportCreated struct {
+
+       /*
+         In: Body
+       */
+       Payload models.SubscriptionResult `json:"body,omitempty"`
+}
+
+// NewSubscribeReportCreated creates SubscribeReportCreated with default headers values
+func NewSubscribeReportCreated() *SubscribeReportCreated {
+
+       return &SubscribeReportCreated{}
+}
+
+// WithPayload adds the payload to the subscribe report created response
+func (o *SubscribeReportCreated) WithPayload(payload models.SubscriptionResult) *SubscribeReportCreated {
+       o.Payload = payload
+       return o
+}
+
+// SetPayload sets the payload to the subscribe report created response
+func (o *SubscribeReportCreated) SetPayload(payload models.SubscriptionResult) {
+       o.Payload = payload
+}
+
+// WriteResponse to the client
+func (o *SubscribeReportCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.WriteHeader(201)
+       payload := o.Payload
+       if payload == nil {
+               // return empty array
+               payload = models.SubscriptionResult{}
+       }
+
+       if err := producer.Produce(rw, payload); err != nil {
+               panic(err) // let the recovery middleware deal with this
+       }
+}
+
+// SubscribeReportBadRequestCode is the HTTP code returned for type SubscribeReportBadRequest
+const SubscribeReportBadRequestCode int = 400
+
+/*SubscribeReportBadRequest Invalid input
+
+swagger:response subscribeReportBadRequest
+*/
+type SubscribeReportBadRequest struct {
+}
+
+// NewSubscribeReportBadRequest creates SubscribeReportBadRequest with default headers values
+func NewSubscribeReportBadRequest() *SubscribeReportBadRequest {
+
+       return &SubscribeReportBadRequest{}
+}
+
+// WriteResponse to the client
+func (o *SubscribeReportBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(400)
+}
+
+// SubscribeReportInternalServerErrorCode is the HTTP code returned for type SubscribeReportInternalServerError
+const SubscribeReportInternalServerErrorCode int = 500
+
+/*SubscribeReportInternalServerError Internal error
+
+swagger:response subscribeReportInternalServerError
+*/
+type SubscribeReportInternalServerError struct {
+}
+
+// NewSubscribeReportInternalServerError creates SubscribeReportInternalServerError with default headers values
+func NewSubscribeReportInternalServerError() *SubscribeReportInternalServerError {
+
+       return &SubscribeReportInternalServerError{}
+}
+
+// WriteResponse to the client
+func (o *SubscribeReportInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+       rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
+
+       rw.WriteHeader(500)
+}
diff --git a/pkg/restapi/operations/report/subscribe_report_urlbuilder.go b/pkg/restapi/operations/report/subscribe_report_urlbuilder.go
new file mode 100644 (file)
index 0000000..dc713b6
--- /dev/null
@@ -0,0 +1,87 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package report
+
+// 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"
+)
+
+// SubscribeReportURL generates an URL for the subscribe report operation
+type SubscribeReportURL 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 *SubscribeReportURL) WithBasePath(bp string) *SubscribeReportURL {
+       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 *SubscribeReportURL) SetBasePath(bp string) {
+       o._basePath = bp
+}
+
+// Build a url path and query string
+func (o *SubscribeReportURL) Build() (*url.URL, error) {
+       var _result url.URL
+
+       var _path = "/subscriptions/report"
+
+       _basePath := o._basePath
+       if _basePath == "" {
+               _basePath = "/ric/v1"
+       }
+       _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 *SubscribeReportURL) 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 *SubscribeReportURL) String() string {
+       return o.Must(o.Build()).String()
+}
+
+// BuildFull builds a full url with scheme, host, path and query string
+func (o *SubscribeReportURL) BuildFull(scheme, host string) (*url.URL, error) {
+       if scheme == "" {
+               return nil, errors.New("scheme is required for a full url on SubscribeReportURL")
+       }
+       if host == "" {
+               return nil, errors.New("host is required for a full url on SubscribeReportURL")
+       }
+
+       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 *SubscribeReportURL) StringFull(scheme, host string) string {
+       return o.Must(o.BuildFull(scheme, host)).String()
+}
diff --git a/pkg/restapi/operations/xapp_framework_api.go b/pkg/restapi/operations/xapp_framework_api.go
new file mode 100644 (file)
index 0000000..28f71f2
--- /dev/null
@@ -0,0 +1,321 @@
+// 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"
+
+       errors "github.com/go-openapi/errors"
+       loads "github.com/go-openapi/loads"
+       runtime "github.com/go-openapi/runtime"
+       middleware "github.com/go-openapi/runtime/middleware"
+       security "github.com/go-openapi/runtime/security"
+       spec "github.com/go-openapi/spec"
+       strfmt "github.com/go-openapi/strfmt"
+       "github.com/go-openapi/swag"
+
+       "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/common"
+       "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/control"
+       "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/policy"
+       "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/report"
+)
+
+// NewXappFrameworkAPI creates a new XappFramework instance
+func NewXappFrameworkAPI(spec *loads.Document) *XappFrameworkAPI {
+       return &XappFrameworkAPI{
+               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),
+               ServerShutdown:      func() {},
+               spec:                spec,
+               ServeError:          errors.ServeError,
+               BasicAuthenticator:  security.BasicAuth,
+               APIKeyAuthenticator: security.APIKeyAuth,
+               BearerAuthenticator: security.BearerAuth,
+               JSONConsumer:        runtime.JSONConsumer(),
+               JSONProducer:        runtime.JSONProducer(),
+               CommonUnsubscribeHandler: common.UnsubscribeHandlerFunc(func(params common.UnsubscribeParams) middleware.Responder {
+                       return middleware.NotImplemented("operation CommonUnsubscribe has not yet been implemented")
+               }),
+               ControlSubscribeControlHandler: control.SubscribeControlHandlerFunc(func(params control.SubscribeControlParams) middleware.Responder {
+                       return middleware.NotImplemented("operation ControlSubscribeControl has not yet been implemented")
+               }),
+               PolicySubscribePolicyHandler: policy.SubscribePolicyHandlerFunc(func(params policy.SubscribePolicyParams) middleware.Responder {
+                       return middleware.NotImplemented("operation PolicySubscribePolicy has not yet been implemented")
+               }),
+               ReportSubscribeReportHandler: report.SubscribeReportHandlerFunc(func(params report.SubscribeReportParams) middleware.Responder {
+                       return middleware.NotImplemented("operation ReportSubscribeReport has not yet been implemented")
+               }),
+       }
+}
+
+/*XappFrameworkAPI This is the initial REST API for RIC subscription */
+type XappFrameworkAPI 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 a "application/json" mime type
+       JSONConsumer runtime.Consumer
+
+       // JSONProducer registers a producer for a "application/json" mime type
+       JSONProducer runtime.Producer
+
+       // CommonUnsubscribeHandler sets the operation handler for the unsubscribe operation
+       CommonUnsubscribeHandler common.UnsubscribeHandler
+       // ControlSubscribeControlHandler sets the operation handler for the subscribe control operation
+       ControlSubscribeControlHandler control.SubscribeControlHandler
+       // PolicySubscribePolicyHandler sets the operation handler for the subscribe policy operation
+       PolicySubscribePolicyHandler policy.SubscribePolicyHandler
+       // ReportSubscribeReportHandler sets the operation handler for the subscribe report operation
+       ReportSubscribeReportHandler report.SubscribeReportHandler
+
+       // 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)
+
+       // 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 *XappFrameworkAPI) SetDefaultProduces(mediaType string) {
+       o.defaultProduces = mediaType
+}
+
+// SetDefaultConsumes returns the default consumes media type
+func (o *XappFrameworkAPI) SetDefaultConsumes(mediaType string) {
+       o.defaultConsumes = mediaType
+}
+
+// SetSpec sets a spec that will be served for the clients.
+func (o *XappFrameworkAPI) SetSpec(spec *loads.Document) {
+       o.spec = spec
+}
+
+// DefaultProduces returns the default produces media type
+func (o *XappFrameworkAPI) DefaultProduces() string {
+       return o.defaultProduces
+}
+
+// DefaultConsumes returns the default consumes media type
+func (o *XappFrameworkAPI) DefaultConsumes() string {
+       return o.defaultConsumes
+}
+
+// Formats returns the registered string formats
+func (o *XappFrameworkAPI) Formats() strfmt.Registry {
+       return o.formats
+}
+
+// RegisterFormat registers a custom format validator
+func (o *XappFrameworkAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator) {
+       o.formats.Add(name, format, validator)
+}
+
+// Validate validates the registrations in the XappFrameworkAPI
+func (o *XappFrameworkAPI) Validate() error {
+       var unregistered []string
+
+       if o.JSONConsumer == nil {
+               unregistered = append(unregistered, "JSONConsumer")
+       }
+
+       if o.JSONProducer == nil {
+               unregistered = append(unregistered, "JSONProducer")
+       }
+
+       if o.CommonUnsubscribeHandler == nil {
+               unregistered = append(unregistered, "common.UnsubscribeHandler")
+       }
+
+       if o.ControlSubscribeControlHandler == nil {
+               unregistered = append(unregistered, "control.SubscribeControlHandler")
+       }
+
+       if o.PolicySubscribePolicyHandler == nil {
+               unregistered = append(unregistered, "policy.SubscribePolicyHandler")
+       }
+
+       if o.ReportSubscribeReportHandler == nil {
+               unregistered = append(unregistered, "report.SubscribeReportHandler")
+       }
+
+       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 *XappFrameworkAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error) {
+       return o.ServeError
+}
+
+// AuthenticatorsFor gets the authenticators for the specified security schemes
+func (o *XappFrameworkAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator {
+
+       return nil
+
+}
+
+// Authorizer returns the registered authorizer
+func (o *XappFrameworkAPI) Authorizer() runtime.Authorizer {
+
+       return nil
+
+}
+
+// ConsumersFor gets the consumers for the specified media types
+func (o *XappFrameworkAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer {
+
+       result := make(map[string]runtime.Consumer)
+       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
+func (o *XappFrameworkAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer {
+
+       result := make(map[string]runtime.Producer)
+       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 *XappFrameworkAPI) 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 xapp framework API
+func (o *XappFrameworkAPI) Context() *middleware.Context {
+       if o.context == nil {
+               o.context = middleware.NewRoutableContext(o.spec, o, nil)
+       }
+
+       return o.context
+}
+
+func (o *XappFrameworkAPI) 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["DELETE"] == nil {
+               o.handlers["DELETE"] = make(map[string]http.Handler)
+       }
+       o.handlers["DELETE"]["/subscriptions/{subscriptionId}"] = common.NewUnsubscribe(o.context, o.CommonUnsubscribeHandler)
+
+       if o.handlers["POST"] == nil {
+               o.handlers["POST"] = make(map[string]http.Handler)
+       }
+       o.handlers["POST"]["/subscriptions/control"] = control.NewSubscribeControl(o.context, o.ControlSubscribeControlHandler)
+
+       if o.handlers["POST"] == nil {
+               o.handlers["POST"] = make(map[string]http.Handler)
+       }
+       o.handlers["POST"]["/subscriptions/policy"] = policy.NewSubscribePolicy(o.context, o.PolicySubscribePolicyHandler)
+
+       if o.handlers["POST"] == nil {
+               o.handlers["POST"] = make(map[string]http.Handler)
+       }
+       o.handlers["POST"]["/subscriptions/report"] = report.NewSubscribeReport(o.context, o.ReportSubscribeReportHandler)
+
+}
+
+// Serve creates a http handler to serve the API over HTTP
+// can be used directly in http.ListenAndServe(":8000", api.Serve(nil))
+func (o *XappFrameworkAPI) 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 *XappFrameworkAPI) Init() {
+       if len(o.handlers) == 0 {
+               o.initHandlerCache()
+       }
+}
+
+// RegisterConsumer allows you to add (or override) a consumer for a media type.
+func (o *XappFrameworkAPI) 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 *XappFrameworkAPI) RegisterProducer(mediaType string, producer runtime.Producer) {
+       o.customProducers[mediaType] = producer
+}
diff --git a/pkg/restapi/server.go b/pkg/restapi/server.go
new file mode 100644 (file)
index 0000000..544be19
--- /dev/null
@@ -0,0 +1,508 @@
+// 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"
+
+       "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations"
+)
+
+const (
+       schemeHTTP  = "http"
+       schemeHTTPS = "https"
+       schemeUnix  = "unix"
+)
+
+var defaultSchemes []string
+
+func init() {
+       defaultSchemes = []string{
+               schemeHTTP,
+       }
+}
+
+// NewServer creates a new api xapp framework server but does not configure it
+func NewServer(api *operations.XappFrameworkAPI) *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 xapp framework 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/xapp-framework.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.XappFrameworkAPI
+       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.XappFrameworkAPI) {
+       if api == nil {
+               s.api = nil
+               s.handler = nil
+               return
+       }
+
+       s.api = api
+       s.api.Logger = log.Printf
+       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{}
+       wg.Add(1)
+       go s.handleShutdown(wg, &servers)
+
+       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 xapp framework 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 xapp framework 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 xapp framework 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 xapp framework 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{"http/1.1", "h2"},
+                       // 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 {
+                       // 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 xapp framework 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 xapp framework at https://%s", l.Addr())
+               }(tls.NewListener(s.httpsServerL, httpsServer.TLSConfig))
+       }
+
+       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()
+
+       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)
+}