+func (ss ServiceSecurity) Validate() error {
+
+ if len(strings.TrimSpace(string(ss.NotificationDestination))) == 0 {
+ return errors.New("ServiceSecurity missing required notificationDestination")
+ }
+
+ if _, err := url.ParseRequestURI(string(ss.NotificationDestination)); err != nil {
+ return fmt.Errorf("ServiceSecurity has invalid notificationDestination, err=%s", err)
+ }
+
+ if len(ss.SecurityInfo) == 0 {
+ return errors.New("ServiceSecurity missing required SecurityInfo")
+ }
+ for _, securityInfo := range ss.SecurityInfo {
+ securityInfo.Validate()
+ }
+ return nil
+}
+
+func (si SecurityInformation) Validate() error {
+ if len(si.PrefSecurityMethods) == 0 {
+ return errors.New("SecurityInformation missing required PrefSecurityMethods")
+ }
+ return nil
+}
+
+func (sn SecurityNotification) Validate() error {
+
+ if len(strings.TrimSpace(string(sn.ApiInvokerId))) == 0 {
+ return errors.New("SecurityNotification missing required ApiInvokerId")
+ }
+
+ if len(sn.ApiIds) < 1 {
+ return errors.New("SecurityNotification missing required ApiIds")
+ }
+
+ if len(strings.TrimSpace(string(sn.Cause))) == 0 {
+ return errors.New("SecurityNotification missing required Cause")
+ }
+
+ if sn.Cause != CauseOVERLIMITUSAGE && sn.Cause != CauseUNEXPECTEDREASON {
+ return errors.New("SecurityNotification unexpected value for Cause")
+ }
+
+ return nil
+}
+