github.com/hashicorp/hcp-sdk-go@v0.94.0/clients/cloud-log-service/preview/2021-03-30/models/iam_group.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  
    11  	"github.com/go-openapi/errors"
    12  	"github.com/go-openapi/strfmt"
    13  	"github.com/go-openapi/swag"
    14  	"github.com/go-openapi/validate"
    15  )
    16  
    17  // IamGroup iam group
    18  //
    19  // swagger:model iamGroup
    20  type IamGroup struct {
    21  
    22  	// created_at is when the group was created.
    23  	// Format: date-time
    24  	CreatedAt strfmt.DateTime `json:"created_at,omitempty"`
    25  
    26  	// description is a description of the group.
    27  	Description string `json:"description,omitempty"`
    28  
    29  	// display_name is the user-specified display name of the group.
    30  	DisplayName string `json:"display_name,omitempty"`
    31  
    32  	// member_count is the count of members in the group.
    33  	// We use Int32Value to make sure we return nil instead of 0 if we don't have a member count
    34  	MemberCount int32 `json:"member_count,omitempty"`
    35  
    36  	// resource_id is the principal ID of the group.
    37  	ResourceID string `json:"resource_id,omitempty"`
    38  
    39  	// resource_name is the name of the group.
    40  	ResourceName string `json:"resource_name,omitempty"`
    41  
    42  	// scim_synchronized denotes the group was synchronized from an upstream IdP using SCIM.
    43  	ScimSynchronized bool `json:"scim_synchronized,omitempty"`
    44  
    45  	// updated_at is when the group was last updated.
    46  	// Format: date-time
    47  	UpdatedAt strfmt.DateTime `json:"updated_at,omitempty"`
    48  }
    49  
    50  // Validate validates this iam group
    51  func (m *IamGroup) Validate(formats strfmt.Registry) error {
    52  	var res []error
    53  
    54  	if err := m.validateCreatedAt(formats); err != nil {
    55  		res = append(res, err)
    56  	}
    57  
    58  	if err := m.validateUpdatedAt(formats); err != nil {
    59  		res = append(res, err)
    60  	}
    61  
    62  	if len(res) > 0 {
    63  		return errors.CompositeValidationError(res...)
    64  	}
    65  	return nil
    66  }
    67  
    68  func (m *IamGroup) validateCreatedAt(formats strfmt.Registry) error {
    69  	if swag.IsZero(m.CreatedAt) { // not required
    70  		return nil
    71  	}
    72  
    73  	if err := validate.FormatOf("created_at", "body", "date-time", m.CreatedAt.String(), formats); err != nil {
    74  		return err
    75  	}
    76  
    77  	return nil
    78  }
    79  
    80  func (m *IamGroup) validateUpdatedAt(formats strfmt.Registry) error {
    81  	if swag.IsZero(m.UpdatedAt) { // not required
    82  		return nil
    83  	}
    84  
    85  	if err := validate.FormatOf("updated_at", "body", "date-time", m.UpdatedAt.String(), formats); err != nil {
    86  		return err
    87  	}
    88  
    89  	return nil
    90  }
    91  
    92  // ContextValidate validates this iam group based on context it is used
    93  func (m *IamGroup) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    94  	return nil
    95  }
    96  
    97  // MarshalBinary interface implementation
    98  func (m *IamGroup) MarshalBinary() ([]byte, error) {
    99  	if m == nil {
   100  		return nil, nil
   101  	}
   102  	return swag.WriteJSON(m)
   103  }
   104  
   105  // UnmarshalBinary interface implementation
   106  func (m *IamGroup) UnmarshalBinary(b []byte) error {
   107  	var res IamGroup
   108  	if err := swag.ReadJSON(b, &res); err != nil {
   109  		return err
   110  	}
   111  	*m = res
   112  	return nil
   113  }