1package attestation
2
3// Copyright (c) Microsoft and contributors.  All rights reserved.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13//
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// Code generated by Microsoft (R) AutoRest Code Generator.
18// Changes may cause incorrect behavior and will be lost if the code is regenerated.
19
20import (
21	"encoding/json"
22	"github.com/Azure/go-autorest/autorest"
23)
24
25// The package's fully qualified name.
26const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/attestation/mgmt/2018-09-01-preview/attestation"
27
28// ServiceStatus enumerates the values for service status.
29type ServiceStatus string
30
31const (
32	// Error ...
33	Error ServiceStatus = "Error"
34	// NotReady ...
35	NotReady ServiceStatus = "NotReady"
36	// Ready ...
37	Ready ServiceStatus = "Ready"
38)
39
40// PossibleServiceStatusValues returns an array of possible values for the ServiceStatus const type.
41func PossibleServiceStatusValues() []ServiceStatus {
42	return []ServiceStatus{Error, NotReady, Ready}
43}
44
45// AzureEntityResource the resource model definition for a Azure Resource Manager resource with an etag.
46type AzureEntityResource struct {
47	// Etag - READ-ONLY; Resource Etag.
48	Etag *string `json:"etag,omitempty"`
49	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
50	ID *string `json:"id,omitempty"`
51	// Name - READ-ONLY; The name of the resource
52	Name *string `json:"name,omitempty"`
53	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
54	Type *string `json:"type,omitempty"`
55}
56
57// CloudError an error response from Attestation.
58type CloudError struct {
59	Error *CloudErrorBody `json:"error,omitempty"`
60}
61
62// CloudErrorBody an error response from Attestation.
63type CloudErrorBody struct {
64	// Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically.
65	Code *string `json:"code,omitempty"`
66	// Message - A message describing the error, intended to be suitable for displaying in a user interface.
67	Message *string `json:"message,omitempty"`
68}
69
70// JSONWebKey ...
71type JSONWebKey struct {
72	// Alg - The "alg" (algorithm) parameter identifies the algorithm intended for
73	// use with the key.  The values used should either be registered in the
74	// IANA "JSON Web Signature and Encryption Algorithms" registry
75	// established by [JWA] or be a value that contains a Collision-
76	// Resistant Name.
77	Alg *string `json:"alg,omitempty"`
78	// Crv - The "crv" (curve) parameter identifies the curve type
79	Crv *string `json:"crv,omitempty"`
80	// D - RSA private exponent or ECC private key
81	D *string `json:"d,omitempty"`
82	// Dp - RSA Private Key Parameter
83	Dp *string `json:"dp,omitempty"`
84	// Dq - RSA Private Key Parameter
85	Dq *string `json:"dq,omitempty"`
86	// E - RSA public exponent, in Base64
87	E *string `json:"e,omitempty"`
88	// K - Symmetric key
89	K *string `json:"k,omitempty"`
90	// Kid - The "kid" (key ID) parameter is used to match a specific key.  This
91	// is used, for instance, to choose among a set of keys within a JWK Set
92	// during key rollover.  The structure of the "kid" value is
93	// unspecified.  When "kid" values are used within a JWK Set, different
94	// keys within the JWK Set SHOULD use distinct "kid" values.  (One
95	// example in which different keys might use the same "kid" value is if
96	// they have different "kty" (key type) values but are considered to be
97	// equivalent alternatives by the application using them.)  The "kid"
98	// value is a case-sensitive string.
99	Kid *string `json:"kid,omitempty"`
100	// Kty - The "kty" (key type) parameter identifies the cryptographic algorithm
101	// family used with the key, such as "RSA" or "EC". "kty" values should
102	// either be registered in the IANA "JSON Web Key Types" registry
103	// established by [JWA] or be a value that contains a Collision-
104	// Resistant Name.  The "kty" value is a case-sensitive string.
105	Kty *string `json:"kty,omitempty"`
106	// N - RSA modulus, in Base64
107	N *string `json:"n,omitempty"`
108	// P - RSA secret prime
109	P *string `json:"p,omitempty"`
110	// Q - RSA secret prime, with p < q
111	Q *string `json:"q,omitempty"`
112	// Qi - RSA Private Key Parameter
113	Qi *string `json:"qi,omitempty"`
114	// Use - Use ("public key use") identifies the intended use of
115	// the public key. The "use" parameter is employed to indicate whether
116	// a public key is used for encrypting data or verifying the signature
117	// on data. Values are commonly "sig" (signature) or "enc" (encryption).
118	Use *string `json:"use,omitempty"`
119	// X - X coordinate for the Elliptic Curve point
120	X *string `json:"x,omitempty"`
121	// X5c - The "x5c" (X.509 certificate chain) parameter contains a chain of one
122	// or more PKIX certificates [RFC5280].  The certificate chain is
123	// represented as a JSON array of certificate value strings.  Each
124	// string in the array is a base64-encoded (Section 4 of [RFC4648] --
125	// not base64url-encoded) DER [ITU.X690.1994] PKIX certificate value.
126	// The PKIX certificate containing the key value MUST be the first
127	// certificate.
128	X5c *[]string `json:"x5c,omitempty"`
129	// Y - Y coordinate for the Elliptic Curve point
130	Y *string `json:"y,omitempty"`
131}
132
133// JSONWebKeySet ...
134type JSONWebKeySet struct {
135	// Keys - The value of the "keys" parameter is an array of JWK values.  By
136	// default, the order of the JWK values within the array does not imply
137	// an order of preference among them, although applications of JWK Sets
138	// can choose to assign a meaning to the order for their purposes, if
139	// desired.
140	Keys *[]JSONWebKey `json:"keys,omitempty"`
141}
142
143// OperationList list of supported operations.
144type OperationList struct {
145	autorest.Response `json:"-"`
146	// Value - List of supported operations.
147	Value *[]OperationsDefinition `json:"value,omitempty"`
148}
149
150// OperationsDefinition definition object with the name and properties of an operation.
151type OperationsDefinition struct {
152	// Name - Name of the operation.
153	Name *string `json:"name,omitempty"`
154	// Display - Display object with properties of the operation.
155	Display *OperationsDisplayDefinition `json:"display,omitempty"`
156}
157
158// OperationsDisplayDefinition display object with properties of the operation.
159type OperationsDisplayDefinition struct {
160	// Provider - Resource provider of the operation.
161	Provider *string `json:"provider,omitempty"`
162	// Resource - Resource for the operation.
163	Resource *string `json:"resource,omitempty"`
164	// Operation - Short description of the operation.
165	Operation *string `json:"operation,omitempty"`
166	// Description - Description of the operation.
167	Description *string `json:"description,omitempty"`
168}
169
170// Provider attestation service response message.
171type Provider struct {
172	autorest.Response `json:"-"`
173	// StatusResult - Describes Attestation service status.
174	*StatusResult `json:"properties,omitempty"`
175	// Tags - Resource tags.
176	Tags map[string]*string `json:"tags"`
177	// Location - The geo-location where the resource lives
178	Location *string `json:"location,omitempty"`
179	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
180	ID *string `json:"id,omitempty"`
181	// Name - READ-ONLY; The name of the resource
182	Name *string `json:"name,omitempty"`
183	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
184	Type *string `json:"type,omitempty"`
185}
186
187// MarshalJSON is the custom marshaler for Provider.
188func (p Provider) MarshalJSON() ([]byte, error) {
189	objectMap := make(map[string]interface{})
190	if p.StatusResult != nil {
191		objectMap["properties"] = p.StatusResult
192	}
193	if p.Tags != nil {
194		objectMap["tags"] = p.Tags
195	}
196	if p.Location != nil {
197		objectMap["location"] = p.Location
198	}
199	return json.Marshal(objectMap)
200}
201
202// UnmarshalJSON is the custom unmarshaler for Provider struct.
203func (p *Provider) UnmarshalJSON(body []byte) error {
204	var m map[string]*json.RawMessage
205	err := json.Unmarshal(body, &m)
206	if err != nil {
207		return err
208	}
209	for k, v := range m {
210		switch k {
211		case "properties":
212			if v != nil {
213				var statusResult StatusResult
214				err = json.Unmarshal(*v, &statusResult)
215				if err != nil {
216					return err
217				}
218				p.StatusResult = &statusResult
219			}
220		case "tags":
221			if v != nil {
222				var tags map[string]*string
223				err = json.Unmarshal(*v, &tags)
224				if err != nil {
225					return err
226				}
227				p.Tags = tags
228			}
229		case "location":
230			if v != nil {
231				var location string
232				err = json.Unmarshal(*v, &location)
233				if err != nil {
234					return err
235				}
236				p.Location = &location
237			}
238		case "id":
239			if v != nil {
240				var ID string
241				err = json.Unmarshal(*v, &ID)
242				if err != nil {
243					return err
244				}
245				p.ID = &ID
246			}
247		case "name":
248			if v != nil {
249				var name string
250				err = json.Unmarshal(*v, &name)
251				if err != nil {
252					return err
253				}
254				p.Name = &name
255			}
256		case "type":
257			if v != nil {
258				var typeVar string
259				err = json.Unmarshal(*v, &typeVar)
260				if err != nil {
261					return err
262				}
263				p.Type = &typeVar
264			}
265		}
266	}
267
268	return nil
269}
270
271// ProviderListResult attestation Providers List.
272type ProviderListResult struct {
273	autorest.Response `json:"-"`
274	// Value - Attestation Provider array.
275	Value *[]Provider `json:"value,omitempty"`
276}
277
278// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than
279// required location and tags
280type ProxyResource struct {
281	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
282	ID *string `json:"id,omitempty"`
283	// Name - READ-ONLY; The name of the resource
284	Name *string `json:"name,omitempty"`
285	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
286	Type *string `json:"type,omitempty"`
287}
288
289// Resource ...
290type Resource struct {
291	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
292	ID *string `json:"id,omitempty"`
293	// Name - READ-ONLY; The name of the resource
294	Name *string `json:"name,omitempty"`
295	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
296	Type *string `json:"type,omitempty"`
297}
298
299// ServiceCreationParams parameters for creating an attestation service instance
300type ServiceCreationParams struct {
301	// Location - The supported Azure location where the attestation service instance should be created.
302	Location *string `json:"location,omitempty"`
303	// Tags - The tags that will be assigned to the attestation service instance.
304	Tags map[string]*string `json:"tags"`
305	// Properties - Properties of the attestation service instance
306	Properties *ServiceCreationSpecificParams `json:"properties,omitempty"`
307}
308
309// MarshalJSON is the custom marshaler for ServiceCreationParams.
310func (scp ServiceCreationParams) MarshalJSON() ([]byte, error) {
311	objectMap := make(map[string]interface{})
312	if scp.Location != nil {
313		objectMap["location"] = scp.Location
314	}
315	if scp.Tags != nil {
316		objectMap["tags"] = scp.Tags
317	}
318	if scp.Properties != nil {
319		objectMap["properties"] = scp.Properties
320	}
321	return json.Marshal(objectMap)
322}
323
324// ServiceCreationSpecificParams client supplied parameters used to create a new attestation service
325// instance.
326type ServiceCreationSpecificParams struct {
327	// AttestationPolicy - Name of attestation policy.
328	AttestationPolicy *string `json:"attestationPolicy,omitempty"`
329	// PolicySigningCertificates - JSON Web Key Set defining a set of X.509 Certificates that will represent the parent certificate for the signing certificate used for policy operations
330	PolicySigningCertificates *JSONWebKeySet `json:"policySigningCertificates,omitempty"`
331}
332
333// ServicePatchParams parameters for patching an attestation service instance
334type ServicePatchParams struct {
335	// Tags - The tags that will be assigned to the attestation service instance.
336	Tags map[string]*string `json:"tags"`
337}
338
339// MarshalJSON is the custom marshaler for ServicePatchParams.
340func (spp ServicePatchParams) MarshalJSON() ([]byte, error) {
341	objectMap := make(map[string]interface{})
342	if spp.Tags != nil {
343		objectMap["tags"] = spp.Tags
344	}
345	return json.Marshal(objectMap)
346}
347
348// StatusResult status of attestation service.
349type StatusResult struct {
350	// TrustModel - Trust model for the attestation service instance.
351	TrustModel *string `json:"trustModel,omitempty"`
352	// Status - Status of attestation service. Possible values include: 'Ready', 'NotReady', 'Error'
353	Status ServiceStatus `json:"status,omitempty"`
354	// AttestURI - Gets the uri of attestation service
355	AttestURI *string `json:"attestUri,omitempty"`
356}
357
358// TrackedResource the resource model definition for a ARM tracked top level resource
359type TrackedResource struct {
360	// Tags - Resource tags.
361	Tags map[string]*string `json:"tags"`
362	// Location - The geo-location where the resource lives
363	Location *string `json:"location,omitempty"`
364	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
365	ID *string `json:"id,omitempty"`
366	// Name - READ-ONLY; The name of the resource
367	Name *string `json:"name,omitempty"`
368	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
369	Type *string `json:"type,omitempty"`
370}
371
372// MarshalJSON is the custom marshaler for TrackedResource.
373func (tr TrackedResource) MarshalJSON() ([]byte, error) {
374	objectMap := make(map[string]interface{})
375	if tr.Tags != nil {
376		objectMap["tags"] = tr.Tags
377	}
378	if tr.Location != nil {
379		objectMap["location"] = tr.Location
380	}
381	return json.Marshal(objectMap)
382}
383