-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdomain_permission.go
112 lines (87 loc) · 3.28 KB
/
domain_permission.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
109
110
111
112
// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// DomainPermission DomainPermission represents a permission applied to one domain (explicit block/allow).
//
// swagger:model DomainPermission
type DomainPermission struct {
// Time at which the permission entry was created (ISO 8601 Datetime).
// Example: 2021-07-30T09:20:25+00:00
CreatedAt string `json:"created_at,omitempty"`
// ID of the account that created this domain permission entry.
// Example: 01FBW2758ZB6PBR200YPDDJK4C
CreatedBy string `json:"created_by,omitempty"`
// The hostname of the domain.
// Example: example.org
Domain string `json:"domain,omitempty"`
// The ID of the domain permission entry.
// Example: 01FBW21XJA09XYX51KV5JVBW0F
// Read Only: true
ID string `json:"id,omitempty"`
// Obfuscate the domain name when serving this domain permission entry publicly.
// Example: false
Obfuscate bool `json:"obfuscate,omitempty"`
// Permission type of this entry (block, allow).
// Only set for domain permission drafts.
PermissionType string `json:"permission_type,omitempty"`
// Private comment for this permission entry, visible to this instance's admins only.
// Example: they are poopoo
PrivateComment string `json:"private_comment,omitempty"`
// If the domain is blocked, what's the publicly-stated reason for the block.
// Example: they smell
PublicComment string `json:"public_comment,omitempty"`
// Time at which this domain was silenced. Key will not be present on open domains.
// Example: 2021-07-30T09:20:25+00:00
SilencedAt string `json:"silenced_at,omitempty"`
// If applicable, the ID of the subscription that caused this domain permission entry to be created.
// Example: 01FBW25TF5J67JW3HFHZCSD23K
SubscriptionID string `json:"subscription_id,omitempty"`
// Time at which this domain was suspended. Key will not be present on open domains.
// Example: 2021-07-30T09:20:25+00:00
SuspendedAt string `json:"suspended_at,omitempty"`
}
// Validate validates this domain permission
func (m *DomainPermission) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validate this domain permission based on the context it is used
func (m *DomainPermission) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateID(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *DomainPermission) contextValidateID(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "id", "body", string(m.ID)); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *DomainPermission) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *DomainPermission) UnmarshalBinary(b []byte) error {
var res DomainPermission
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}