github.com/kyma-incubator/compass/components/director@v0.0.0-20230623144113-d764f56ff805/internal/model/cert_subject_mapping.go (about) 1 package model 2 3 import "github.com/kyma-incubator/compass/components/director/pkg/pagination" 4 5 // CertSubjectMapping is a structure that represents a certificate subject 6 // mapped to internal consumer with given tenant access levels 7 type CertSubjectMapping struct { 8 ID string `json:"id"` 9 Subject string `json:"subject"` 10 ConsumerType string `json:"consumer_type"` 11 InternalConsumerID *string `json:"internal_consumer_id"` 12 TenantAccessLevels []string `json:"tenant_access_levels"` 13 } 14 15 // CertSubjectMappingInput is an input for creating a new CertSubjectMapping 16 type CertSubjectMappingInput struct { 17 Subject string `json:"subject"` 18 ConsumerType string `json:"consumer_type"` 19 InternalConsumerID *string `json:"internal_consumer_id"` 20 TenantAccessLevels []string `json:"tenant_access_levels"` 21 } 22 23 // CertSubjectMappingPage contains CertSubjectMapping data with page info 24 type CertSubjectMappingPage struct { 25 Data []*CertSubjectMapping 26 PageInfo *pagination.Page 27 TotalCount int 28 } 29 30 // ToModel converts CertSubjectMappingInput to CertSubjectMapping 31 func (c *CertSubjectMappingInput) ToModel(id string) *CertSubjectMapping { 32 if c == nil { 33 return nil 34 } 35 36 return &CertSubjectMapping{ 37 ID: id, 38 Subject: c.Subject, 39 ConsumerType: c.ConsumerType, 40 InternalConsumerID: c.InternalConsumerID, 41 TenantAccessLevels: c.TenantAccessLevels, 42 } 43 }