1package aad 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/aad/mgmt/2017-04-01/aad" 27 28// Category enumerates the values for category. 29type Category string 30 31const ( 32 // AuditLogs ... 33 AuditLogs Category = "AuditLogs" 34 // SignInLogs ... 35 SignInLogs Category = "SignInLogs" 36) 37 38// PossibleCategoryValues returns an array of possible values for the Category const type. 39func PossibleCategoryValues() []Category { 40 return []Category{AuditLogs, SignInLogs} 41} 42 43// CategoryType enumerates the values for category type. 44type CategoryType string 45 46const ( 47 // Logs ... 48 Logs CategoryType = "Logs" 49) 50 51// PossibleCategoryTypeValues returns an array of possible values for the CategoryType const type. 52func PossibleCategoryTypeValues() []CategoryType { 53 return []CategoryType{Logs} 54} 55 56// DiagnosticSettings the diagnostic settings. 57type DiagnosticSettings struct { 58 // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. 59 StorageAccountID *string `json:"storageAccountId,omitempty"` 60 // ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. 61 ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` 62 // WorkspaceID - The workspace ID (resource ID of a Log Analytics workspace) for a Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 63 WorkspaceID *string `json:"workspaceId,omitempty"` 64 // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. 65 EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` 66 // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. 67 EventHubName *string `json:"eventHubName,omitempty"` 68 // Logs - The list of logs settings. 69 Logs *[]LogSettings `json:"logs,omitempty"` 70} 71 72// DiagnosticSettingsCategory the diagnostic settings Category. 73type DiagnosticSettingsCategory struct { 74 // CategoryType - The type of the diagnostic settings category. Possible values include: 'Logs' 75 CategoryType CategoryType `json:"categoryType,omitempty"` 76} 77 78// DiagnosticSettingsCategoryResource the diagnostic settings category resource. 79type DiagnosticSettingsCategoryResource struct { 80 // DiagnosticSettingsCategory - The properties of a Diagnostic Settings Category. 81 *DiagnosticSettingsCategory `json:"properties,omitempty"` 82 // ID - READ-ONLY; Azure resource Id 83 ID *string `json:"id,omitempty"` 84 // Name - READ-ONLY; Azure resource name 85 Name *string `json:"name,omitempty"` 86 // Type - READ-ONLY; Azure resource type 87 Type *string `json:"type,omitempty"` 88} 89 90// MarshalJSON is the custom marshaler for DiagnosticSettingsCategoryResource. 91func (dscr DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) { 92 objectMap := make(map[string]interface{}) 93 if dscr.DiagnosticSettingsCategory != nil { 94 objectMap["properties"] = dscr.DiagnosticSettingsCategory 95 } 96 return json.Marshal(objectMap) 97} 98 99// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsCategoryResource struct. 100func (dscr *DiagnosticSettingsCategoryResource) UnmarshalJSON(body []byte) error { 101 var m map[string]*json.RawMessage 102 err := json.Unmarshal(body, &m) 103 if err != nil { 104 return err 105 } 106 for k, v := range m { 107 switch k { 108 case "properties": 109 if v != nil { 110 var diagnosticSettingsCategory DiagnosticSettingsCategory 111 err = json.Unmarshal(*v, &diagnosticSettingsCategory) 112 if err != nil { 113 return err 114 } 115 dscr.DiagnosticSettingsCategory = &diagnosticSettingsCategory 116 } 117 case "id": 118 if v != nil { 119 var ID string 120 err = json.Unmarshal(*v, &ID) 121 if err != nil { 122 return err 123 } 124 dscr.ID = &ID 125 } 126 case "name": 127 if v != nil { 128 var name string 129 err = json.Unmarshal(*v, &name) 130 if err != nil { 131 return err 132 } 133 dscr.Name = &name 134 } 135 case "type": 136 if v != nil { 137 var typeVar string 138 err = json.Unmarshal(*v, &typeVar) 139 if err != nil { 140 return err 141 } 142 dscr.Type = &typeVar 143 } 144 } 145 } 146 147 return nil 148} 149 150// DiagnosticSettingsCategoryResourceCollection represents a collection of diagnostic setting category 151// resources. 152type DiagnosticSettingsCategoryResourceCollection struct { 153 autorest.Response `json:"-"` 154 // Value - The collection of diagnostic settings category resources. 155 Value *[]DiagnosticSettingsCategoryResource `json:"value,omitempty"` 156} 157 158// DiagnosticSettingsResource the diagnostic setting resource. 159type DiagnosticSettingsResource struct { 160 autorest.Response `json:"-"` 161 // DiagnosticSettings - Properties of a Diagnostic Settings Resource. 162 *DiagnosticSettings `json:"properties,omitempty"` 163 // ID - READ-ONLY; Azure resource Id 164 ID *string `json:"id,omitempty"` 165 // Name - READ-ONLY; Azure resource name 166 Name *string `json:"name,omitempty"` 167 // Type - READ-ONLY; Azure resource type 168 Type *string `json:"type,omitempty"` 169} 170 171// MarshalJSON is the custom marshaler for DiagnosticSettingsResource. 172func (dsr DiagnosticSettingsResource) MarshalJSON() ([]byte, error) { 173 objectMap := make(map[string]interface{}) 174 if dsr.DiagnosticSettings != nil { 175 objectMap["properties"] = dsr.DiagnosticSettings 176 } 177 return json.Marshal(objectMap) 178} 179 180// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsResource struct. 181func (dsr *DiagnosticSettingsResource) UnmarshalJSON(body []byte) error { 182 var m map[string]*json.RawMessage 183 err := json.Unmarshal(body, &m) 184 if err != nil { 185 return err 186 } 187 for k, v := range m { 188 switch k { 189 case "properties": 190 if v != nil { 191 var diagnosticSettings DiagnosticSettings 192 err = json.Unmarshal(*v, &diagnosticSettings) 193 if err != nil { 194 return err 195 } 196 dsr.DiagnosticSettings = &diagnosticSettings 197 } 198 case "id": 199 if v != nil { 200 var ID string 201 err = json.Unmarshal(*v, &ID) 202 if err != nil { 203 return err 204 } 205 dsr.ID = &ID 206 } 207 case "name": 208 if v != nil { 209 var name string 210 err = json.Unmarshal(*v, &name) 211 if err != nil { 212 return err 213 } 214 dsr.Name = &name 215 } 216 case "type": 217 if v != nil { 218 var typeVar string 219 err = json.Unmarshal(*v, &typeVar) 220 if err != nil { 221 return err 222 } 223 dsr.Type = &typeVar 224 } 225 } 226 } 227 228 return nil 229} 230 231// DiagnosticSettingsResourceCollection represents a collection of alert rule resources. 232type DiagnosticSettingsResourceCollection struct { 233 autorest.Response `json:"-"` 234 // Value - The collection of diagnostic settings resources. 235 Value *[]DiagnosticSettingsResource `json:"value,omitempty"` 236} 237 238// Display contains the localized display information for this particular operation / action. These value 239// will be used by several clients for (1) custom role definitions for RBAC; (2) complex query filters for 240// the event service; and (3) audit history / records for management operations. 241type Display struct { 242 // Publisher - The publisher. The localized friendly form of the resource publisher name. 243 Publisher *string `json:"publisher,omitempty"` 244 // Provider - The provider. The localized friendly form of the resource provider name – it is expected to also include the publisher/company responsible. It should use Title Casing and begin with "Microsoft" for 1st party services. e.g. "Microsoft Monitoring Insights" or "Microsoft Compute." 245 Provider *string `json:"provider,omitempty"` 246 // Resource - The resource. The localized friendly form of the resource related to this action/operation – it should match the public documentation for the resource provider. It should use Title Casing. This value should be unique for a particular URL type (e.g. nested types should *not* reuse their parent’s display.resource field). e.g. "Virtual Machines" or "Scheduler Job Collections", or "Virtual Machine VM Sizes" or "Scheduler Jobs" 247 Resource *string `json:"resource,omitempty"` 248 // Operation - The operation. The localized friendly name for the operation, as it should be shown to the user. It should be concise (to fit in drop downs) but clear (i.e. self-documenting). It should use Title Casing. Prescriptive guidance: Read Create or Update Delete 'ActionName' 249 Operation *string `json:"operation,omitempty"` 250 // Description - The description. The localized friendly description for the operation, as it should be shown to the user. It should be thorough, yet concise – it will be used in tool tips and detailed views. Prescriptive guidance for namespaces: Read any 'display.provider' resource Create or Update any 'display.provider' resource Delete any 'display.provider' resource Perform any other action on any 'display.provider' resource Prescriptive guidance for namespaces: Read any 'display.resource' Create or Update any 'display.resource' Delete any 'display.resource' 'ActionName' any 'display.resources' 251 Description *string `json:"description,omitempty"` 252} 253 254// ErrorDefinition error definition. 255type ErrorDefinition struct { 256 // Code - READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. 257 Code *string `json:"code,omitempty"` 258 // Message - READ-ONLY; Description of the error. 259 Message *string `json:"message,omitempty"` 260 // Details - READ-ONLY; Internal error details. 261 Details *[]ErrorDefinition `json:"details,omitempty"` 262} 263 264// ErrorResponse error response. 265type ErrorResponse struct { 266 // Error - The error details. 267 Error *ErrorDefinition `json:"error,omitempty"` 268} 269 270// LogSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. 271type LogSettings struct { 272 // Category - Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation. Possible values include: 'AuditLogs', 'SignInLogs' 273 Category Category `json:"category,omitempty"` 274 // Enabled - A value indicating whether this log is enabled. 275 Enabled *bool `json:"enabled,omitempty"` 276 // RetentionPolicy - The retention policy for this log. 277 RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` 278} 279 280// OperationsDiscovery operations discovery class. 281type OperationsDiscovery struct { 282 // Name - Name of the API. The name of the operation being performed on this particular object. It should match the action name that appears in RBAC / the event service. Examples of operations include: * Microsoft.Compute/virtualMachine/capture/action * Microsoft.Compute/virtualMachine/restart/action * Microsoft.Compute/virtualMachine/write * Microsoft.Compute/virtualMachine/read * Microsoft.Compute/virtualMachine/delete Each action should include, in order: (1) Resource Provider Namespace (2) Type hierarchy for which the action applies (e.g. server/databases for a SQL Azure database) (3) Read, Write, Action or Delete indicating which type applies. If it is a PUT/PATCH on a collection or named value, Write should be used. If it is a GET, Read should be used. If it is a DELETE, Delete should be used. If it is a POST, Action should be used. 283 Name *string `json:"name,omitempty"` 284 // Display - Object type 285 Display *Display `json:"display,omitempty"` 286 // Origin - Origin. The intended executor of the operation; governs the display of the operation in the RBAC UX and the audit logs UX. Default value is "user,system" 287 Origin *string `json:"origin,omitempty"` 288 // Properties - Properties. Reserved for future use. 289 Properties interface{} `json:"properties,omitempty"` 290} 291 292// OperationsDiscoveryCollection collection of ClientDiscovery details. 293type OperationsDiscoveryCollection struct { 294 autorest.Response `json:"-"` 295 // Value - The ClientDiscovery details. 296 Value *[]OperationsDiscovery `json:"value,omitempty"` 297} 298 299// ProxyOnlyResource a proxy only azure resource object. 300type ProxyOnlyResource struct { 301 // ID - READ-ONLY; Azure resource Id 302 ID *string `json:"id,omitempty"` 303 // Name - READ-ONLY; Azure resource name 304 Name *string `json:"name,omitempty"` 305 // Type - READ-ONLY; Azure resource type 306 Type *string `json:"type,omitempty"` 307} 308 309// RetentionPolicy specifies the retention policy for the log. 310type RetentionPolicy struct { 311 // Enabled - A value indicating whether the retention policy is enabled. 312 Enabled *bool `json:"enabled,omitempty"` 313 // Days - The number of days for the retention in days. A value of 0 will retain the events indefinitely. 314 Days *int32 `json:"days,omitempty"` 315} 316