exception.go raw

   1  /**
   2   * Copyright 2016-2024 IBM Corp.
   3   *
   4   * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
   5   * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
   6   *
   7   * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
   8   * on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   9   * See the License for the specific language governing permissions and limitations under the License.
  10   */
  11  
  12  // AUTOMATICALLY GENERATED CODE - DO NOT MODIFY
  13  
  14  package services
  15  
  16  import (
  17  	"fmt"
  18  	"strings"
  19  
  20  	"github.com/softlayer/softlayer-go/session"
  21  	"github.com/softlayer/softlayer-go/sl"
  22  )
  23  
  24  // Throw this exception if there are validation errors. The types are specified in SoftLayer_Brand_Creation_Input including: KEY_NAME, PREFIX, NAME, LONG_NAME, SUPPORT_POLICY, POLICY_ACKNOWLEDGEMENT_FLAG, etc.
  25  type Exception_Brand_Creation struct {
  26  	Session session.SLSession
  27  	Options sl.Options
  28  }
  29  
  30  // GetExceptionBrandCreationService returns an instance of the Exception_Brand_Creation SoftLayer service
  31  func GetExceptionBrandCreationService(sess session.SLSession) Exception_Brand_Creation {
  32  	return Exception_Brand_Creation{Session: sess}
  33  }
  34  
  35  func (r Exception_Brand_Creation) Id(id int) Exception_Brand_Creation {
  36  	r.Options.Id = &id
  37  	return r
  38  }
  39  
  40  func (r Exception_Brand_Creation) Mask(mask string) Exception_Brand_Creation {
  41  	if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
  42  		mask = fmt.Sprintf("mask[%s]", mask)
  43  	}
  44  
  45  	r.Options.Mask = mask
  46  	return r
  47  }
  48  
  49  func (r Exception_Brand_Creation) Filter(filter string) Exception_Brand_Creation {
  50  	r.Options.Filter = filter
  51  	return r
  52  }
  53  
  54  func (r Exception_Brand_Creation) Limit(limit int) Exception_Brand_Creation {
  55  	r.Options.Limit = &limit
  56  	return r
  57  }
  58  
  59  func (r Exception_Brand_Creation) Offset(offset int) Exception_Brand_Creation {
  60  	r.Options.Offset = &offset
  61  	return r
  62  }
  63