github.com/hashicorp/hcp-sdk-go@v0.94.0/clients/cloud-vault-secrets/stable/2023-06-13/models/secrets20230613_sync_integration.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  // Secrets20230613SyncIntegration secrets 20230613 sync integration
    18  //
    19  // swagger:model secrets_20230613SyncIntegration
    20  type Secrets20230613SyncIntegration struct {
    21  
    22  	// aws sm connection details
    23  	AwsSmConnectionDetails *Secrets20230613AwsSmConnectionDetailsResponse `json:"aws_sm_connection_details,omitempty"`
    24  
    25  	// created at
    26  	// Format: date-time
    27  	CreatedAt strfmt.DateTime `json:"created_at,omitempty"`
    28  
    29  	// created by
    30  	CreatedBy *Secrets20230613Principal `json:"created_by,omitempty"`
    31  
    32  	// gh repo connection details
    33  	GhRepoConnectionDetails *Secrets20230613GhRepoConnectionDetailsResponse `json:"gh_repo_connection_details,omitempty"`
    34  
    35  	// location
    36  	Location *CloudlocationLocation `json:"location,omitempty"`
    37  
    38  	// name
    39  	Name string `json:"name,omitempty"`
    40  
    41  	// type
    42  	Type string `json:"type,omitempty"`
    43  
    44  	// updated at
    45  	// Format: date-time
    46  	UpdatedAt strfmt.DateTime `json:"updated_at,omitempty"`
    47  
    48  	// updated by
    49  	UpdatedBy *Secrets20230613Principal `json:"updated_by,omitempty"`
    50  
    51  	// vercel project connection details
    52  	VercelProjectConnectionDetails *Secrets20230613VercelProjectConnectionDetailsResponse `json:"vercel_project_connection_details,omitempty"`
    53  }
    54  
    55  // Validate validates this secrets 20230613 sync integration
    56  func (m *Secrets20230613SyncIntegration) Validate(formats strfmt.Registry) error {
    57  	var res []error
    58  
    59  	if err := m.validateAwsSmConnectionDetails(formats); err != nil {
    60  		res = append(res, err)
    61  	}
    62  
    63  	if err := m.validateCreatedAt(formats); err != nil {
    64  		res = append(res, err)
    65  	}
    66  
    67  	if err := m.validateCreatedBy(formats); err != nil {
    68  		res = append(res, err)
    69  	}
    70  
    71  	if err := m.validateGhRepoConnectionDetails(formats); err != nil {
    72  		res = append(res, err)
    73  	}
    74  
    75  	if err := m.validateLocation(formats); err != nil {
    76  		res = append(res, err)
    77  	}
    78  
    79  	if err := m.validateUpdatedAt(formats); err != nil {
    80  		res = append(res, err)
    81  	}
    82  
    83  	if err := m.validateUpdatedBy(formats); err != nil {
    84  		res = append(res, err)
    85  	}
    86  
    87  	if err := m.validateVercelProjectConnectionDetails(formats); err != nil {
    88  		res = append(res, err)
    89  	}
    90  
    91  	if len(res) > 0 {
    92  		return errors.CompositeValidationError(res...)
    93  	}
    94  	return nil
    95  }
    96  
    97  func (m *Secrets20230613SyncIntegration) validateAwsSmConnectionDetails(formats strfmt.Registry) error {
    98  	if swag.IsZero(m.AwsSmConnectionDetails) { // not required
    99  		return nil
   100  	}
   101  
   102  	if m.AwsSmConnectionDetails != nil {
   103  		if err := m.AwsSmConnectionDetails.Validate(formats); err != nil {
   104  			if ve, ok := err.(*errors.Validation); ok {
   105  				return ve.ValidateName("aws_sm_connection_details")
   106  			} else if ce, ok := err.(*errors.CompositeError); ok {
   107  				return ce.ValidateName("aws_sm_connection_details")
   108  			}
   109  			return err
   110  		}
   111  	}
   112  
   113  	return nil
   114  }
   115  
   116  func (m *Secrets20230613SyncIntegration) validateCreatedAt(formats strfmt.Registry) error {
   117  	if swag.IsZero(m.CreatedAt) { // not required
   118  		return nil
   119  	}
   120  
   121  	if err := validate.FormatOf("created_at", "body", "date-time", m.CreatedAt.String(), formats); err != nil {
   122  		return err
   123  	}
   124  
   125  	return nil
   126  }
   127  
   128  func (m *Secrets20230613SyncIntegration) validateCreatedBy(formats strfmt.Registry) error {
   129  	if swag.IsZero(m.CreatedBy) { // not required
   130  		return nil
   131  	}
   132  
   133  	if m.CreatedBy != nil {
   134  		if err := m.CreatedBy.Validate(formats); err != nil {
   135  			if ve, ok := err.(*errors.Validation); ok {
   136  				return ve.ValidateName("created_by")
   137  			} else if ce, ok := err.(*errors.CompositeError); ok {
   138  				return ce.ValidateName("created_by")
   139  			}
   140  			return err
   141  		}
   142  	}
   143  
   144  	return nil
   145  }
   146  
   147  func (m *Secrets20230613SyncIntegration) validateGhRepoConnectionDetails(formats strfmt.Registry) error {
   148  	if swag.IsZero(m.GhRepoConnectionDetails) { // not required
   149  		return nil
   150  	}
   151  
   152  	if m.GhRepoConnectionDetails != nil {
   153  		if err := m.GhRepoConnectionDetails.Validate(formats); err != nil {
   154  			if ve, ok := err.(*errors.Validation); ok {
   155  				return ve.ValidateName("gh_repo_connection_details")
   156  			} else if ce, ok := err.(*errors.CompositeError); ok {
   157  				return ce.ValidateName("gh_repo_connection_details")
   158  			}
   159  			return err
   160  		}
   161  	}
   162  
   163  	return nil
   164  }
   165  
   166  func (m *Secrets20230613SyncIntegration) validateLocation(formats strfmt.Registry) error {
   167  	if swag.IsZero(m.Location) { // not required
   168  		return nil
   169  	}
   170  
   171  	if m.Location != nil {
   172  		if err := m.Location.Validate(formats); err != nil {
   173  			if ve, ok := err.(*errors.Validation); ok {
   174  				return ve.ValidateName("location")
   175  			} else if ce, ok := err.(*errors.CompositeError); ok {
   176  				return ce.ValidateName("location")
   177  			}
   178  			return err
   179  		}
   180  	}
   181  
   182  	return nil
   183  }
   184  
   185  func (m *Secrets20230613SyncIntegration) validateUpdatedAt(formats strfmt.Registry) error {
   186  	if swag.IsZero(m.UpdatedAt) { // not required
   187  		return nil
   188  	}
   189  
   190  	if err := validate.FormatOf("updated_at", "body", "date-time", m.UpdatedAt.String(), formats); err != nil {
   191  		return err
   192  	}
   193  
   194  	return nil
   195  }
   196  
   197  func (m *Secrets20230613SyncIntegration) validateUpdatedBy(formats strfmt.Registry) error {
   198  	if swag.IsZero(m.UpdatedBy) { // not required
   199  		return nil
   200  	}
   201  
   202  	if m.UpdatedBy != nil {
   203  		if err := m.UpdatedBy.Validate(formats); err != nil {
   204  			if ve, ok := err.(*errors.Validation); ok {
   205  				return ve.ValidateName("updated_by")
   206  			} else if ce, ok := err.(*errors.CompositeError); ok {
   207  				return ce.ValidateName("updated_by")
   208  			}
   209  			return err
   210  		}
   211  	}
   212  
   213  	return nil
   214  }
   215  
   216  func (m *Secrets20230613SyncIntegration) validateVercelProjectConnectionDetails(formats strfmt.Registry) error {
   217  	if swag.IsZero(m.VercelProjectConnectionDetails) { // not required
   218  		return nil
   219  	}
   220  
   221  	if m.VercelProjectConnectionDetails != nil {
   222  		if err := m.VercelProjectConnectionDetails.Validate(formats); err != nil {
   223  			if ve, ok := err.(*errors.Validation); ok {
   224  				return ve.ValidateName("vercel_project_connection_details")
   225  			} else if ce, ok := err.(*errors.CompositeError); ok {
   226  				return ce.ValidateName("vercel_project_connection_details")
   227  			}
   228  			return err
   229  		}
   230  	}
   231  
   232  	return nil
   233  }
   234  
   235  // ContextValidate validate this secrets 20230613 sync integration based on the context it is used
   236  func (m *Secrets20230613SyncIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   237  	var res []error
   238  
   239  	if err := m.contextValidateAwsSmConnectionDetails(ctx, formats); err != nil {
   240  		res = append(res, err)
   241  	}
   242  
   243  	if err := m.contextValidateCreatedBy(ctx, formats); err != nil {
   244  		res = append(res, err)
   245  	}
   246  
   247  	if err := m.contextValidateGhRepoConnectionDetails(ctx, formats); err != nil {
   248  		res = append(res, err)
   249  	}
   250  
   251  	if err := m.contextValidateLocation(ctx, formats); err != nil {
   252  		res = append(res, err)
   253  	}
   254  
   255  	if err := m.contextValidateUpdatedBy(ctx, formats); err != nil {
   256  		res = append(res, err)
   257  	}
   258  
   259  	if err := m.contextValidateVercelProjectConnectionDetails(ctx, formats); err != nil {
   260  		res = append(res, err)
   261  	}
   262  
   263  	if len(res) > 0 {
   264  		return errors.CompositeValidationError(res...)
   265  	}
   266  	return nil
   267  }
   268  
   269  func (m *Secrets20230613SyncIntegration) contextValidateAwsSmConnectionDetails(ctx context.Context, formats strfmt.Registry) error {
   270  
   271  	if m.AwsSmConnectionDetails != nil {
   272  
   273  		if swag.IsZero(m.AwsSmConnectionDetails) { // not required
   274  			return nil
   275  		}
   276  
   277  		if err := m.AwsSmConnectionDetails.ContextValidate(ctx, formats); err != nil {
   278  			if ve, ok := err.(*errors.Validation); ok {
   279  				return ve.ValidateName("aws_sm_connection_details")
   280  			} else if ce, ok := err.(*errors.CompositeError); ok {
   281  				return ce.ValidateName("aws_sm_connection_details")
   282  			}
   283  			return err
   284  		}
   285  	}
   286  
   287  	return nil
   288  }
   289  
   290  func (m *Secrets20230613SyncIntegration) contextValidateCreatedBy(ctx context.Context, formats strfmt.Registry) error {
   291  
   292  	if m.CreatedBy != nil {
   293  
   294  		if swag.IsZero(m.CreatedBy) { // not required
   295  			return nil
   296  		}
   297  
   298  		if err := m.CreatedBy.ContextValidate(ctx, formats); err != nil {
   299  			if ve, ok := err.(*errors.Validation); ok {
   300  				return ve.ValidateName("created_by")
   301  			} else if ce, ok := err.(*errors.CompositeError); ok {
   302  				return ce.ValidateName("created_by")
   303  			}
   304  			return err
   305  		}
   306  	}
   307  
   308  	return nil
   309  }
   310  
   311  func (m *Secrets20230613SyncIntegration) contextValidateGhRepoConnectionDetails(ctx context.Context, formats strfmt.Registry) error {
   312  
   313  	if m.GhRepoConnectionDetails != nil {
   314  
   315  		if swag.IsZero(m.GhRepoConnectionDetails) { // not required
   316  			return nil
   317  		}
   318  
   319  		if err := m.GhRepoConnectionDetails.ContextValidate(ctx, formats); err != nil {
   320  			if ve, ok := err.(*errors.Validation); ok {
   321  				return ve.ValidateName("gh_repo_connection_details")
   322  			} else if ce, ok := err.(*errors.CompositeError); ok {
   323  				return ce.ValidateName("gh_repo_connection_details")
   324  			}
   325  			return err
   326  		}
   327  	}
   328  
   329  	return nil
   330  }
   331  
   332  func (m *Secrets20230613SyncIntegration) contextValidateLocation(ctx context.Context, formats strfmt.Registry) error {
   333  
   334  	if m.Location != nil {
   335  
   336  		if swag.IsZero(m.Location) { // not required
   337  			return nil
   338  		}
   339  
   340  		if err := m.Location.ContextValidate(ctx, formats); err != nil {
   341  			if ve, ok := err.(*errors.Validation); ok {
   342  				return ve.ValidateName("location")
   343  			} else if ce, ok := err.(*errors.CompositeError); ok {
   344  				return ce.ValidateName("location")
   345  			}
   346  			return err
   347  		}
   348  	}
   349  
   350  	return nil
   351  }
   352  
   353  func (m *Secrets20230613SyncIntegration) contextValidateUpdatedBy(ctx context.Context, formats strfmt.Registry) error {
   354  
   355  	if m.UpdatedBy != nil {
   356  
   357  		if swag.IsZero(m.UpdatedBy) { // not required
   358  			return nil
   359  		}
   360  
   361  		if err := m.UpdatedBy.ContextValidate(ctx, formats); err != nil {
   362  			if ve, ok := err.(*errors.Validation); ok {
   363  				return ve.ValidateName("updated_by")
   364  			} else if ce, ok := err.(*errors.CompositeError); ok {
   365  				return ce.ValidateName("updated_by")
   366  			}
   367  			return err
   368  		}
   369  	}
   370  
   371  	return nil
   372  }
   373  
   374  func (m *Secrets20230613SyncIntegration) contextValidateVercelProjectConnectionDetails(ctx context.Context, formats strfmt.Registry) error {
   375  
   376  	if m.VercelProjectConnectionDetails != nil {
   377  
   378  		if swag.IsZero(m.VercelProjectConnectionDetails) { // not required
   379  			return nil
   380  		}
   381  
   382  		if err := m.VercelProjectConnectionDetails.ContextValidate(ctx, formats); err != nil {
   383  			if ve, ok := err.(*errors.Validation); ok {
   384  				return ve.ValidateName("vercel_project_connection_details")
   385  			} else if ce, ok := err.(*errors.CompositeError); ok {
   386  				return ce.ValidateName("vercel_project_connection_details")
   387  			}
   388  			return err
   389  		}
   390  	}
   391  
   392  	return nil
   393  }
   394  
   395  // MarshalBinary interface implementation
   396  func (m *Secrets20230613SyncIntegration) MarshalBinary() ([]byte, error) {
   397  	if m == nil {
   398  		return nil, nil
   399  	}
   400  	return swag.WriteJSON(m)
   401  }
   402  
   403  // UnmarshalBinary interface implementation
   404  func (m *Secrets20230613SyncIntegration) UnmarshalBinary(b []byte) error {
   405  	var res Secrets20230613SyncIntegration
   406  	if err := swag.ReadJSON(b, &res); err != nil {
   407  		return err
   408  	}
   409  	*m = res
   410  	return nil
   411  }