/
fileshare.go
108 lines (84 loc) · 3.96 KB
/
fileshare.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// Copyright 2020 The SODA Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package model
import "github.com/globalsign/mgo/bson"
// FileShareS is a schema for fileshare API. Fileshare will be created on cloud backend.
type FileShare struct {
// The uuid of the file share, it's unique in the context and generated by system
// on successful creation of the file share. It's not allowed to be modified by
// the user.
// +readOnly
Id bson.ObjectId `json:"id,omitempty" bson:"_id,omitempty"`
// CreatedAt representing the server time when the object was created successfully.
// Now, it's represented as a time string in RFC8601 format.
// +readOnly
CreatedAt string `json:"createdAt,omitempty" bson:"createdAt,omitempty"`
// UpdatedAt representing the server time when the object was updated successfully.
// Now, it's represented as a time string in RFC8601 format.
// +readOnly
UpdatedAt string `json:"updatedAt,omitempty" bson:"updatedAt,omitempty"`
// The uuid of the project that the file share belongs to.
TenantId string `json:"tenantId,omitempty" bson:"tenantId,omitempty"`
// The uuid of the user that the file share belongs to.
// +optional
UserId string `json:"userId,omitempty" bson:"userId,omitempty"`
// The uuid of the backend that the file share belongs to.
BackendId string `json:"backendId,omitempty" bson:"backendId,omitempty"`
// The name of the backend that the file share belongs to.
// +optional
Backend string `json:"backend,omitempty" bson:"backend,omitempty"`
// The name of the file share.
Name string `json:"name,omitempty" bson:"name,omitempty"`
// The description of the file share.
// +optional
Description string `json:"description,omitempty" bson:"description,omitempty"`
// The type of the file share.
// +optional
Type string `json:"type,omitempty" bson:"type,omitempty"`
// The size of the file share requested by the user.
// Default unit of file share Size is GB.
// +optional
Size *int64 `json:"size,omitempty" bson:"size,omitempty"`
// The location that file share belongs to.
// +optional
Region string `json:"region,omitempty" bson:"region,omitempty"`
// The locality that file share belongs to.
// +optional
AvailabilityZone string `json:"availabilityZone,omitempty" bson:"availabilityZone,omitempty"`
// The status of the file share.
Status string `json:"status,omitempty" bson:"status,omitempty"`
// The protocol of the fileshare. e.g NFS, SMB etc.
// +optional
Protocols []string `json:"protocols,omitempty" bson:"protocols,omitempty"`
// Any tags assigned to the file share.
// +optional
Tags []Tag `json:"tags,omitempty" bson:"tags,omitempty"`
// The uuid of the snapshot from which the file share is created.
// +optional
SnapshotId string `json:"snapshotId,omitempty" bson:"snapshotId,omitempty"`
// Indicates whether the file share is encrypted.
// +optional
Encrypted *bool `json:"encrypted,omitempty" bson:"encrypted,omitempty"`
// EncryptionSettings that was used to protect the file share encryption.
// +optional
EncryptionSettings map[string]string `json:"encryptionSettings,omitempty" bson:"encryptionSettings,omitempty"`
// Metadata should be kept until the semantics between file share and backend storage resource.
Metadata map[string]interface{} `json:"metadata,omitempty" bson:"metadata,omitempty"`
}
type Tag struct {
// The key of the tag.
Key string `json:"key,omitempty" bson:"key,omitempty"`
// The value of the tag.
Value string `json:"value,omitempty" bson:"value,omitempty"`
}