github.com/kyma-incubator/compass/components/director@v0.0.0-20230623144113-d764f56ff805/internal/model/businesstenantmapping.go (about)

     1  package model
     2  
     3  import (
     4  	"github.com/kyma-incubator/compass/components/director/pkg/pagination"
     5  	"github.com/kyma-incubator/compass/components/director/pkg/tenant"
     6  )
     7  
     8  // BusinessTenantMapping missing godoc
     9  type BusinessTenantMapping struct {
    10  	ID             string
    11  	Name           string
    12  	ExternalTenant string
    13  	Parent         string
    14  	Type           tenant.Type
    15  	Provider       string
    16  	Status         tenant.Status
    17  	Initialized    *bool // computed value
    18  	LicenseType    *string
    19  }
    20  
    21  // WithExternalTenant missing godoc
    22  func (t BusinessTenantMapping) WithExternalTenant(externalTenant string) BusinessTenantMapping {
    23  	t.ExternalTenant = externalTenant
    24  	return t
    25  }
    26  
    27  // WithStatus missing godoc
    28  func (t BusinessTenantMapping) WithStatus(status tenant.Status) BusinessTenantMapping {
    29  	t.Status = status
    30  	return t
    31  }
    32  
    33  // ToInput converts BusinessTenantMapping to BusinessTenantMappingInput
    34  func (t BusinessTenantMapping) ToInput() BusinessTenantMappingInput {
    35  	return BusinessTenantMappingInput{
    36  		Name:           t.Name,
    37  		ExternalTenant: t.ExternalTenant,
    38  		Parent:         t.Parent,
    39  		Subdomain:      "",
    40  		Region:         "",
    41  		Type:           tenant.TypeToStr(t.Type),
    42  		Provider:       t.Provider,
    43  		LicenseType:    t.LicenseType,
    44  	}
    45  }
    46  
    47  // BusinessTenantMappingInput missing godoc
    48  type BusinessTenantMappingInput struct {
    49  	Name           string `json:"name"`
    50  	ExternalTenant string `json:"id"`
    51  	Parent         string `json:"parent"`
    52  	Subdomain      string `json:"subdomain"`
    53  	Region         string `json:"region"`
    54  	Type           string `json:"type"`
    55  	Provider       string
    56  	LicenseType    *string `json:"licenseType"`
    57  }
    58  
    59  // MovedSubaccountMappingInput missing godoc
    60  type MovedSubaccountMappingInput struct {
    61  	TenantMappingInput BusinessTenantMappingInput
    62  	SubaccountID       string
    63  	SourceTenant       string
    64  	TargetTenant       string
    65  }
    66  
    67  // ToBusinessTenantMapping missing godoc
    68  func (i *BusinessTenantMappingInput) ToBusinessTenantMapping(id string) *BusinessTenantMapping {
    69  	return &BusinessTenantMapping{
    70  		ID:             id,
    71  		Name:           i.Name,
    72  		ExternalTenant: i.ExternalTenant,
    73  		Parent:         i.Parent,
    74  		Type:           tenant.StrToType(i.Type),
    75  		Provider:       i.Provider,
    76  		Status:         tenant.Active,
    77  		LicenseType:    i.LicenseType,
    78  	}
    79  }
    80  
    81  // WithExternalTenant missing godoc
    82  func (i BusinessTenantMappingInput) WithExternalTenant(externalTenant string) BusinessTenantMappingInput {
    83  	i.ExternalTenant = externalTenant
    84  	return i
    85  }
    86  
    87  // BusinessTenantMappingPage Struct for BusinessTenantMapping data with page info
    88  type BusinessTenantMappingPage struct {
    89  	Data       []*BusinessTenantMapping
    90  	PageInfo   *pagination.Page
    91  	TotalCount int
    92  }