...

Source file src/github.com/letsencrypt/boulder/ctpolicy/loglist/schema/schema.go

Documentation: github.com/letsencrypt/boulder/ctpolicy/loglist/schema

     1  // Code generated by github.com/atombender/go-jsonschema, DO NOT EDIT.
     2  
     3  package schema
     4  
     5  import "fmt"
     6  import "encoding/json"
     7  import "reflect"
     8  
     9  type LogListSchemaJson struct {
    10  	// The time at which this version of the log list was published.
    11  	LogListTimestamp *string `json:"log_list_timestamp,omitempty"`
    12  
    13  	// People/organizations that run Certificate Transparency logs.
    14  	Operators []LogListSchemaJsonOperatorsElem `json:"operators"`
    15  
    16  	// The version will change whenever a change is made to any part of this log list.
    17  	Version *string `json:"version,omitempty"`
    18  }
    19  
    20  type LogListSchemaJsonOperatorsElem struct {
    21  	// The log operator can be contacted using any of these email addresses.
    22  	Email []string `json:"email"`
    23  
    24  	// Details of Certificate Transparency logs run by this operator.
    25  	Logs []LogListSchemaJsonOperatorsElemLogsElem `json:"logs"`
    26  
    27  	// Name corresponds to the JSON schema field "name".
    28  	Name string `json:"name"`
    29  }
    30  
    31  type LogListSchemaJsonOperatorsElemLogsElem struct {
    32  	// A human-readable description that can be used to identify this log.
    33  	Description *string `json:"description,omitempty"`
    34  
    35  	// The API endpoints are defined in
    36  	// https://github.com/google/certificate-transparency-rfcs/blob/master/dns/draft-ct-over-dns.md.
    37  	Dns *string `json:"dns,omitempty"`
    38  
    39  	// The log's public key as a DER-encoded ASN.1 SubjectPublicKeyInfo structure,
    40  	// then encoded as base64 (https://tools.ietf.org/html/rfc5280#section-4.1.2.7).
    41  	Key string `json:"key"`
    42  
    43  	// This is the LogID found in SCTs issued by this log
    44  	// (https://tools.ietf.org/html/rfc6962#section-3.2).
    45  	LogId string `json:"log_id"`
    46  
    47  	// The purpose of this log, e.g. test.
    48  	LogType *LogListSchemaJsonOperatorsElemLogsElemLogType `json:"log_type,omitempty"`
    49  
    50  	// The CT log should not take longer than this to incorporate a certificate
    51  	// (https://tools.ietf.org/html/rfc6962#section-3).
    52  	Mmd float64 `json:"mmd"`
    53  
    54  	// If the log has changed operators, this will contain a list of the previous
    55  	// operators, along with the timestamp when they stopped operating the log.
    56  	PreviousOperators []LogListSchemaJsonOperatorsElemLogsElemPreviousOperatorsElem `json:"previous_operators,omitempty"`
    57  
    58  	// State corresponds to the JSON schema field "state".
    59  	State *LogListSchemaJsonOperatorsElemLogsElemState `json:"state,omitempty"`
    60  
    61  	// The log will only accept certificates that expire (have a NotAfter date)
    62  	// between these dates.
    63  	TemporalInterval *LogListSchemaJsonOperatorsElemLogsElemTemporalInterval `json:"temporal_interval,omitempty"`
    64  
    65  	// The API endpoints are defined in https://tools.ietf.org/html/rfc6962#section-4.
    66  	Url string `json:"url"`
    67  }
    68  
    69  type LogListSchemaJsonOperatorsElemLogsElemLogType string
    70  
    71  const LogListSchemaJsonOperatorsElemLogsElemLogTypeProd LogListSchemaJsonOperatorsElemLogsElemLogType = "prod"
    72  const LogListSchemaJsonOperatorsElemLogsElemLogTypeTest LogListSchemaJsonOperatorsElemLogsElemLogType = "test"
    73  
    74  type LogListSchemaJsonOperatorsElemLogsElemPreviousOperatorsElem struct {
    75  	// The time at which this operator stopped operating this log.
    76  	EndTime string `json:"end_time"`
    77  
    78  	// Name corresponds to the JSON schema field "name".
    79  	Name string `json:"name"`
    80  }
    81  
    82  type LogListSchemaJsonOperatorsElemLogsElemState struct {
    83  	// Pending corresponds to the JSON schema field "pending".
    84  	Pending *State `json:"pending,omitempty"`
    85  
    86  	// Qualified corresponds to the JSON schema field "qualified".
    87  	Qualified *State `json:"qualified,omitempty"`
    88  
    89  	// Readonly corresponds to the JSON schema field "readonly".
    90  	Readonly interface{} `json:"readonly,omitempty"`
    91  
    92  	// Rejected corresponds to the JSON schema field "rejected".
    93  	Rejected *State `json:"rejected,omitempty"`
    94  
    95  	// Retired corresponds to the JSON schema field "retired".
    96  	Retired *State `json:"retired,omitempty"`
    97  
    98  	// Usable corresponds to the JSON schema field "usable".
    99  	Usable *State `json:"usable,omitempty"`
   100  }
   101  
   102  // The log will only accept certificates that expire (have a NotAfter date) between
   103  // these dates.
   104  type LogListSchemaJsonOperatorsElemLogsElemTemporalInterval struct {
   105  	// All certificates must expire before this date.
   106  	EndExclusive string `json:"end_exclusive"`
   107  
   108  	// All certificates must expire on this date or later.
   109  	StartInclusive string `json:"start_inclusive"`
   110  }
   111  
   112  type State struct {
   113  	// The time at which the log entered this state.
   114  	Timestamp string `json:"timestamp"`
   115  }
   116  
   117  // UnmarshalJSON implements json.Unmarshaler.
   118  func (j *LogListSchemaJsonOperatorsElemLogsElemPreviousOperatorsElem) UnmarshalJSON(b []byte) error {
   119  	var raw map[string]interface{}
   120  	if err := json.Unmarshal(b, &raw); err != nil {
   121  		return err
   122  	}
   123  	if v, ok := raw["end_time"]; !ok || v == nil {
   124  		return fmt.Errorf("field end_time: required")
   125  	}
   126  	if v, ok := raw["name"]; !ok || v == nil {
   127  		return fmt.Errorf("field name: required")
   128  	}
   129  	type Plain LogListSchemaJsonOperatorsElemLogsElemPreviousOperatorsElem
   130  	var plain Plain
   131  	if err := json.Unmarshal(b, &plain); err != nil {
   132  		return err
   133  	}
   134  	*j = LogListSchemaJsonOperatorsElemLogsElemPreviousOperatorsElem(plain)
   135  	return nil
   136  }
   137  
   138  // UnmarshalJSON implements json.Unmarshaler.
   139  func (j *LogListSchemaJsonOperatorsElemLogsElemTemporalInterval) UnmarshalJSON(b []byte) error {
   140  	var raw map[string]interface{}
   141  	if err := json.Unmarshal(b, &raw); err != nil {
   142  		return err
   143  	}
   144  	if v, ok := raw["end_exclusive"]; !ok || v == nil {
   145  		return fmt.Errorf("field end_exclusive: required")
   146  	}
   147  	if v, ok := raw["start_inclusive"]; !ok || v == nil {
   148  		return fmt.Errorf("field start_inclusive: required")
   149  	}
   150  	type Plain LogListSchemaJsonOperatorsElemLogsElemTemporalInterval
   151  	var plain Plain
   152  	if err := json.Unmarshal(b, &plain); err != nil {
   153  		return err
   154  	}
   155  	*j = LogListSchemaJsonOperatorsElemLogsElemTemporalInterval(plain)
   156  	return nil
   157  }
   158  
   159  // UnmarshalJSON implements json.Unmarshaler.
   160  func (j *LogListSchemaJsonOperatorsElemLogsElemLogType) UnmarshalJSON(b []byte) error {
   161  	var v string
   162  	if err := json.Unmarshal(b, &v); err != nil {
   163  		return err
   164  	}
   165  	var ok bool
   166  	for _, expected := range enumValues_LogListSchemaJsonOperatorsElemLogsElemLogType {
   167  		if reflect.DeepEqual(v, expected) {
   168  			ok = true
   169  			break
   170  		}
   171  	}
   172  	if !ok {
   173  		return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LogListSchemaJsonOperatorsElemLogsElemLogType, v)
   174  	}
   175  	*j = LogListSchemaJsonOperatorsElemLogsElemLogType(v)
   176  	return nil
   177  }
   178  
   179  // UnmarshalJSON implements json.Unmarshaler.
   180  func (j *LogListSchemaJsonOperatorsElemLogsElem) UnmarshalJSON(b []byte) error {
   181  	var raw map[string]interface{}
   182  	if err := json.Unmarshal(b, &raw); err != nil {
   183  		return err
   184  	}
   185  	if v, ok := raw["key"]; !ok || v == nil {
   186  		return fmt.Errorf("field key: required")
   187  	}
   188  	if v, ok := raw["log_id"]; !ok || v == nil {
   189  		return fmt.Errorf("field log_id: required")
   190  	}
   191  	if v, ok := raw["url"]; !ok || v == nil {
   192  		return fmt.Errorf("field url: required")
   193  	}
   194  	type Plain LogListSchemaJsonOperatorsElemLogsElem
   195  	var plain Plain
   196  	if err := json.Unmarshal(b, &plain); err != nil {
   197  		return err
   198  	}
   199  	if v, ok := raw["mmd"]; !ok || v == nil {
   200  		plain.Mmd = 86400
   201  	}
   202  	*j = LogListSchemaJsonOperatorsElemLogsElem(plain)
   203  	return nil
   204  }
   205  
   206  // UnmarshalJSON implements json.Unmarshaler.
   207  func (j *State) UnmarshalJSON(b []byte) error {
   208  	var raw map[string]interface{}
   209  	if err := json.Unmarshal(b, &raw); err != nil {
   210  		return err
   211  	}
   212  	if v, ok := raw["timestamp"]; !ok || v == nil {
   213  		return fmt.Errorf("field timestamp: required")
   214  	}
   215  	type Plain State
   216  	var plain Plain
   217  	if err := json.Unmarshal(b, &plain); err != nil {
   218  		return err
   219  	}
   220  	*j = State(plain)
   221  	return nil
   222  }
   223  
   224  // UnmarshalJSON implements json.Unmarshaler.
   225  func (j *LogListSchemaJsonOperatorsElem) UnmarshalJSON(b []byte) error {
   226  	var raw map[string]interface{}
   227  	if err := json.Unmarshal(b, &raw); err != nil {
   228  		return err
   229  	}
   230  	if v, ok := raw["email"]; !ok || v == nil {
   231  		return fmt.Errorf("field email: required")
   232  	}
   233  	if v, ok := raw["logs"]; !ok || v == nil {
   234  		return fmt.Errorf("field logs: required")
   235  	}
   236  	if v, ok := raw["name"]; !ok || v == nil {
   237  		return fmt.Errorf("field name: required")
   238  	}
   239  	type Plain LogListSchemaJsonOperatorsElem
   240  	var plain Plain
   241  	if err := json.Unmarshal(b, &plain); err != nil {
   242  		return err
   243  	}
   244  	*j = LogListSchemaJsonOperatorsElem(plain)
   245  	return nil
   246  }
   247  
   248  var enumValues_LogListSchemaJsonOperatorsElemLogsElemLogType = []interface{}{
   249  	"prod",
   250  	"test",
   251  }
   252  
   253  // UnmarshalJSON implements json.Unmarshaler.
   254  func (j *LogListSchemaJson) UnmarshalJSON(b []byte) error {
   255  	var raw map[string]interface{}
   256  	if err := json.Unmarshal(b, &raw); err != nil {
   257  		return err
   258  	}
   259  	if v, ok := raw["operators"]; !ok || v == nil {
   260  		return fmt.Errorf("field operators: required")
   261  	}
   262  	type Plain LogListSchemaJson
   263  	var plain Plain
   264  	if err := json.Unmarshal(b, &plain); err != nil {
   265  		return err
   266  	}
   267  	*j = LogListSchemaJson(plain)
   268  	return nil
   269  }
   270  

View as plain text