github.com/hashicorp/hcp-sdk-go@v0.94.0/clients/cloud-billing/preview/2020-11-05/models/billing20201105_unit.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package models
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	"context"
    10  	"encoding/json"
    11  
    12  	"github.com/go-openapi/errors"
    13  	"github.com/go-openapi/strfmt"
    14  	"github.com/go-openapi/validate"
    15  )
    16  
    17  // Billing20201105Unit Unit is an enum with all possible measurement units
    18  // the system accepts.
    19  //
    20  //   - HOUR: Valid for static products.
    21  //
    22  // swagger:model billing_20201105Unit
    23  type Billing20201105Unit string
    24  
    25  func NewBilling20201105Unit(value Billing20201105Unit) *Billing20201105Unit {
    26  	return &value
    27  }
    28  
    29  // Pointer returns a pointer to a freshly-allocated Billing20201105Unit.
    30  func (m Billing20201105Unit) Pointer() *Billing20201105Unit {
    31  	return &m
    32  }
    33  
    34  const (
    35  
    36  	// Billing20201105UnitNOUNIT captures enum value "NO_UNIT"
    37  	Billing20201105UnitNOUNIT Billing20201105Unit = "NO_UNIT"
    38  
    39  	// Billing20201105UnitHOUR captures enum value "HOUR"
    40  	Billing20201105UnitHOUR Billing20201105Unit = "HOUR"
    41  
    42  	// Billing20201105UnitMINUTE captures enum value "MINUTE"
    43  	Billing20201105UnitMINUTE Billing20201105Unit = "MINUTE"
    44  
    45  	// Billing20201105UnitUNIT captures enum value "UNIT"
    46  	Billing20201105UnitUNIT Billing20201105Unit = "UNIT"
    47  
    48  	// Billing20201105UnitMONTH captures enum value "MONTH"
    49  	Billing20201105UnitMONTH Billing20201105Unit = "MONTH"
    50  )
    51  
    52  // for schema
    53  var billing20201105UnitEnum []interface{}
    54  
    55  func init() {
    56  	var res []Billing20201105Unit
    57  	if err := json.Unmarshal([]byte(`["NO_UNIT","HOUR","MINUTE","UNIT","MONTH"]`), &res); err != nil {
    58  		panic(err)
    59  	}
    60  	for _, v := range res {
    61  		billing20201105UnitEnum = append(billing20201105UnitEnum, v)
    62  	}
    63  }
    64  
    65  func (m Billing20201105Unit) validateBilling20201105UnitEnum(path, location string, value Billing20201105Unit) error {
    66  	if err := validate.EnumCase(path, location, value, billing20201105UnitEnum, true); err != nil {
    67  		return err
    68  	}
    69  	return nil
    70  }
    71  
    72  // Validate validates this billing 20201105 unit
    73  func (m Billing20201105Unit) Validate(formats strfmt.Registry) error {
    74  	var res []error
    75  
    76  	// value enum
    77  	if err := m.validateBilling20201105UnitEnum("", "body", m); err != nil {
    78  		return err
    79  	}
    80  
    81  	if len(res) > 0 {
    82  		return errors.CompositeValidationError(res...)
    83  	}
    84  	return nil
    85  }
    86  
    87  // ContextValidate validates this billing 20201105 unit based on context it is used
    88  func (m Billing20201105Unit) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    89  	return nil
    90  }