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