API update
Change-Id: I1ad0d7202227b01ff14d8433f27bead15d8c5a99
Signed-off-by: Mohamed Abukar <abukar.mohamed@nokia.com>
diff --git a/pkg/models/subscription_instance.go b/pkg/models/subscription_instance.go
new file mode 100644
index 0000000..d619166
--- /dev/null
+++ b/pkg/models/subscription_instance.go
@@ -0,0 +1,81 @@
+// 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"
+)
+
+// SubscriptionInstance subscription instance
+// swagger:model SubscriptionInstance
+type SubscriptionInstance struct {
+
+ // instance Id
+ // Required: true
+ InstanceID *int64 `json:"InstanceId"`
+
+ // requestor Id
+ // Required: true
+ RequestorID *int64 `json:"RequestorId"`
+}
+
+// Validate validates this subscription instance
+func (m *SubscriptionInstance) Validate(formats strfmt.Registry) error {
+ var res []error
+
+ if err := m.validateInstanceID(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 *SubscriptionInstance) validateInstanceID(formats strfmt.Registry) error {
+
+ if err := validate.Required("InstanceId", "body", m.InstanceID); err != nil {
+ return err
+ }
+
+ return nil
+}
+
+func (m *SubscriptionInstance) validateRequestorID(formats strfmt.Registry) error {
+
+ if err := validate.Required("RequestorId", "body", m.RequestorID); err != nil {
+ return err
+ }
+
+ return nil
+}
+
+// MarshalBinary interface implementation
+func (m *SubscriptionInstance) MarshalBinary() ([]byte, error) {
+ if m == nil {
+ return nil, nil
+ }
+ return swag.WriteJSON(m)
+}
+
+// UnmarshalBinary interface implementation
+func (m *SubscriptionInstance) UnmarshalBinary(b []byte) error {
+ var res SubscriptionInstance
+ if err := swag.ReadJSON(b, &res); err != nil {
+ return err
+ }
+ *m = res
+ return nil
+}
diff --git a/pkg/models/subscription_response.go b/pkg/models/subscription_response.go
index 8657177..c62b4f1 100644
--- a/pkg/models/subscription_response.go
+++ b/pkg/models/subscription_response.go
@@ -12,25 +12,64 @@
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
+ "github.com/go-openapi/validate"
)
// SubscriptionResponse subscription response
// swagger:model SubscriptionResponse
-type SubscriptionResponse []*SubscriptionResponseItem
+type SubscriptionResponse struct {
+
+ // subscription Id
+ // Required: true
+ SubscriptionID *string `json:"SubscriptionId"`
+
+ // subscription instances
+ // Required: true
+ SubscriptionInstances []*SubscriptionInstance `json:"SubscriptionInstances"`
+}
// Validate validates this subscription response
-func (m SubscriptionResponse) Validate(formats strfmt.Registry) error {
+func (m *SubscriptionResponse) Validate(formats strfmt.Registry) error {
var res []error
- for i := 0; i < len(m); i++ {
- if swag.IsZero(m[i]) { // not required
+ if err := m.validateSubscriptionID(formats); err != nil {
+ res = append(res, err)
+ }
+
+ if err := m.validateSubscriptionInstances(formats); err != nil {
+ res = append(res, err)
+ }
+
+ if len(res) > 0 {
+ return errors.CompositeValidationError(res...)
+ }
+ return nil
+}
+
+func (m *SubscriptionResponse) validateSubscriptionID(formats strfmt.Registry) error {
+
+ if err := validate.Required("SubscriptionId", "body", m.SubscriptionID); err != nil {
+ return err
+ }
+
+ return nil
+}
+
+func (m *SubscriptionResponse) validateSubscriptionInstances(formats strfmt.Registry) error {
+
+ if err := validate.Required("SubscriptionInstances", "body", m.SubscriptionInstances); err != nil {
+ return err
+ }
+
+ for i := 0; i < len(m.SubscriptionInstances); i++ {
+ if swag.IsZero(m.SubscriptionInstances[i]) { // not required
continue
}
- if m[i] != nil {
- if err := m[i].Validate(formats); err != nil {
+ if m.SubscriptionInstances[i] != nil {
+ if err := m.SubscriptionInstances[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
- return ve.ValidateName(strconv.Itoa(i))
+ return ve.ValidateName("SubscriptionInstances" + "." + strconv.Itoa(i))
}
return err
}
@@ -38,8 +77,23 @@
}
- if len(res) > 0 {
- return errors.CompositeValidationError(res...)
+ return nil
+}
+
+// MarshalBinary interface implementation
+func (m *SubscriptionResponse) MarshalBinary() ([]byte, error) {
+ if m == nil {
+ return nil, nil
}
+ return swag.WriteJSON(m)
+}
+
+// UnmarshalBinary interface implementation
+func (m *SubscriptionResponse) UnmarshalBinary(b []byte) error {
+ var res SubscriptionResponse
+ if err := swag.ReadJSON(b, &res); err != nil {
+ return err
+ }
+ *m = res
return nil
}