forked from Juniper/contrail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
domain.go
29 lines (25 loc) · 771 Bytes
/
domain.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package types
import (
"context"
"github.com/Juniper/contrail/pkg/models"
"github.com/Juniper/contrail/pkg/services"
asfmodels "github.com/Juniper/asf/pkg/models"
)
//CreateDomain does pre-check for create domain
func (sv *ContrailTypeLogicService) CreateDomain(
ctx context.Context,
request *services.CreateDomainRequest,
) (response *services.CreateDomainResponse, err error) {
domain := request.GetDomain()
err = sv.InTransactionDoer.DoInTransaction(
ctx,
func(ctx context.Context) error {
domain.Perms2.Share = append(domain.Perms2.Share, &models.ShareType{
TenantAccess: asfmodels.PermsRW,
Tenant: "domain:" + domain.UUID,
})
response, err = sv.BaseService.CreateDomain(ctx, request)
return err
})
return response, err
}