github.com/hashicorp/hcp-sdk-go@v0.94.0/clients/cloud-shared/v1/models/google_protobuf_null_value.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  // GoogleProtobufNullValue `NullValue` is a singleton enumeration to represent the null value for the
    18  // `Value` type union.
    19  //
    20  //	The JSON representation for `NullValue` is JSON `null`.
    21  //
    22  //	- NULL_VALUE: Null value.
    23  //
    24  // swagger:model google.protobuf.NullValue
    25  type GoogleProtobufNullValue string
    26  
    27  func NewGoogleProtobufNullValue(value GoogleProtobufNullValue) *GoogleProtobufNullValue {
    28  	return &value
    29  }
    30  
    31  // Pointer returns a pointer to a freshly-allocated GoogleProtobufNullValue.
    32  func (m GoogleProtobufNullValue) Pointer() *GoogleProtobufNullValue {
    33  	return &m
    34  }
    35  
    36  const (
    37  
    38  	// GoogleProtobufNullValueNULLVALUE captures enum value "NULL_VALUE"
    39  	GoogleProtobufNullValueNULLVALUE GoogleProtobufNullValue = "NULL_VALUE"
    40  )
    41  
    42  // for schema
    43  var googleProtobufNullValueEnum []interface{}
    44  
    45  func init() {
    46  	var res []GoogleProtobufNullValue
    47  	if err := json.Unmarshal([]byte(`["NULL_VALUE"]`), &res); err != nil {
    48  		panic(err)
    49  	}
    50  	for _, v := range res {
    51  		googleProtobufNullValueEnum = append(googleProtobufNullValueEnum, v)
    52  	}
    53  }
    54  
    55  func (m GoogleProtobufNullValue) validateGoogleProtobufNullValueEnum(path, location string, value GoogleProtobufNullValue) error {
    56  	if err := validate.EnumCase(path, location, value, googleProtobufNullValueEnum, true); err != nil {
    57  		return err
    58  	}
    59  	return nil
    60  }
    61  
    62  // Validate validates this google protobuf null value
    63  func (m GoogleProtobufNullValue) Validate(formats strfmt.Registry) error {
    64  	var res []error
    65  
    66  	// value enum
    67  	if err := m.validateGoogleProtobufNullValueEnum("", "body", m); err != nil {
    68  		return err
    69  	}
    70  
    71  	if len(res) > 0 {
    72  		return errors.CompositeValidationError(res...)
    73  	}
    74  	return nil
    75  }
    76  
    77  // ContextValidate validates this google protobuf null value based on context it is used
    78  func (m GoogleProtobufNullValue) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    79  	return nil
    80  }