diff --git a/profiles/preview/preview/hdinsight/mgmt/hdinsight/models.go b/profiles/preview/preview/hdinsight/mgmt/hdinsight/models.go index d4bc1f34c28c..38445783a9f9 100644 --- a/profiles/preview/preview/hdinsight/mgmt/hdinsight/models.go +++ b/profiles/preview/preview/hdinsight/mgmt/hdinsight/models.go @@ -60,6 +60,14 @@ const ( ActiveDirectory DirectoryType = original.ActiveDirectory ) +type JSONWebKeyEncryptionAlgorithm = original.JSONWebKeyEncryptionAlgorithm + +const ( + RSA15 JSONWebKeyEncryptionAlgorithm = original.RSA15 + RSAOAEP JSONWebKeyEncryptionAlgorithm = original.RSAOAEP + RSAOAEP256 JSONWebKeyEncryptionAlgorithm = original.RSAOAEP256 +) + type OSType = original.OSType const ( @@ -96,6 +104,7 @@ type Cluster = original.Cluster type ClusterCreateParametersExtended = original.ClusterCreateParametersExtended type ClusterCreateProperties = original.ClusterCreateProperties type ClusterDefinition = original.ClusterDefinition +type ClusterDiskEncryptionParameters = original.ClusterDiskEncryptionParameters type ClusterGetProperties = original.ClusterGetProperties type ClusterIdentity = original.ClusterIdentity type ClusterIdentityUserAssignedIdentitiesValue = original.ClusterIdentityUserAssignedIdentitiesValue @@ -112,10 +121,12 @@ type ClustersCreateFuture = original.ClustersCreateFuture type ClustersDeleteFuture = original.ClustersDeleteFuture type ClustersExecuteScriptActionsFuture = original.ClustersExecuteScriptActionsFuture type ClustersResizeFuture = original.ClustersResizeFuture +type ClustersRotateDiskEncryptionKeyFuture = original.ClustersRotateDiskEncryptionKeyFuture type ComputeProfile = original.ComputeProfile type ConfigurationsUpdateFuture = original.ConfigurationsUpdateFuture type ConnectivityEndpoint = original.ConnectivityEndpoint type DataDisksGroups = original.DataDisksGroups +type DiskEncryptionProperties = original.DiskEncryptionProperties type ErrorResponse = original.ErrorResponse type Errors = original.Errors type ExecuteScriptActionParameters = original.ExecuteScriptActionParameters @@ -208,6 +219,9 @@ func PossibleClusterProvisioningStateValues() []ClusterProvisioningState { func PossibleDirectoryTypeValues() []DirectoryType { return original.PossibleDirectoryTypeValues() } +func PossibleJSONWebKeyEncryptionAlgorithmValues() []JSONWebKeyEncryptionAlgorithm { + return original.PossibleJSONWebKeyEncryptionAlgorithmValues() +} func PossibleOSTypeValues() []OSType { return original.PossibleOSTypeValues() } diff --git a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/clusters.go b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/clusters.go index 686524b80b08..a3b08e734ed4 100644 --- a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/clusters.go +++ b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/clusters.go @@ -662,6 +662,85 @@ func (client ClustersClient) ResizeResponder(resp *http.Response) (result autore return } +// RotateDiskEncryptionKey rotate disk encryption key of the specified HDInsight cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +// parameters - the parameters for the disk encryption operation. +func (client ClustersClient) RotateDiskEncryptionKey(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterDiskEncryptionParameters) (result ClustersRotateDiskEncryptionKeyFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.RotateDiskEncryptionKey") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RotateDiskEncryptionKeyPreparer(ctx, resourceGroupName, clusterName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "RotateDiskEncryptionKey", nil, "Failure preparing request") + return + } + + result, err = client.RotateDiskEncryptionKeySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "RotateDiskEncryptionKey", result.Response(), "Failure sending request") + return + } + + return +} + +// RotateDiskEncryptionKeyPreparer prepares the RotateDiskEncryptionKey request. +func (client ClustersClient) RotateDiskEncryptionKeyPreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterDiskEncryptionParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/rotatediskencryptionkey", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RotateDiskEncryptionKeySender sends the RotateDiskEncryptionKey request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) RotateDiskEncryptionKeySender(req *http.Request) (future ClustersRotateDiskEncryptionKeyFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// RotateDiskEncryptionKeyResponder handles the response to the RotateDiskEncryptionKey request. The method always +// closes the http.Response Body. +func (client ClustersClient) RotateDiskEncryptionKeyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + // Update patch HDInsight cluster with the specified parameters. // Parameters: // resourceGroupName - the name of the resource group. diff --git a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/hdinsightapi/interfaces.go b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/hdinsightapi/interfaces.go index b0dc431072f7..228de4c10c97 100644 --- a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/hdinsightapi/interfaces.go +++ b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/hdinsightapi/interfaces.go @@ -32,6 +32,7 @@ type ClustersClientAPI interface { List(ctx context.Context) (result hdinsight.ClusterListResultPage, err error) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result hdinsight.ClusterListResultPage, err error) Resize(ctx context.Context, resourceGroupName string, clusterName string, parameters hdinsight.ClusterResizeParameters) (result hdinsight.ClustersResizeFuture, err error) + RotateDiskEncryptionKey(ctx context.Context, resourceGroupName string, clusterName string, parameters hdinsight.ClusterDiskEncryptionParameters) (result hdinsight.ClustersRotateDiskEncryptionKeyFuture, err error) Update(ctx context.Context, resourceGroupName string, clusterName string, parameters hdinsight.ClusterPatchParameters) (result hdinsight.Cluster, err error) } diff --git a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/models.go b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/models.go index 2e35f4dca8e4..ec4333bd5ad5 100644 --- a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/models.go +++ b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/models.go @@ -81,6 +81,23 @@ func PossibleDirectoryTypeValues() []DirectoryType { return []DirectoryType{ActiveDirectory} } +// JSONWebKeyEncryptionAlgorithm enumerates the values for json web key encryption algorithm. +type JSONWebKeyEncryptionAlgorithm string + +const ( + // RSA15 ... + RSA15 JSONWebKeyEncryptionAlgorithm = "RSA1_5" + // RSAOAEP ... + RSAOAEP JSONWebKeyEncryptionAlgorithm = "RSA-OAEP" + // RSAOAEP256 ... + RSAOAEP256 JSONWebKeyEncryptionAlgorithm = "RSA-OAEP-256" +) + +// PossibleJSONWebKeyEncryptionAlgorithmValues returns an array of possible values for the JSONWebKeyEncryptionAlgorithm const type. +func PossibleJSONWebKeyEncryptionAlgorithmValues() []JSONWebKeyEncryptionAlgorithm { + return []JSONWebKeyEncryptionAlgorithm{RSA15, RSAOAEP, RSAOAEP256} +} + // OSType enumerates the values for os type. type OSType string @@ -556,6 +573,8 @@ type ClusterCreateProperties struct { ComputeProfile *ComputeProfile `json:"computeProfile,omitempty"` // StorageProfile - The storage profile. StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + // DiskEncryptionProperties - The disk encryption properties. + DiskEncryptionProperties *DiskEncryptionProperties `json:"diskEncryptionProperties,omitempty"` } // ClusterDefinition the cluster definition. @@ -588,6 +607,16 @@ func (cd ClusterDefinition) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// ClusterDiskEncryptionParameters the Disk Encryption Cluster request parameters. +type ClusterDiskEncryptionParameters struct { + // VaultURI - Base key vault URI where the customers key is located eg. https://myvault.vault.azure.net + VaultURI *string `json:"vaultUri,omitempty"` + // KeyName - Key name that is used for enabling disk encryption. + KeyName *string `json:"keyName,omitempty"` + // KeyVersion - Specific key version that is used for enabling disk encryption. + KeyVersion *string `json:"keyVersion,omitempty"` +} + // ClusterGetProperties the properties of cluster. type ClusterGetProperties struct { // ClusterVersion - The version of the cluster. @@ -614,6 +643,8 @@ type ClusterGetProperties struct { Errors *[]Errors `json:"errors,omitempty"` // ConnectivityEndpoints - The list of connectivity endpoints. ConnectivityEndpoints *[]ConnectivityEndpoint `json:"connectivityEndpoints,omitempty"` + // DiskEncryptionProperties - The disk encryption properties. + DiskEncryptionProperties *DiskEncryptionProperties `json:"diskEncryptionProperties,omitempty"` } // ClusterIdentity identity for the cluster. @@ -952,6 +983,29 @@ func (future *ClustersResizeFuture) Result(client ClustersClient) (ar autorest.R return } +// ClustersRotateDiskEncryptionKeyFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ClustersRotateDiskEncryptionKeyFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ClustersRotateDiskEncryptionKeyFuture) Result(client ClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersRotateDiskEncryptionKeyFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hdinsight.ClustersRotateDiskEncryptionKeyFuture") + return + } + ar.Response = future.Response() + return +} + // ComputeProfile describes the compute profile. type ComputeProfile struct { // Roles - The list of roles in the cluster. @@ -1003,6 +1057,20 @@ type DataDisksGroups struct { DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` } +// DiskEncryptionProperties the disk encryption properties +type DiskEncryptionProperties struct { + // VaultURI - Base key vault URI where the customers key is located eg. https://myvault.vault.azure.net + VaultURI *string `json:"vaultUri,omitempty"` + // KeyName - Key name that is used for enabling disk encryption. + KeyName *string `json:"keyName,omitempty"` + // KeyVersion - Specific key version that is used for enabling disk encryption. + KeyVersion *string `json:"keyVersion,omitempty"` + // EncryptionAlgorithm - Algorithm identifier for encryption, default RSA-OAEP. Possible values include: 'RSAOAEP', 'RSAOAEP256', 'RSA15' + EncryptionAlgorithm JSONWebKeyEncryptionAlgorithm `json:"encryptionAlgorithm,omitempty"` + // MsiResourceID - Resource ID of Managed Identity that is used to access the key vault. + MsiResourceID *string `json:"msiResourceId,omitempty"` +} + // ErrorResponse describes the format of Error response. type ErrorResponse struct { // Code - Error code diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/clusters.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/clusters.go index 9ee73164311a..c3f244287d7a 100644 --- a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/clusters.go +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/clusters.go @@ -662,6 +662,85 @@ func (client ClustersClient) ResizeResponder(resp *http.Response) (result autore return } +// RotateDiskEncryptionKey rotate disk encryption key of the specified HDInsight cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +// parameters - the parameters for the disk encryption operation. +func (client ClustersClient) RotateDiskEncryptionKey(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterDiskEncryptionParameters) (result ClustersRotateDiskEncryptionKeyFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.RotateDiskEncryptionKey") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RotateDiskEncryptionKeyPreparer(ctx, resourceGroupName, clusterName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "RotateDiskEncryptionKey", nil, "Failure preparing request") + return + } + + result, err = client.RotateDiskEncryptionKeySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "RotateDiskEncryptionKey", result.Response(), "Failure sending request") + return + } + + return +} + +// RotateDiskEncryptionKeyPreparer prepares the RotateDiskEncryptionKey request. +func (client ClustersClient) RotateDiskEncryptionKeyPreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterDiskEncryptionParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/rotatediskencryptionkey", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RotateDiskEncryptionKeySender sends the RotateDiskEncryptionKey request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) RotateDiskEncryptionKeySender(req *http.Request) (future ClustersRotateDiskEncryptionKeyFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// RotateDiskEncryptionKeyResponder handles the response to the RotateDiskEncryptionKey request. The method always +// closes the http.Response Body. +func (client ClustersClient) RotateDiskEncryptionKeyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + // Update patch HDInsight cluster with the specified parameters. // Parameters: // resourceGroupName - the name of the resource group. diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/hdinsightapi/interfaces.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/hdinsightapi/interfaces.go index e407165f340d..992b2eb3b91b 100644 --- a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/hdinsightapi/interfaces.go +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/hdinsightapi/interfaces.go @@ -32,6 +32,7 @@ type ClustersClientAPI interface { List(ctx context.Context) (result hdinsight.ClusterListResultPage, err error) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result hdinsight.ClusterListResultPage, err error) Resize(ctx context.Context, resourceGroupName string, clusterName string, parameters hdinsight.ClusterResizeParameters) (result hdinsight.ClustersResizeFuture, err error) + RotateDiskEncryptionKey(ctx context.Context, resourceGroupName string, clusterName string, parameters hdinsight.ClusterDiskEncryptionParameters) (result hdinsight.ClustersRotateDiskEncryptionKeyFuture, err error) Update(ctx context.Context, resourceGroupName string, clusterName string, parameters hdinsight.ClusterPatchParameters) (result hdinsight.Cluster, err error) } diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/models.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/models.go index fb0e30946252..ab96e299e968 100644 --- a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/models.go +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/models.go @@ -81,6 +81,23 @@ func PossibleDirectoryTypeValues() []DirectoryType { return []DirectoryType{ActiveDirectory} } +// JSONWebKeyEncryptionAlgorithm enumerates the values for json web key encryption algorithm. +type JSONWebKeyEncryptionAlgorithm string + +const ( + // RSA15 ... + RSA15 JSONWebKeyEncryptionAlgorithm = "RSA1_5" + // RSAOAEP ... + RSAOAEP JSONWebKeyEncryptionAlgorithm = "RSA-OAEP" + // RSAOAEP256 ... + RSAOAEP256 JSONWebKeyEncryptionAlgorithm = "RSA-OAEP-256" +) + +// PossibleJSONWebKeyEncryptionAlgorithmValues returns an array of possible values for the JSONWebKeyEncryptionAlgorithm const type. +func PossibleJSONWebKeyEncryptionAlgorithmValues() []JSONWebKeyEncryptionAlgorithm { + return []JSONWebKeyEncryptionAlgorithm{RSA15, RSAOAEP, RSAOAEP256} +} + // OSType enumerates the values for os type. type OSType string @@ -515,6 +532,8 @@ type ClusterCreateProperties struct { ComputeProfile *ComputeProfile `json:"computeProfile,omitempty"` // StorageProfile - The storage profile. StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + // DiskEncryptionProperties - The disk encryption properties. + DiskEncryptionProperties *DiskEncryptionProperties `json:"diskEncryptionProperties,omitempty"` } // ClusterDefinition the cluster definition. @@ -547,6 +566,16 @@ func (cd ClusterDefinition) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// ClusterDiskEncryptionParameters the Disk Encryption Cluster request parameters. +type ClusterDiskEncryptionParameters struct { + // VaultURI - Base key vault URI where the customers key is located eg. https://myvault.vault.azure.net + VaultURI *string `json:"vaultUri,omitempty"` + // KeyName - Key name that is used for enabling disk encryption. + KeyName *string `json:"keyName,omitempty"` + // KeyVersion - Specific key version that is used for enabling disk encryption. + KeyVersion *string `json:"keyVersion,omitempty"` +} + // ClusterGetProperties the properties of cluster. type ClusterGetProperties struct { // ClusterVersion - The version of the cluster. @@ -573,6 +602,8 @@ type ClusterGetProperties struct { Errors *[]Errors `json:"errors,omitempty"` // ConnectivityEndpoints - The list of connectivity endpoints. ConnectivityEndpoints *[]ConnectivityEndpoint `json:"connectivityEndpoints,omitempty"` + // DiskEncryptionProperties - The disk encryption properties. + DiskEncryptionProperties *DiskEncryptionProperties `json:"diskEncryptionProperties,omitempty"` } // ClusterIdentity identity for the cluster. @@ -911,6 +942,29 @@ func (future *ClustersResizeFuture) Result(client ClustersClient) (ar autorest.R return } +// ClustersRotateDiskEncryptionKeyFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ClustersRotateDiskEncryptionKeyFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ClustersRotateDiskEncryptionKeyFuture) Result(client ClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersRotateDiskEncryptionKeyFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hdinsight.ClustersRotateDiskEncryptionKeyFuture") + return + } + ar.Response = future.Response() + return +} + // ComputeProfile describes the compute profile. type ComputeProfile struct { // Roles - The list of roles in the cluster. @@ -962,6 +1016,20 @@ type DataDisksGroups struct { DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` } +// DiskEncryptionProperties the disk encryption properties +type DiskEncryptionProperties struct { + // VaultURI - Base key vault URI where the customers key is located eg. https://myvault.vault.azure.net + VaultURI *string `json:"vaultUri,omitempty"` + // KeyName - Key name that is used for enabling disk encryption. + KeyName *string `json:"keyName,omitempty"` + // KeyVersion - Specific key version that is used for enabling disk encryption. + KeyVersion *string `json:"keyVersion,omitempty"` + // EncryptionAlgorithm - Algorithm identifier for encryption, default RSA-OAEP. Possible values include: 'RSAOAEP', 'RSAOAEP256', 'RSA15' + EncryptionAlgorithm JSONWebKeyEncryptionAlgorithm `json:"encryptionAlgorithm,omitempty"` + // MsiResourceID - Resource ID of Managed Identity that is used to access the key vault. + MsiResourceID *string `json:"msiResourceId,omitempty"` +} + // ErrorResponse describes the format of Error response. type ErrorResponse struct { // Code - Error code